Changeset 271735 in webkit
- Timestamp:
- Jan 21, 2021 7:50:35 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 23 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https.html (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/updateWith-shippingOptions.https-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/paymentrequest/updateWith-shippingOptions.https.html (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingOption-attribute.https-expected.txt (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/inspector/ConsoleMessage.cpp (modified) (1 diff)
-
Source/JavaScriptCore/inspector/protocol/Console.json (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ConsoleClient.cpp (modified) (1 diff)
-
Source/JavaScriptCore/runtime/ConsoleTypes.h (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (modified) (6 diffs)
-
Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp (modified) (1 diff)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/IssueMessage.js (modified) (1 diff)
-
Source/WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r271730 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 * http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https-expected.txt: 9 * http/tests/paymentrequest/payment-request-change-shipping-option.https.html: 10 * http/tests/paymentrequest/payment-request-change-shipping-option.https-expected.txt: 11 * http/tests/paymentrequest/payment-response-retry-method.https-expected.txt: 12 * http/tests/paymentrequest/updateWith-shippingOptions.https.html: 13 * http/tests/paymentrequest/updateWith-shippingOptions.https-expected.txt: 14 1 15 2021-01-21 Simon Fraser <simon.fraser@apple.com> 2 16 -
trunk/LayoutTests/http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https-expected.txt
r267644 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 2 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 3 If the requestShipping member is true, then shippingAddress's PaymentAddress must match the expected values. 2 4 -
trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https-expected.txt
r267644 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 2 2 3 PASS Test for PaymentRequest shippingOption attribute -
trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https.html
r226766 r271735 64 64 internals.mockPaymentCoordinator.changeShippingOption("valid-1"); 65 65 }; 66 assert_equals( 67 request.shippingOption, 68 "initially-selected", 69 "Must be 'initially-selected', as the selected member is true" 70 ); 66 // FIXME: <rdar://problem/73464404> 67 // assert_equals(request.shippingOption, "initially-selected", "Must be 'initially-selected', as the selected member is true"); 68 assert_equals(request.shippingOption, "valid-1", "Must be the first shipping option regardless of the selected property."); 71 69 const listenerPromise = new Promise(resolve => { 72 70 request.addEventListener("shippingoptionchange", () => { -
trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https-expected.txt
r267644 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 2 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 3 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 4 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 5 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 6 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 7 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 8 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 9 2 10 PASS Can construct a payment request (smoke test). -
trunk/LayoutTests/http/tests/paymentrequest/updateWith-shippingOptions.https-expected.txt
r271703 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 2 2 3 PASS Calling `updateWith` with a new `shippingOptions` without `requestShipping` should not update any values. -
trunk/LayoutTests/http/tests/paymentrequest/updateWith-shippingOptions.https.html
r271703 r271735 99 99 assert_equals(internals.mockPaymentCoordinator.shippingMethods[i].amount, detailsUpdate.shippingOptions[i].amount.value, `shipping option ${i} amount should change`); 100 100 } 101 assert_equals(request.shippingOption, detailsUpdate.shippingOptions.find((shippingOption) => shippingOption.selected).id, "selected shipping option should change"); 101 // FIXME: <rdar://problem/73464404> 102 // assert_equals(request.shippingOption, detailsUpdate.shippingOptions.find((shippingOption) => shippingOption.selected).id, "selected shipping option should change"); 103 assert_equals(request.shippingOption, detailsUpdate.shippingOptions[0].id, "selected shipping option should change"); 102 104 assert_equals(response.shippingOption, request.shippingOption, "selected shipping option should also be exposed on the response"); 103 105 -
trunk/LayoutTests/imported/w3c/ChangeLog
r271734 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 * web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt: 9 * web-platform-tests/payment-request/payment-request-shippingOption-attribute.https-expected.txt: 10 1 11 2021-01-21 Devin Rousso <drousso@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt
r271734 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 2 2 3 PASS If details.id is missing, assign an identifier … … 18 19 PASS If there is no selected shipping option, then PaymentRequest.shippingOption remains null 19 20 PASS If there is a selected shipping option, and requestShipping is set, then that option becomes synchronously selected 20 PASS If requestShipping is set, and if there is a multiple selected shipping options, only the last is selected. 21 FAIL If requestShipping is set, and if there is a multiple selected shipping options, only the last is selected. assert_equals: selected option must 'the-id expected "the-id" but got "FAIL1" 21 22 PASS If there are any duplicate shipping option ids, and shipping is requested, then throw a TypeError 22 23 PASS Throw when there are duplicate shippingOption ids, even if other values are different -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-shippingOption-attribute.https-expected.txt
r267647 r271735 1 CONSOLE MESSAGE: WebKit currently uses the first shipping option even if other shipping options are marked as selected. 1 2 2 3 PASS Must have a .shippingOption IDL attribute. 3 4 PASS .shippingOption attribute must default to null. 4 PASS If there is a single shipping option, but selected is false, then .shippingOption must be null. 5 PASS If there are multiple shipping options all with `selected` set to false, then .shippingOption is null. 5 FAIL If there is a single shipping option, but selected is false, then .shippingOption must be null. assert_equals: expected null expected (object) null but got (string) "valid" 6 FAIL If there are multiple shipping options all with `selected` set to false, then .shippingOption is null. assert_equals: expected null expected (object) null but got (string) "valid" 6 7 PASS Given multiple shipping options, it must use the selected shipping option for .shippingOption value. 7 PASS If there are multiple of the shipping options with selected true, then .shippingOption is the last selected shipping option in order. 8 FAIL If there are multiple of the shipping options with selected true, then .shippingOption is the last selected shipping option in order. assert_equals: expected 'pass' expected "pass" but got "fail" 8 9 -
trunk/Source/JavaScriptCore/ChangeLog
r271731 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 * inspector/protocol/Console.json: 9 * runtime/ConsoleTypes.h: 10 * inspector/ConsoleMessage.cpp: 11 (Inspector::messageSourceValue): 12 * runtime/ConsoleClient.cpp: 13 (JSC::appendMessagePrefix): 14 Add a new `PaymentRequest` value to the `ChannelSource` enum. 15 1 16 2021-01-21 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/Source/JavaScriptCore/inspector/ConsoleMessage.cpp
r269712 r271735 193 193 case MessageSource::ITPDebug: return Protocol::Console::ChannelSource::ITPDebug; 194 194 case MessageSource::PrivateClickMeasurement: return Protocol::Console::ChannelSource::PrivateClickMeasurement; 195 case MessageSource::PaymentRequest: return Protocol::Console::ChannelSource::PaymentRequest; 195 196 case MessageSource::Other: return Protocol::Console::ChannelSource::Other; 196 197 } -
trunk/Source/JavaScriptCore/inspector/protocol/Console.json
r269712 r271735 24 24 "itp-debug", 25 25 "private-click-measurement", 26 "payment-request", 26 27 "other" 27 28 ], -
trunk/Source/JavaScriptCore/runtime/ConsoleClient.cpp
r269712 r271735 109 109 sourceString = "PRIVATECLICKMEASUREMENT"_s; 110 110 break; 111 case MessageSource::PaymentRequest: 112 sourceString = "PAYMENTREQUEST"_s; 113 break; 111 114 case MessageSource::Other: 112 115 sourceString = "OTHER"_s; -
trunk/Source/JavaScriptCore/runtime/ConsoleTypes.h
r269712 r271735 46 46 ITPDebug, 47 47 PrivateClickMeasurement, 48 PaymentRequest, 48 49 Other, 49 50 }; … … 96 97 JSC::MessageSource::ITPDebug, 97 98 JSC::MessageSource::PrivateClickMeasurement, 99 JSC::MessageSource::PaymentRequest, 98 100 JSC::MessageSource::Other 99 101 >; -
trunk/Source/WebCore/ChangeLog
r271734 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 The Payment Request API defines a `selected` property of `PaymentShippingOption` that is 9 used to control the initially selected shipping option when showing/updating a payment 10 request. Currently, `PKShippingMethod` does not have an equivalent concept and instead just 11 uses the first item in the `-[PKPaymentRequest setShippingMethods:]` such that there is 12 always a selected `PKShippingMethod`. This patch adjusts WebKit to follow those same 13 conventions, in that the first item in `paymentDetailsBase.shippingOptions` is used as the 14 `selectedShippingOption` so as to avoid situations where PassKit displays the first shipping 15 option while `PaymentRequest.prototype.get shippingOption` has a different value, which 16 could result in the user authorizing a payment with different shipping details than what 17 they were shown. Ideally in the future PassKit will add API/SPI to allow us to undo this. 18 19 Tests: http/tests/paymentrequest/payment-request-change-shipping-option.https.html 20 http/tests/paymentrequest/updateWith-shippingOptions.https.html 21 web-platform-tests/payment-request/payment-request-constructor.https.sub.html 22 web-platform-tests/payment-request/payment-request-shippingOption-attribute.https.html 23 24 * Modules/paymentrequest/PaymentRequest.cpp: 25 (WebCore::checkAndCanonicalizeDetails): 26 (WebCore::PaymentRequest::create): 27 (WebCore::PaymentRequest::settleDetailsPromise): 28 Pass the `ScriptExecutionContext` instead of the `JSGlobalObject` so that it's possible to 29 call `ScriptExecutionContext::addConsoleMessage`. When creating a `PaymentRequest`, log if 30 subsequent `PaymentShippingOption` are marked as `selected`. 31 32 * inspector/agents/page/PageConsoleAgent.cpp: 33 (WebCore::PageConsoleAgent::getLoggingChannels): 34 Add a new `PaymentRequest` value to the `ChannelSource` enum. 35 1 36 2021-01-21 Devin Rousso <drousso@apple.com> 2 37 -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
r271734 r271735 246 246 }; 247 247 248 static ExceptionOr<std::tuple<String, Vector<String>>> checkAndCanonicalizeDetails( JSC::JSGlobalObject& execState, PaymentDetailsBase& details, bool requestShipping, IsUpdate isUpdate)248 static ExceptionOr<std::tuple<String, Vector<String>>> checkAndCanonicalizeDetails(ScriptExecutionContext& context, PaymentDetailsBase& details, bool requestShipping, IsUpdate isUpdate) 249 249 { 250 250 if (details.displayItems) { … … 260 260 if (details.shippingOptions) { 261 261 HashSet<String> seenShippingOptionIDs; 262 bool didLog = false; 262 263 for (auto& shippingOption : *details.shippingOptions) { 263 264 auto exception = checkAndCanonicalizeAmount(shippingOption.amount); … … 269 270 return Exception { TypeError, "Shipping option IDs must be unique." }; 270 271 271 if (shippingOption.selected) 272 // FIXME: <rdar://problem/73464404> 273 if (!selectedShippingOption) 272 274 selectedShippingOption = shippingOption.id; 275 else if (!didLog && shippingOption.selected) { 276 context.addConsoleMessage(JSC::MessageSource::PaymentRequest, JSC::MessageLevel::Warning, "WebKit currently uses the first shipping option even if other shipping options are marked as selected."_s); 277 didLog = true; 278 } 273 279 } 274 280 } else if (isUpdate == IsUpdate::No) … … 300 306 String serializedData; 301 307 if (modifier.data) { 302 auto scope = DECLARE_THROW_SCOPE(execState.vm()); 303 serializedData = JSONStringify(&execState, modifier.data.get(), 0); 308 auto* globalObject = context.globalObject(); 309 auto scope = DECLARE_THROW_SCOPE(globalObject->vm()); 310 serializedData = JSONStringify(globalObject, modifier.data.get(), 0); 304 311 if (scope.exception()) 305 312 return Exception { ExistingExceptionError }; … … 378 385 return totalResult.releaseException(); 379 386 380 auto detailsResult = checkAndCanonicalizeDetails( *document.globalObject(), details, options.requestShipping, IsUpdate::No);387 auto detailsResult = checkAndCanonicalizeDetails(document, details, options.requestShipping, IsUpdate::No); 381 388 if (detailsResult.hasException()) 382 389 return detailsResult.releaseException(); … … 682 689 } 683 690 684 auto detailsResult = checkAndCanonicalizeDetails( *context.globalObject(), detailsUpdate, m_options.requestShipping, IsUpdate::Yes);691 auto detailsResult = checkAndCanonicalizeDetails(context, detailsUpdate, m_options.requestShipping, IsUpdate::Yes); 685 692 if (detailsResult.hasException()) { 686 693 abortWithException(detailsResult.releaseException()); -
trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp
r269712 r271735 109 109 addLogChannel(Protocol::Console::ChannelSource::ITPDebug); 110 110 addLogChannel(Protocol::Console::ChannelSource::PrivateClickMeasurement); 111 addLogChannel(Protocol::Console::ChannelSource::PaymentRequest); 111 112 addLogChannel(Protocol::Console::ChannelSource::Other); 112 113 -
trunk/Source/WebInspectorUI/ChangeLog
r271726 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 * UserInterface/Models/ConsoleMessage.js: 9 * UserInterface/Models/IssueMessage.js: 10 (WI.IssueMessage): 11 Add a new `PaymentRequest` value to the `ChannelSource` enum. 12 1 13 2021-01-21 Ebrahim Byagowi <ebrahim@gnu.org> 2 14 -
trunk/Source/WebInspectorUI/UserInterface/Models/ConsoleMessage.js
r269712 r271735 115 115 ITPDebug: "itp-debug", 116 116 PrivateClickMeasurement: "private-click-measurement", 117 PaymentRequest: "payment-request", 117 118 Other: "other", 118 119 -
trunk/Source/WebInspectorUI/UserInterface/Models/IssueMessage.js
r269712 r271735 71 71 case WI.ConsoleMessage.MessageSource.ITPDebug: 72 72 case WI.ConsoleMessage.MessageSource.PrivateClickMeasurement: 73 case WI.ConsoleMessage.MessageSource.PaymentRequest: 73 74 case WI.ConsoleMessage.MessageSource.AdClickAttribution: // COMPATIBILITY (iOS 14.0): `Console.ChannelSource.AdClickAttribution` was renamed to `Console.ChannelSource.PrivateClickMeasurement`. 74 75 case WI.ConsoleMessage.MessageSource.Other: -
trunk/Source/WebKitLegacy/mac/ChangeLog
r271685 r271735 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Apple Pay] use the first item in `shippingOptions` even when it's not `selected` 4 https://bugs.webkit.org/show_bug.cgi?id=220810 5 6 Reviewed by Andy Estes. 7 8 * WebCoreSupport/WebChromeClient.mm: 9 (stringForMessageSource): 10 Add a new `PaymentRequest` value to the `ChannelSource` enum. 11 1 12 2021-01-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 13 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm
r270577 r271735 127 127 NSString *WebConsoleMessageITPDebugMessageSource = @"ITPDebugMessageSource"; 128 128 NSString *WebConsoleMessagePrivateClickMeasurementMessageSource = @"PrivateClickMeasurementMessageSource"; 129 NSString *WebConsoleMessagePaymentRequestMessageSource = @"PaymentRequestMessageSource"; 129 130 NSString *WebConsoleMessageOtherMessageSource = @"OtherMessageSource"; 130 131 … … 407 408 case MessageSource::PrivateClickMeasurement: 408 409 return WebConsoleMessagePrivateClickMeasurementMessageSource; 410 case MessageSource::PaymentRequest: 411 return WebConsoleMessagePaymentRequestMessageSource; 409 412 case MessageSource::Other: 410 413 return WebConsoleMessageOtherMessageSource;
Note: See TracChangeset
for help on using the changeset viewer.