Changeset 271734 in webkit
- Timestamp:
- Jan 21, 2021 7:39:46 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r271712 r271734 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Payment Request] constructor should throw if a payment method is provided more than once 4 https://bugs.webkit.org/show_bug.cgi?id=220824 5 6 Reviewed by Andy Estes. 7 8 * web-platform-tests/payment-request/payment-request-constructor-thcrash.https-expected.txt: 9 * web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt: 10 1 11 2021-01-21 Sam Weinig <weinig@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor-thcrash.https-expected.txt
r267647 r271734 1 1 2 PASS Don't crash if there is an abusive number of payment methods in the methodData sequence 2 FAIL Don't crash if there is an abusive number of payment methods in the methodData sequence assert_equals: must be a TypeError expected "TypeError" but got "RangeError" 3 3 PASS Don't crash if PaymentMethodData.supportedMethods is an abusive length 4 4 PASS Don't crash if the request id has an abusive length -
trunk/LayoutTests/imported/w3c/web-platform-tests/payment-request/payment-request-constructor.https.sub-expected.txt
r267647 r271734 6 6 PASS Use provided request ID 7 7 PASS If the length of the methodData sequence is zero, then throw a TypeError 8 FAIL If payment method is duplicate, then throw a RangeError assert_throws_js: function "() => new PaymentRequest(duplicateMethods, defaultDetails)" did not throw 8 PASS If payment method is duplicate, then throw a RangeError 9 9 PASS Modifier method data must be JSON-serializable object 10 10 PASS Rethrow any exceptions of JSON-serializing paymentMethod.data into a string -
trunk/Source/WebCore/ChangeLog
r271733 r271734 1 2021-01-21 Devin Rousso <drousso@apple.com> 2 3 [Payment Request] constructor should throw if a payment method is provided more than once 4 https://bugs.webkit.org/show_bug.cgi?id=220824 5 6 Reviewed by Andy Estes. 7 8 Test: web-platform-tests/payment-request/payment-request-constructor.https.sub.html 9 10 * Modules/paymentrequest/PaymentRequest.cpp: 11 (WebCore::stringify): Added. 12 (WebCore::PaymentRequest::create): 13 1 14 2021-01-21 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp
r271703 r271734 323 323 } 324 324 325 static String stringify(const PaymentRequest::MethodIdentifier& identifier) 326 { 327 return WTF::switchOn(identifier, 328 [] (const String& string) { return string; }, 329 [] (const URL& url) { return url.string(); } 330 ); 331 } 332 325 333 // Implements the PaymentRequest Constructor 326 334 // https://www.w3.org/TR/payment-request/#constructor … … 339 347 Vector<Method> serializedMethodData; 340 348 serializedMethodData.reserveInitialCapacity(methodData.size()); 349 HashSet<String> seenMethodIDs; 341 350 for (auto& paymentMethod : methodData) { 342 351 auto identifier = convertAndValidatePaymentMethodIdentifier(paymentMethod.supportedMethods); 343 352 if (!identifier) 344 353 return Exception { RangeError, makeString('"', paymentMethod.supportedMethods, "\" is an invalid payment method identifier.") }; 354 355 if (!seenMethodIDs.add(stringify(*identifier))) 356 return Exception { RangeError, "Payment method IDs must be unique."_s }; 345 357 346 358 String serializedData;
Note: See TracChangeset
for help on using the changeset viewer.