Title: [280284] trunk
Revision
280284
Author
[email protected]
Date
2021-07-24 01:23:15 -0700 (Sat, 24 Jul 2021)

Log Message

[Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
https://bugs.webkit.org/show_bug.cgi?id=228243

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: http/tests/ssl/applepay/ApplePayError.html

* Modules/applepay/ApplePayErrorCode.idl:
* Modules/applepay/ApplePayErrorCode.h:

Source/WebKit:

* Platform/cocoa/PaymentAuthorizationPresenter.mm:
(WebKit::toPKPaymentErrorCode):

LayoutTests:

* http/tests/ssl/applepay/ApplePayError.html:
* http/tests/ssl/applepay/ApplePayError-expected.txt:
* platform/ios-14-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt: Added.
* platform/mac-bigsur-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (280283 => 280284)


--- trunk/LayoutTests/ChangeLog	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/LayoutTests/ChangeLog	2021-07-24 08:23:15 UTC (rev 280284)
@@ -1,3 +1,15 @@
+2021-07-24  Devin Rousso  <[email protected]>
+
+        [Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
+        https://bugs.webkit.org/show_bug.cgi?id=228243
+
+        Reviewed by Wenson Hsieh.
+
+        * http/tests/ssl/applepay/ApplePayError.html:
+        * http/tests/ssl/applepay/ApplePayError-expected.txt:
+        * platform/ios-14-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt: Added.
+        * platform/mac-bigsur-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt: Added.
+
 2021-07-23  Andres Gonzalez  <[email protected]>
 
         Add a method to WebAccessibilityObjectWrapper so that clients can retrieve the text of each line and their corresponding bounding rectangles.

Modified: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt (280283 => 280284)


--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt	2021-07-24 08:23:15 UTC (rev 280284)
@@ -27,6 +27,12 @@
 PASS new ApplePayError('addressUnserviceable') did not throw exception.
 
 SETUP:
+PASS new ApplePayError('couponCodeInvalid') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('couponCodeExpired') did not throw exception.
+
+SETUP:
 PASS new ApplePayError('unknown', []) threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode".
 
 SETUP:

Modified: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError.html (280283 => 280284)


--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError.html	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError.html	2021-07-24 08:23:15 UTC (rev 280284)
@@ -36,6 +36,8 @@
         logAndShouldNotThrow("", "new ApplePayError('shippingContactInvalid')")
         logAndShouldNotThrow("", "new ApplePayError('billingContactInvalid')")
         logAndShouldNotThrow("", "new ApplePayError('addressUnserviceable')")
+        logAndShouldNotThrow("", "new ApplePayError('couponCodeInvalid')")
+        logAndShouldNotThrow("", "new ApplePayError('couponCodeExpired')")
         logAndShouldThrow("", "new ApplePayError('unknown', [])")
         logAndShouldThrow("", "new ApplePayError('unknown', '')")
         logAndShouldNotThrow("", "new ApplePayError('unknown', 'phoneNumber')")

Copied: trunk/LayoutTests/platform/ios-14-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt (from rev 280283, trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt) (0 => 280284)


--- trunk/LayoutTests/platform/ios-14-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-14-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt	2021-07-24 08:23:15 UTC (rev 280284)
@@ -0,0 +1,77 @@
+Test basic creation of an ApplePayError object.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ApplePayError
+
+SETUP:
+PASS new ApplePayError() threw exception TypeError: Not enough arguments.
+
+SETUP:
+PASS new ApplePayError([]) threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('') threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('unknown') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('shippingContactInvalid') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('billingContactInvalid') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('addressUnserviceable') did not throw exception.
+
+SETUP:
+FAIL new ApplePayError('couponCodeInvalid') should not throw exception. Threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+FAIL new ApplePayError('couponCodeExpired') should not throw exception. Threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('unknown', []) threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode".
+
+SETUP:
+PASS new ApplePayError('unknown', '') threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode".
+
+SETUP:
+PASS new ApplePayError('unknown', 'phoneNumber') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'emailAddress') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'name') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'phoneticName') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'postalAddress') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'addressLines') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'locality') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'postalCode') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'administrativeArea') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'country') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'countryCode') did not throw exception.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/platform/mac-bigsur-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt (from rev 280283, trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt) (0 => 280284)


--- trunk/LayoutTests/platform/mac-bigsur-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-bigsur-wk2/http/tests/ssl/applepay/ApplePayError-expected.txt	2021-07-24 08:23:15 UTC (rev 280284)
@@ -0,0 +1,77 @@
+Test basic creation of an ApplePayError object.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing ApplePayError
+
+SETUP:
+PASS new ApplePayError() threw exception TypeError: Not enough arguments.
+
+SETUP:
+PASS new ApplePayError([]) threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('') threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('unknown') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('shippingContactInvalid') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('billingContactInvalid') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('addressUnserviceable') did not throw exception.
+
+SETUP:
+FAIL new ApplePayError('couponCodeInvalid') should not throw exception. Threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+FAIL new ApplePayError('couponCodeExpired') should not throw exception. Threw exception TypeError: Argument 1 ('errorCode') to the ApplePayError constructor must be one of: "unknown", "shippingContactInvalid", "billingContactInvalid", "addressUnserviceable".
+
+SETUP:
+PASS new ApplePayError('unknown', []) threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode".
+
+SETUP:
+PASS new ApplePayError('unknown', '') threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode".
+
+SETUP:
+PASS new ApplePayError('unknown', 'phoneNumber') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'emailAddress') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'name') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'phoneticName') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'postalAddress') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'addressLines') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'locality') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'postalCode') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'administrativeArea') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'country') did not throw exception.
+
+SETUP:
+PASS new ApplePayError('unknown', 'countryCode') did not throw exception.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (280283 => 280284)


