Title: [203414] trunk/Source
- Revision
- 203414
- Author
- [email protected]
- Date
- 2016-07-19 13:07:38 -0700 (Tue, 19 Jul 2016)
Log Message
Some payment authorization status values should keep the sheet active
https://bugs.webkit.org/show_bug.cgi?id=159936
rdar://problem/26756701
Reviewed by Tim Horton.
Source/WebCore:
* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::completePayment):
Keep the sheet active if the status isn't a final state status.
* Modules/applepay/PaymentAuthorizationStatus.h:
(WebCore::isFinalStateStatus):
Add a new helper function that returns whether a given payment authorization status is "final",
meaning that once that status has been passed to completePayment, the session is finished.
Source/WebKit2:
* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
If the status isn't a final state status, bounce the current state back to active.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
Rename the _authorized ivar to _didReachFinalState.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
Set _didReachFinalState based on the return value of isFinalStateStatus.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (203413 => 203414)
--- trunk/Source/WebCore/ChangeLog 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebCore/ChangeLog 2016-07-19 20:07:38 UTC (rev 203414)
@@ -1,3 +1,20 @@
+2016-07-19 Anders Carlsson <[email protected]>
+
+ Some payment authorization status values should keep the sheet active
+ https://bugs.webkit.org/show_bug.cgi?id=159936
+ rdar://problem/26756701
+
+ Reviewed by Tim Horton.
+
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::ApplePaySession::completePayment):
+ Keep the sheet active if the status isn't a final state status.
+
+ * Modules/applepay/PaymentAuthorizationStatus.h:
+ (WebCore::isFinalStateStatus):
+ Add a new helper function that returns whether a given payment authorization status is "final",
+ meaning that once that status has been passed to completePayment, the session is finished.
+
2016-07-19 Nan Wang <[email protected]>
AX: Incorrect behavior for word related text marker functions when there's collapsed whitespace
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (203413 => 203414)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2016-07-19 20:07:38 UTC (rev 203414)
@@ -1019,6 +1019,12 @@
}
paymentCoordinator().completePaymentSession(*authorizationStatus);
+
+ if (!isFinalStateStatus(*authorizationStatus)) {
+ m_state = State::Active;
+ return;
+ }
+
m_state = State::Completed;
unsetPendingActivity(this);
}
Modified: trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h (203413 => 203414)
--- trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebCore/Modules/applepay/PaymentAuthorizationStatus.h 2016-07-19 20:07:38 UTC (rev 203414)
@@ -40,6 +40,23 @@
PINLockout,
};
+static inline bool isFinalStateStatus(PaymentAuthorizationStatus status)
+{
+ switch (status) {
+ case PaymentAuthorizationStatus::Success:
+ case PaymentAuthorizationStatus::Failure:
+ return true;
+
+ case PaymentAuthorizationStatus::InvalidBillingPostalAddress:
+ case PaymentAuthorizationStatus::InvalidShippingPostalAddress:
+ case PaymentAuthorizationStatus::InvalidShippingContact:
+ case PaymentAuthorizationStatus::PINRequired:
+ case PaymentAuthorizationStatus::PINIncorrect:
+ case PaymentAuthorizationStatus::PINLockout:
+ return false;
+ }
}
+}
+
#endif
Modified: trunk/Source/WebKit2/ChangeLog (203413 => 203414)
--- trunk/Source/WebKit2/ChangeLog 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-19 20:07:38 UTC (rev 203414)
@@ -1,3 +1,23 @@
+2016-07-19 Anders Carlsson <[email protected]>
+
+ Some payment authorization status values should keep the sheet active
+ https://bugs.webkit.org/show_bug.cgi?id=159936
+ rdar://problem/26756701
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+ (WebKit::WebPaymentCoordinatorProxy::completePaymentSession):
+ If the status isn't a final state status, bounce the current state back to active.
+
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
+ Rename the _authorized ivar to _didReachFinalState.
+
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewControllerDidFinish:]):
+ (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
+ Set _didReachFinalState based on the return value of isFinalStateStatus.
+
2016-07-18 Csaba Osztrogonác <[email protected]>
Fix the --minimal build fail in InjectedBundle.cpp
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (203413 => 203414)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2016-07-19 20:07:38 UTC (rev 203414)
@@ -196,6 +196,11 @@
platformCompletePaymentSession(status);
+ if (!WebCore::isFinalStateStatus(status)) {
+ m_state = State::Active;
+ return;
+ }
+
didReachFinalState();
}
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h (203413 => 203414)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h 2016-07-19 20:07:38 UTC (rev 203414)
@@ -50,7 +50,7 @@
BlockPtr<void (PKPaymentMerchantSession *, NSError *)> _sessionBlock;
- BOOL _authorized;
+ BOOL _didReachFinalState;
BlockPtr<void (PKPaymentAuthorizationStatus)> _paymentAuthorizedCompletion;
BlockPtr<void (NSArray *)> _didSelectPaymentMethodCompletion;
BlockPtr<void (PKPaymentAuthorizationStatus, NSArray *)> _didSelectShippingMethodCompletion;
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (203413 => 203414)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2016-07-19 19:20:02 UTC (rev 203413)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2016-07-19 20:07:38 UTC (rev 203414)
@@ -125,7 +125,7 @@
if (!_webPaymentCoordinatorProxy)
return;
- if (!_authorized)
+ if (!_didReachFinalState)
_webPaymentCoordinatorProxy->didCancelPayment();
_webPaymentCoordinatorProxy->hidePaymentUI();
@@ -402,7 +402,7 @@
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
- m_paymentAuthorizationViewControllerDelegate->_authorized = YES;
+ m_paymentAuthorizationViewControllerDelegate->_didReachFinalState = WebCore::isFinalStateStatus(status);
m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion(toPKPaymentAuthorizationStatus(status));
m_paymentAuthorizationViewControllerDelegate->_paymentAuthorizedCompletion = nullptr;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes