[Cocoa] errors are not propagated to PassKit when calling ApplePaySession.completePay...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 May 2017 00:58:54 +0000 (00:58 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 May 2017 00:58:54 +0000 (00:58 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172253
<rdar://problem/32258020>

Reviewed by Dan Bernstein.

In ApplePaySession::completePayment(), releaseReturnValue() was being called twice on the
same convertedResult. Since the first call moved the errors vector out of convertedResult,
the vector is empty in the second call. It's the second call that sends the result to the
UI process, so we end up with an empty arary when we call PassKit's delegate completion
handler.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::completePayment):

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/applepay/ApplePaySession.cpp

index 89d2ec2..a01c059 100644 (file)
@@ -1,3 +1,20 @@
+2017-05-17  Andy Estes  <aestes@apple.com>
+
+        [Cocoa] errors are not propagated to PassKit when calling ApplePaySession.completePayment()
+        https://bugs.webkit.org/show_bug.cgi?id=172253
+        <rdar://problem/32258020>
+
+        Reviewed by Dan Bernstein.
+
+        In ApplePaySession::completePayment(), releaseReturnValue() was being called twice on the
+        same convertedResult. Since the first call moved the errors vector out of convertedResult,
+        the vector is empty in the second call. It's the second call that sends the result to the
+        UI process, so we end up with an empty arary when we call PassKit's delegate completion
+        handler.
+
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::ApplePaySession::completePayment):
+
 2017-05-17  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r217014.
index 61a9e5c..034ef8b 100644 (file)
@@ -783,13 +783,14 @@ ExceptionOr<void> ApplePaySession::completePayment(ApplePayPaymentAuthorizationR
     if (!canCompletePayment())
         return Exception { INVALID_ACCESS_ERR };
 
-    auto convertedResult = convertAndValidate(WTFMove(result));
-    if (convertedResult.hasException())
-        return convertedResult.releaseException();
+    auto convertedResultOrException = convertAndValidate(WTFMove(result));
+    if (convertedResultOrException.hasException())
+        return convertedResultOrException.releaseException();
 
-    bool isFinalState = isFinalStateResult(convertedResult.releaseReturnValue());
+    auto&& convertedResult = convertedResultOrException.releaseReturnValue();
+    bool isFinalState = isFinalStateResult(convertedResult);
 
-    paymentCoordinator().completePaymentSession(convertedResult.releaseReturnValue());
+    paymentCoordinator().completePaymentSession(WTFMove(convertedResult));
 
     if (!isFinalState) {
         m_state = State::Active;