WebKit Bugzilla
Attachment 347976 Details for
Bug 185150
: [Apple Pay] Allow $0 totals
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185150-20180823170743.patch (text/plain), 12.78 KB, created by
Andy Estes
on 2018-08-23 17:07:44 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2018-08-23 17:07:44 PDT
Size:
12.78 KB
patch
obsolete
>Subversion Revision: 235251 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2bc2e2f14c473434783047f088d6769b7c7ad5be..6ac4bb8618ae88e899c8e56a672746f7dd26ec97 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-08-23 Andy Estes <aestes@apple.com> >+ >+ [Apple Pay] Allow $0 totals >+ https://bugs.webkit.org/show_bug.cgi?id=185150 >+ <rdar://problem/39212331> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Relax payment request validation to allow $0 totals. This matches PassKit behavior. >+ >+ Added test cases to http/tests/ssl/applepay/ApplePaySessionV4.html. >+ >+ * Modules/applepay/PaymentRequestValidator.mm: >+ (WebCore::PaymentRequestValidator::validateTotal): >+ > 2018-08-23 Andy Estes <aestes@apple.com> > > [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave >diff --git a/Source/WebCore/Modules/applepay/PaymentRequestValidator.mm b/Source/WebCore/Modules/applepay/PaymentRequestValidator.mm >index 92f9076685a7634af05cad30bf4ee5faa26d1489..0cdcca1cd5bfdbf782f5c674f5fa023554734d8b 100644 >--- a/Source/WebCore/Modules/applepay/PaymentRequestValidator.mm >+++ b/Source/WebCore/Modules/applepay/PaymentRequestValidator.mm >@@ -86,8 +86,8 @@ ExceptionOr<void> PaymentRequestValidator::validateTotal(const ApplePaySessionPa > > double amount = [NSDecimalNumber decimalNumberWithString:total.amount locale:@{ NSLocaleDecimalSeparator : @"." }].doubleValue; > >- if (amount <= 0) >- return Exception { TypeError, "Total amount must be greater than zero." }; >+ if (amount < 0) >+ return Exception { TypeError, "Total amount must not be negative." }; > > if (amount > 100000000) > return Exception { TypeError, "Total amount is too big." }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 34775758fdf95e90e34d01ae2cee03dffa5fc56d..8dcd4009fa79f011b9d10a9990ac822508892a6e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2018-08-23 Andy Estes <aestes@apple.com> >+ >+ [Apple Pay] Allow $0 totals >+ https://bugs.webkit.org/show_bug.cgi?id=185150 >+ <rdar://problem/39212331> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/ssl/applepay/ApplePaySession-expected.txt: >+ * http/tests/ssl/applepay/ApplePaySession.html: >+ * http/tests/ssl/applepay/ApplePaySessionV3-expected.txt: >+ * http/tests/ssl/applepay/ApplePaySessionV3.html: >+ * http/tests/ssl/applepay/ApplePaySessionV4-expected.txt: >+ * http/tests/ssl/applepay/ApplePaySessionV4.html: >+ * http/tests/ssl/applepay/PaymentRequest.https-expected.txt: >+ * http/tests/ssl/applepay/PaymentRequest.https.html: >+ > 2018-08-23 Andy Estes <aestes@apple.com> > > [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt b/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt >index 1966e2632831601e24feb2219dc5fbc62f4571f9..208f3bff1ee399ca8d64c40f810995f5eda838a8 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt >@@ -8,6 +8,7 @@ Testing supportsVersion > PASS ApplePaySession.supportsVersion(0) threw exception InvalidAccessError: The object does not support the operation or argument.. > PASS ApplePaySession.supportsVersion(1) is true > PASS ApplePaySession.supportsVersion(2) is true >+ > Testing PaymentRequest > > PASS new ApplePaySession(2, { }) threw exception TypeError: Member ApplePayPaymentRequest.countryCode is required and must be an instance of DOMString. >@@ -148,11 +149,8 @@ PASS new ApplePaySession(2, request) threw exception TypeError: "" is not a vali > SETUP: request = validRequest(); request.total = { label: 'label', amount: 'amount' }; > PASS new ApplePaySession(2, request) threw exception TypeError: "amount" is not a valid amount.. > >-SETUP: request = validRequest(); request.total = { label: 'label', amount: '0' }; >-PASS new ApplePaySession(2, request) threw exception TypeError: Total amount must be greater than zero.. >- > SETUP: request = validRequest(); request.total = { label: 'label', amount: '-10.00' }; >-PASS new ApplePaySession(2, request) threw exception TypeError: Total amount must be greater than zero.. >+PASS new ApplePaySession(2, request) threw exception TypeError: Total amount must not be negative.. > > SETUP: request = validRequest(); request.total = { label: 'label', amount: '10000000000.00' }; > PASS new ApplePaySession(2, request) threw exception TypeError: Total amount is too big.. >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html b/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html >index 355b6f4ee385e0aab0043d93c66b525178e28e98..68fadb2dd2ea869e205c4374dc3c24d2c10d6600 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html >@@ -41,6 +41,7 @@ function go() { > shouldThrow("ApplePaySession.supportsVersion(0)"); > shouldBeTrue("ApplePaySession.supportsVersion(1)"); > shouldBeTrue("ApplePaySession.supportsVersion(2)"); >+ debug(""); > > debug("Testing PaymentRequest") > debug(""); >@@ -107,7 +108,6 @@ function go() { > logAndShouldThrow("request = validRequest(); request.total = { };", "new ApplePaySession(2, request)") > logAndShouldThrow("request = validRequest(); request.total = { label: 'label' };", "new ApplePaySession(2, request)") > logAndShouldThrow("request = validRequest(); request.total = { label: 'label', amount: 'amount' };", "new ApplePaySession(2, request)") >- logAndShouldThrow("request = validRequest(); request.total = { label: 'label', amount: '0' };", "new ApplePaySession(2, request)") > logAndShouldThrow("request = validRequest(); request.total = { label: 'label', amount: '-10.00' };", "new ApplePaySession(2, request)") > logAndShouldThrow("request = validRequest(); request.total = { label: 'label', amount: '10000000000.00' };", "new ApplePaySession(2, request)") > logAndShouldThrow("request = validRequest(); request.total = { label: 'label', amount: '10.00', type: 'invalid' };", "new ApplePaySession(2, request)") >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3-expected.txt b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3-expected.txt >index c436b8837ef10e1f47fd01ca11898642f82877fd..4d94313840b57f28727ce170e4a2f384750e07c8 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3-expected.txt >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3-expected.txt >@@ -9,6 +9,7 @@ PASS ApplePaySession.supportsVersion(0) threw exception InvalidAccessError: The > PASS ApplePaySession.supportsVersion(1) is true > PASS ApplePaySession.supportsVersion(2) is true > PASS ApplePaySession.supportsVersion(3) is true >+ > Testing PaymentRequest (v3) > > PASS new ApplePaySession(3, { }) threw exception TypeError: Member ApplePayPaymentRequest.countryCode is required and must be an instance of DOMString. >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3.html b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3.html >index 0dd68e8c580f403da33cc1e5ca0dcf7678de0fb2..26c9855ec6a21b5ecb86b3af885753d3f1c10735 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3.html >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV3.html >@@ -42,6 +42,7 @@ function go() { > shouldBeTrue("ApplePaySession.supportsVersion(1)"); > shouldBeTrue("ApplePaySession.supportsVersion(2)"); > shouldBeTrue("ApplePaySession.supportsVersion(3)"); >+ debug(""); > > debug("Testing PaymentRequest (v3)") > debug(""); >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4-expected.txt b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4-expected.txt >index b22452e44b39e5c52938054849fe531823850149..0aa4642de227791e43b27c3164c644810dd881cc 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4-expected.txt >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4-expected.txt >@@ -10,11 +10,18 @@ PASS ApplePaySession.supportsVersion(1) is true > PASS ApplePaySession.supportsVersion(2) is true > PASS ApplePaySession.supportsVersion(3) is true > PASS ApplePaySession.supportsVersion(4) is true >+ > Testing PaymentRequest (v4) > > PASS new ApplePaySession(4, { }) threw exception TypeError: Member ApplePayPaymentRequest.countryCode is required and must be an instance of DOMString. > PASS new ApplePaySession(4, validRequest()) did not throw exception. > >+Testing PaymentRequest.total >+ >+SETUP: request = validRequest(); request.total = { label: 'label', amount: '0' }; >+PASS new ApplePaySession(4, request) did not throw exception. >+ >+ > PASS successfullyParsed is true > > TEST COMPLETE >diff --git a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4.html b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4.html >index 358fc4f4cc5906ebc0025f5d50fa89de7facd5e8..15775c98969877494d675db043b645e57a3686db 100644 >--- a/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4.html >+++ b/LayoutTests/http/tests/ssl/applepay/ApplePaySessionV4.html >@@ -43,6 +43,7 @@ function go() { > shouldBeTrue("ApplePaySession.supportsVersion(2)"); > shouldBeTrue("ApplePaySession.supportsVersion(3)"); > shouldBeTrue("ApplePaySession.supportsVersion(4)"); >+ debug(""); > > debug("Testing PaymentRequest (v4)") > debug(""); >@@ -50,6 +51,11 @@ function go() { > shouldNotThrow("new ApplePaySession(4, validRequest())"); > debug(""); > >+ debug("Testing PaymentRequest.total") >+ debug(""); >+ logAndShouldNotThrow("request = validRequest(); request.total = { label: 'label', amount: '0' };", "new ApplePaySession(4, request)") >+ debug(""); >+ > document.querySelector("button").remove(); > > finishJSTest(); >diff --git a/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt b/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt >index 417c458b47611514807671d0f0f274b655fee08e..91feb2b4e4c9d92be39c19806444620c3fafad6f 100644 >--- a/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt >+++ b/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt >@@ -154,8 +154,6 @@ PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); reque > SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: '', value: '0' } }; > PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception RangeError: "" is not a valid currency code.. > >-SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value: '0' } }; >-PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() rejected promise with TypeError: Total amount must be greater than zero.. > > SETUP: paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value:'-10.00'} }; > PASS request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show() threw exception TypeError: Total currency values cannot be negative.. >diff --git a/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html b/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html >index e91d17209e511f62c570a1e6da80f1f3e1e16aa8..cd2ab984e1765db7a0935a12b080c96db105bf5b 100644 >--- a/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html >+++ b/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html >@@ -154,7 +154,6 @@ async function go() { > await logAndShouldThrow("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label' };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()") > await logAndShouldThrow("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: 'amount' };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()") > await logAndShouldThrow("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: '', value: '0' } };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()") >- await logAndShouldReject("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value: '0' } };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()") > debug("") > await logAndShouldThrow("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value:'-10.00'} };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()") > await logAndShouldReject("paymentDetails = validPaymentDetails(); paymentDetails.total = { label: 'label', amount: { currency: 'USD', value: '10000000000.00' } };", "request = new PaymentRequest([validPaymentMethod()], paymentDetails); request.show()")
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185150
:
339160
|
339178
|
347976
|
348008
|
348009