[macOS Debug WK2] Layout Test http/tests/ssl/applepay/ApplePayShippingAddressChangeEv...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 14:15:15 +0000 (14:15 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Oct 2018 14:15:15 +0000 (14:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190650
<rdar://problem/45341914>

Reviewed by Alex Christensen.

Source/WebCore:

In computeErrors, we intend to ignore errors when computing paymentMethodErrors. But we
weren't clearing exceptions generated from calling convert(), so they would end up being
logged as unhandled promise rejections.

Changed ApplePayPaymentHandler::computeErrors() to use a CatchScope to clear exceptions when
decoding paymentMethodErrors.

Also changed ApplePayShippingAddressChangeEventErrorsV3.https.html to catch promise
rejections from calling PaymentRequest.abort().

Covered by existing test.

* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::computeErrors const):

LayoutTests:

* http/tests/resources/payment-request.js:
(updateDetailsOnShippingAddressChange):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/resources/payment-request.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp

index e62a9b0..30756d5 100644 (file)
@@ -1,3 +1,14 @@
+2018-10-24  Andy Estes  <aestes@apple.com>
+
+        [macOS Debug WK2] Layout Test http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=190650
+        <rdar://problem/45341914>
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/resources/payment-request.js:
+        (updateDetailsOnShippingAddressChange):
+
 2018-10-23  Jer Noble  <jer.noble@apple.com>
 
         TextTrack cues should be updated more often than every 250ms.
index 4ebac1f..4d8b2b4 100644 (file)
@@ -68,7 +68,7 @@ function updateDetailsOnShippingAddressChange(paymentDetailsInit, paymentOptions
                 event.updateWith(detailsUpdatePromise);
                 detailsUpdatePromise.then(() => {
                     resolve();
-                    request.abort();
+                    request.abort().catch(() => { });
                 });
             };
             request.show().catch(error => error);
index 3acb81c..4555fc0 100644 (file)
@@ -1,3 +1,26 @@
+2018-10-24  Andy Estes  <aestes@apple.com>
+
+        [macOS Debug WK2] Layout Test http/tests/ssl/applepay/ApplePayShippingAddressChangeEventErrorsV3.https.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=190650
+        <rdar://problem/45341914>
+
+        Reviewed by Alex Christensen.
+
+        In computeErrors, we intend to ignore errors when computing paymentMethodErrors. But we
+        weren't clearing exceptions generated from calling convert(), so they would end up being
+        logged as unhandled promise rejections.
+
+        Changed ApplePayPaymentHandler::computeErrors() to use a CatchScope to clear exceptions when
+        decoding paymentMethodErrors.
+
+        Also changed ApplePayShippingAddressChangeEventErrorsV3.https.html to catch promise
+        rejections from calling PaymentRequest.abort().
+
+        Covered by existing test.
+
+        * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+        (WebCore::ApplePayPaymentHandler::computeErrors const):
+
 2018-10-22  Antti Koivisto  <antti@apple.com>
 
         topPrivatelyControlledDomain is slow
index 56055f7..c9bd3c7 100644 (file)
@@ -363,14 +363,15 @@ Vector<PaymentError> ApplePayPaymentHandler::computeErrors(String&& error, Addre
 #if ENABLE(APPLE_PAY_SESSION_V3)
     if (paymentMethodErrors) {
         auto& context = *scriptExecutionContext();
-        auto throwScope = DECLARE_THROW_SCOPE(context.vm());
+        auto catchScope = DECLARE_CATCH_SCOPE(context.vm());
         auto applePayErrors = convert<IDLSequence<IDLInterface<ApplePayError>>>(*context.execState(), paymentMethodErrors);
-        if (!throwScope.exception()) {
+        if (!catchScope.exception()) {
             for (auto& applePayError : applePayErrors) {
                 if (applePayError)
                     errors.append({ applePayError->code(), applePayError->message(), applePayError->contactField() });
             }
-        }
+        } else
+            catchScope.clearException();
     }
 #else
     UNUSED_PARAM(paymentMethodErrors);