Diff
Modified: trunk/Source/WebCore/ChangeLog (215540 => 215541)
--- trunk/Source/WebCore/ChangeLog 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/ChangeLog 2017-04-19 23:30:47 UTC (rev 215541)
@@ -1,3 +1,48 @@
+2017-04-19 Anders Carlsson <[email protected]>
+
+ Stop using deprecated APIs, part 3
+ https://bugs.webkit.org/show_bug.cgi?id=171003
+ rdar://problem/31589635
+ rdar://problem/31589635
+
+ Reviewed by Tim Horton.
+
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::convertAndValidate):
+ The status member variable has been removed from ApplePayShippingMethodUpdate.
+
+ (WebCore::ApplePaySession::completeShippingMethodSelection):
+ If status is not STATUS_SUCCESS, cancel the payment session.
+
+ (WebCore::ApplePaySession::canSuspendForDocumentSuspension):
+ (WebCore::ApplePaySession::canBegin):
+ (WebCore::ApplePaySession::canAbort):
+ (WebCore::ApplePaySession::canCancel):
+ (WebCore::ApplePaySession::canCompleteShippingMethodSelection):
+ (WebCore::ApplePaySession::canCompleteShippingContactSelection):
+ (WebCore::ApplePaySession::canCompletePaymentMethodSelection):
+ (WebCore::ApplePaySession::canCompletePayment):
+ (WebCore::ApplePaySession::isFinalState):
+ Add State::CancelRequested.
+
+ * Modules/applepay/ApplePayShippingMethodUpdate.h:
+ * Modules/applepay/ApplePayShippingMethodUpdate.idl:
+ Remove status.
+
+ * Modules/applepay/PaymentCoordinator.cpp:
+ (WebCore::PaymentCoordinator::cancelPaymentSession):
+ Call through to the client.
+
+ * Modules/applepay/PaymentCoordinator.h:
+ * Modules/applepay/PaymentCoordinatorClient.h:
+ Add cancelPaymentSession().
+
+ * Modules/applepay/PaymentRequest.h:
+ Remove status.
+
+ * loader/EmptyClients.cpp:
+ Add new client member function.
+
2017-04-19 Eric Carlson <[email protected]>
[MediaStream] Limit capture to one tab at a time
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-04-19 23:30:47 UTC (rev 215541)
@@ -496,11 +496,6 @@
{
ShippingMethodUpdate convertedUpdate;
- auto authorizationStatus = toPaymentAuthorizationStatus(update.status);
- if (!authorizationStatus)
- return Exception { INVALID_ACCESS_ERR };
- convertedUpdate.status = *authorizationStatus;
-
auto convertedNewTotal = convertAndValidateTotal(WTFMove(update.newTotal));
if (convertedNewTotal.hasException())
return convertedNewTotal.releaseException();
@@ -804,7 +799,17 @@
{
ApplePayShippingMethodUpdate update;
- update.status = status;
+ auto authorizationStatus = toPaymentAuthorizationStatus(status);
+ if (!authorizationStatus)
+ return Exception { INVALID_ACCESS_ERR };
+
+ if (*authorizationStatus != PaymentAuthorizationStatus::Success) {
+ // This is a fatal error. Cancel the request.
+ m_state = State::CancelRequested;
+ paymentCoordinator().cancelPaymentSession();
+ return { };
+ }
+
update.newTotal = WTFMove(newTotal);
update.newLineItems = WTFMove(newLineItems);
@@ -980,6 +985,7 @@
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
+ case State::CancelRequested:
return false;
}
}
@@ -1014,6 +1020,7 @@
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
+ case State::CancelRequested:
return false;
}
}
@@ -1032,6 +1039,7 @@
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
+ case State::CancelRequested:
return true;
}
}
@@ -1050,6 +1058,7 @@
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
+ case State::CancelRequested:
return true;
}
}
@@ -1076,6 +1085,7 @@
case State::Authorized:
case State::PaymentMethodSelected:
case State::ShippingContactSelected:
+ case State::CancelRequested:
return false;
case State::ShippingMethodSelected:
@@ -1094,6 +1104,7 @@
case State::Authorized:
case State::PaymentMethodSelected:
case State::ShippingMethodSelected:
+ case State::CancelRequested:
return false;
case State::ShippingContactSelected:
@@ -1112,6 +1123,7 @@
case State::Authorized:
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
+ case State::CancelRequested:
return false;
case State::PaymentMethodSelected:
@@ -1130,6 +1142,7 @@
case State::ShippingMethodSelected:
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
+ case State::CancelRequested:
return false;
case State::Authorized:
@@ -1146,6 +1159,7 @@
case State::ShippingContactSelected:
case State::PaymentMethodSelected:
case State::Authorized:
+ case State::CancelRequested:
return false;
case State::Completed:
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.h (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -137,6 +137,7 @@
ShippingMethodSelected,
ShippingContactSelected,
PaymentMethodSelected,
+ CancelRequested,
Authorized,
Completed,
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.h (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -32,8 +32,6 @@
namespace WebCore {
struct ApplePayShippingMethodUpdate {
- unsigned short status;
-
ApplePayLineItem newTotal;
Vector<ApplePayLineItem> newLineItems;
};
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.idl (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.idl 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayShippingMethodUpdate.idl 2017-04-19 23:30:47 UTC (rev 215541)
@@ -26,8 +26,6 @@
[
Conditional=APPLE_PAY_DELEGATE,
] dictionary ApplePayShippingMethodUpdate {
- required unsigned short status;
-
required ApplePayLineItem newTotal;
sequence<ApplePayLineItem> newLineItems;
};
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2017-04-19 23:30:47 UTC (rev 215541)
@@ -126,6 +126,13 @@
m_activeSession = nullptr;
}
+void PaymentCoordinator::cancelPaymentSession()
+{
+ ASSERT(m_activeSession);
+
+ m_client.cancelPaymentSession();
+}
+
void PaymentCoordinator::validateMerchant(const URL& validationURL)
{
if (!m_activeSession) {
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -64,6 +64,7 @@
void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&);
void completePaymentSession(std::optional<PaymentAuthorizationResult>&&);
void abortPaymentSession();
+ void cancelPaymentSession();
WEBCORE_EXPORT void validateMerchant(const URL& validationURL);
WEBCORE_EXPORT void didAuthorizePayment(const Payment&);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -54,6 +54,7 @@
virtual void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) = 0;
virtual void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) = 0;
virtual void abortPaymentSession() = 0;
+ virtual void cancelPaymentSession() = 0;
virtual void paymentCoordinatorDestroyed() = 0;
protected:
Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequest.h (215540 => 215541)
--- trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -192,7 +192,6 @@
};
struct ShippingMethodUpdate {
- PaymentAuthorizationStatus status;
PaymentRequest::TotalAndLineItems newTotalAndLineItems;
};
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (215540 => 215541)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2017-04-19 23:30:47 UTC (rev 215541)
@@ -494,6 +494,7 @@
void completeShippingContactSelection(std::optional<ShippingContactUpdate>&&) final { }
void completePaymentMethodSelection(std::optional<PaymentMethodUpdate>&&) final { }
void completePaymentSession(std::optional<PaymentAuthorizationResult>&&) final { }
+ void cancelPaymentSession() final { }
void abortPaymentSession() final { }
void paymentCoordinatorDestroyed() final { }
};
Modified: trunk/Source/WebKit/mac/ChangeLog (215540 => 215541)
--- trunk/Source/WebKit/mac/ChangeLog 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-04-19 23:30:47 UTC (rev 215541)
@@ -1,3 +1,16 @@
+2017-04-19 Anders Carlsson <[email protected]>
+
+ Stop using deprecated APIs, part 3
+ https://bugs.webkit.org/show_bug.cgi?id=171003
+ rdar://problem/31589635
+
+ Reviewed by Tim Horton.
+
+ * WebCoreSupport/WebPaymentCoordinatorClient.h:
+ * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+ (WebPaymentCoordinatorClient::cancelPaymentSession):
+ Update for WebCore changes.
+
2017-04-18 Wenson Hsieh <[email protected]>
[WK2] Support DataTransfer::files() when performing a DHTML data interaction
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (215540 => 215541)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -47,6 +47,7 @@
void completePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate>&&) override;
void completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) override;
void abortPaymentSession() override;
+ void cancelPaymentSession() override;
void paymentCoordinatorDestroyed() override;
};
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (215540 => 215541)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2017-04-19 23:30:47 UTC (rev 215541)
@@ -91,6 +91,10 @@
{
}
+void WebPaymentCoordinatorClient::cancelPaymentSession()
+{
+}
+
void WebPaymentCoordinatorClient::paymentCoordinatorDestroyed()
{
delete this;
Modified: trunk/Source/WebKit2/ChangeLog (215540 => 215541)
--- trunk/Source/WebKit2/ChangeLog 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-19 23:30:47 UTC (rev 215541)
@@ -1,3 +1,37 @@
+2017-04-19 Anders Carlsson <[email protected]>
+
+ Stop using deprecated APIs, part 3
+ https://bugs.webkit.org/show_bug.cgi?id=171003
+ rdar://problem/31589635
+
+ Reviewed by Tim Horton.
+
+ * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+ (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::encode):
+ (IPC::ArgumentCoder<WebCore::ShippingMethodUpdate>::decode):
+ Don't encode/decode status.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+ (WebKit::WebPaymentCoordinatorProxy::cancelPaymentSession):
+ Hide the UI and report back.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+ Add new member.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
+ Add new message.
+
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
+ Always pass success in the old code path. Stop using the deprecated method.
+
+ * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+ (WebKit::WebPaymentCoordinator::cancelPaymentSession):
+ Send a message to the UI process.
+
+ * WebProcess/ApplePay/WebPaymentCoordinator.h:
+ Add new member.
+
2017-04-19 Eric Carlson <[email protected]>
[MediaStream] Limit capture to one tab at a time
Modified: trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (215540 => 215541)
--- trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2017-04-19 23:30:47 UTC (rev 215541)
@@ -440,14 +440,11 @@
void ArgumentCoder<WebCore::ShippingMethodUpdate>::encode(Encoder& encoder, const WebCore::ShippingMethodUpdate& update)
{
- encoder << update.status;
encoder << update.newTotalAndLineItems;
}
bool ArgumentCoder<WebCore::ShippingMethodUpdate>::decode(Decoder& decoder, WebCore::ShippingMethodUpdate& update)
{
- if (!decoder.decode(update.status))
- return false;
if (!decoder.decode(update.newTotalAndLineItems))
return false;
@@ -455,5 +452,4 @@
}
}
-
#endif
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (215540 => 215541)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2017-04-19 23:30:47 UTC (rev 215541)
@@ -200,6 +200,15 @@
didReachFinalState();
}
+void WebPaymentCoordinatorProxy::cancelPaymentSession()
+{
+ if (!canCancel())
+ return;
+
+ hidePaymentUI();
+ didCancelPaymentSession();
+}
+
void WebPaymentCoordinatorProxy::didCancelPaymentSession()
{
ASSERT(canCancel());
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (215540 => 215541)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -85,6 +85,7 @@
void completePaymentMethodSelection(const std::optional<WebCore::PaymentMethodUpdate>&);
void completePaymentSession(const std::optional<WebCore::PaymentAuthorizationResult>&);
void abortPaymentSession();
+ void cancelPaymentSession();
bool canBegin() const;
bool canCancel() const;
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (215540 => 215541)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2017-04-19 23:30:47 UTC (rev 215541)
@@ -37,6 +37,7 @@
CompletePaymentMethodSelection(std::optional<WebCore::PaymentMethodUpdate> update)
CompletePaymentSession(std::optional<WebCore::PaymentAuthorizationResult> result)
AbortPaymentSession()
+ CancelPaymentSession()
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (215540 => 215541)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-04-19 23:30:47 UTC (rev 215541)
@@ -707,19 +707,14 @@
ASSERT(m_paymentAuthorizationViewController);
ASSERT(m_paymentAuthorizationViewControllerDelegate);
- auto status = update ? update->status : WebCore::PaymentAuthorizationStatus::Success;
-
if (update)
m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems = toPKPaymentSummaryItems(update->newTotalAndLineItems);
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- auto pkShippingMethodUpdate = adoptNS([allocPKPaymentRequestShippingMethodUpdateInstance() initWithStatus:toPKPaymentAuthorizationStatus(status) paymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
-#pragma clang diagnostic pop
+ auto pkShippingMethodUpdate = adoptNS([allocPKPaymentRequestShippingMethodUpdateInstance() initWithPaymentSummaryItems:m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get()]);
m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion(pkShippingMethodUpdate.get());
#else
- m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion(toPKPaymentAuthorizationStatus(status), m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get());
+ m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion(PKPaymentAuthorizationStatusSuccess, m_paymentAuthorizationViewControllerDelegate->_paymentSummaryItems.get());
#endif
m_paymentAuthorizationViewControllerDelegate->_didSelectShippingMethodCompletion = nullptr;
}
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp (215540 => 215541)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2017-04-19 23:30:47 UTC (rev 215541)
@@ -142,6 +142,11 @@
m_webPage.send(Messages::WebPaymentCoordinatorProxy::AbortPaymentSession());
}
+void WebPaymentCoordinator::cancelPaymentSession()
+{
+ m_webPage.send(Messages::WebPaymentCoordinatorProxy::CancelPaymentSession());
+}
+
void WebPaymentCoordinator::paymentCoordinatorDestroyed()
{
delete this;
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h (215540 => 215541)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2017-04-19 23:27:05 UTC (rev 215540)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2017-04-19 23:30:47 UTC (rev 215541)
@@ -65,6 +65,7 @@
void completePaymentSession(std::optional<WebCore::PaymentAuthorizationResult>&&) override;
void abortPaymentSession() override;
+ void cancelPaymentSession() override;
void paymentCoordinatorDestroyed() override;