--- trunk/Source/WebCore/ChangeLog	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/Source/WebCore/ChangeLog	2021-07-24 08:23:15 UTC (rev 280284)
@@ -1,3 +1,15 @@
+2021-07-24  Devin Rousso  <[email protected]>
+
+        [Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
+        https://bugs.webkit.org/show_bug.cgi?id=228243
+
+        Reviewed by Wenson Hsieh.
+
+        Test: http/tests/ssl/applepay/ApplePayError.html
+
+        * Modules/applepay/ApplePayErrorCode.idl:
+        * Modules/applepay/ApplePayErrorCode.h:
+
 2021-07-23  Andres Gonzalez  <[email protected]>
 
         Add a method to WebAccessibilityObjectWrapper so that clients can retrieve the text of each line and their corresponding bounding rectangles.

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.h (280283 => 280284)


--- trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.h	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.h	2021-07-24 08:23:15 UTC (rev 280284)
@@ -36,8 +36,10 @@
     ShippingContactInvalid,
     BillingContactInvalid,
     AddressUnserviceable,
+#if ENABLE(APPLE_PAY_COUPON_CODE)
     CouponCodeInvalid,
     CouponCodeExpired,
+#endif
 };
 
 } // namespace WebCore
@@ -50,9 +52,11 @@
         WebCore::ApplePayErrorCode::Unknown,
         WebCore::ApplePayErrorCode::ShippingContactInvalid,
         WebCore::ApplePayErrorCode::BillingContactInvalid,
-        WebCore::ApplePayErrorCode::AddressUnserviceable,
-        WebCore::ApplePayErrorCode::CouponCodeInvalid,
-        WebCore::ApplePayErrorCode::CouponCodeExpired
+        WebCore::ApplePayErrorCode::AddressUnserviceable
+#if ENABLE(APPLE_PAY_COUPON_CODE)
+        , WebCore::ApplePayErrorCode::CouponCodeInvalid
+        , WebCore::ApplePayErrorCode::CouponCodeExpired
+#endif
     >;
 };
 

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.idl (280283 => 280284)


--- trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.idl	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayErrorCode.idl	2021-07-24 08:23:15 UTC (rev 280284)
@@ -30,7 +30,9 @@
     "unknown",
     "shippingContactInvalid",
     "billingContactInvalid",
-    "addressUnserviceable",
-    "couponCodeInvalid",
-    "couponCodeExpired"
+    "addressUnserviceable"
+#if defined(ENABLE_APPLE_PAY_COUPON_CODE) && ENABLE_APPLE_PAY_COUPON_CODE
+    , "couponCodeInvalid"
+    , "couponCodeExpired"
+#endif
 };

Modified: trunk/Source/WebKit/ChangeLog (280283 => 280284)


--- trunk/Source/WebKit/ChangeLog	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/Source/WebKit/ChangeLog	2021-07-24 08:23:15 UTC (rev 280284)
@@ -1,5 +1,15 @@
 2021-07-24  Devin Rousso  <[email protected]>
 
+        [Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
+        https://bugs.webkit.org/show_bug.cgi?id=228243
+
+        Reviewed by Wenson Hsieh.
+
+        * Platform/cocoa/PaymentAuthorizationPresenter.mm:
+        (WebKit::toPKPaymentErrorCode):
+
+2021-07-24  Devin Rousso  <[email protected]>
+
         [iOS] REGRESSION(r277505): `-[WKWebView underPageBackgroundColor]` also changes the scroll bar color
         https://bugs.webkit.org/show_bug.cgi?id=228259
         <rdar://problem/80116822>

Modified: trunk/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.mm (280283 => 280284)


--- trunk/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.mm	2021-07-24 08:20:05 UTC (rev 280283)
+++ trunk/Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.mm	2021-07-24 08:23:15 UTC (rev 280284)
@@ -97,18 +97,12 @@
     case WebCore::ApplePayErrorCode::AddressUnserviceable:
         return PKPaymentShippingAddressUnserviceableError;
 
+#if ENABLE(APPLE_PAY_COUPON_CODE)
     case WebCore::ApplePayErrorCode::CouponCodeInvalid:
-#if HAVE(PASSKIT_COUPON_CODE)
         return PKPaymentCouponCodeInvalidError;
-#else
-        break;
-#endif
 
     case WebCore::ApplePayErrorCode::CouponCodeExpired:
-#if HAVE(PASSKIT_COUPON_CODE)
         return PKPaymentCouponCodeExpiredError;
-#else
-        break;
 #endif
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to