Title: [214499] trunk/Source/WebCore
Revision
214499
Author
[email protected]
Date
2017-03-28 15:26:25 -0700 (Tue, 28 Mar 2017)

Log Message

ApplePayShippingContactUpdate.idl shouldn't have status field
https://bugs.webkit.org/show_bug.cgi?id=170202
rdar://problem/31307106

Reviewed by Beth Dakin.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
If status isn't set, infer it based on whether there are errors present or not.

* Modules/applepay/ApplePayShippingContactUpdate.h:
Make status optional here; it's still used by the old code path.

* Modules/applepay/ApplePayShippingContactUpdate.idl:
Remove status here.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (214498 => 214499)


--- trunk/Source/WebCore/ChangeLog	2017-03-28 22:16:01 UTC (rev 214498)
+++ trunk/Source/WebCore/ChangeLog	2017-03-28 22:26:25 UTC (rev 214499)
@@ -1,3 +1,21 @@
+2017-03-28  Anders Carlsson  <[email protected]>
+
+        ApplePayShippingContactUpdate.idl shouldn't have status field
+        https://bugs.webkit.org/show_bug.cgi?id=170202
+        rdar://problem/31307106
+
+        Reviewed by Beth Dakin.
+
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::convertAndValidate):
+        If status isn't set, infer it based on whether there are errors present or not.
+
+        * Modules/applepay/ApplePayShippingContactUpdate.h:
+        Make status optional here; it's still used by the old code path.
+
+        * Modules/applepay/ApplePayShippingContactUpdate.idl:
+        Remove status here.
+
 2017-03-28  Brian Burg  <[email protected]>
 
         Web Inspector: Add "Disable Caches" option that only applies to the inspected page while Web Inspector is open

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (214498 => 214499)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-03-28 22:16:01 UTC (rev 214498)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2017-03-28 22:26:25 UTC (rev 214499)
@@ -472,12 +472,22 @@
 {
     ShippingContactUpdate convertedUpdate;
 
-    auto authorizationStatus = toPaymentAuthorizationStatus(update.status);
-    if (!authorizationStatus)
-        return Exception { INVALID_ACCESS_ERR };
-    convertedUpdate.status = *authorizationStatus;
-    convertedUpdate.errors = convert(update.errors);
+    if (!update.status) {
+        convertedUpdate.errors = convert(update.errors);
+        if (convertedUpdate.errors.isEmpty())
+            convertedUpdate.status = PaymentAuthorizationStatus::Success;
+        else
+            convertedUpdate.status = PaymentAuthorizationStatus::Failure;
+    } else {
+        ASSERT(update.errors.isEmpty());
 
+        auto authorizationStatus = toPaymentAuthorizationStatus(*update.status);
+        if (!authorizationStatus)
+            return Exception { INVALID_ACCESS_ERR };
+
+        convertedUpdate.status = *authorizationStatus;
+    }
+
     auto convertedNewShippingMethods = convertAndValidate(WTFMove(update.newShippingMethods));
     if (convertedNewShippingMethods.hasException())
         return convertedNewShippingMethods.releaseException();

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.h (214498 => 214499)


--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.h	2017-03-28 22:16:01 UTC (rev 214498)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.h	2017-03-28 22:26:25 UTC (rev 214499)
@@ -34,7 +34,7 @@
 namespace WebCore {
 
 struct ApplePayShippingContactUpdate {
-    unsigned short status;
+    std::optional<unsigned short> status;
     Vector<RefPtr<ApplePayError>> errors;
 
     Vector<ApplePayShippingMethod> newShippingMethods;

Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.idl (214498 => 214499)


--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.idl	2017-03-28 22:16:01 UTC (rev 214498)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingContactUpdate.idl	2017-03-28 22:26:25 UTC (rev 214499)
@@ -26,7 +26,6 @@
 [
     Conditional=APPLE_PAY_DELEGATE,
 ] dictionary ApplePayShippingContactUpdate {
-    required unsigned short status;
     sequence<ApplePayError> errors;
 
     sequence<ApplePayShippingMethod> newShippingMethods;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to