Diff
Modified: trunk/Source/WebCore/ChangeLog (203083 => 203084)
--- trunk/Source/WebCore/ChangeLog 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/ChangeLog 2016-07-11 21:10:29 UTC (rev 203084)
@@ -1,3 +1,29 @@
+2016-07-11 Anders Carlsson <[email protected]>
+
+ Able to open multiple payment sheets in Safari at the same time
+ https://bugs.webkit.org/show_bug.cgi?id=159637
+ rdar://problem/26411339
+
+ Reviewed by Beth Dakin.
+
+ Fold PaymentCoordinator::showPaymentUI into PaymentCoordinator::beginPaymentSession and
+ change the return value of the latter member function to a bool to indicate whether the
+ payment UI could be shown (or whether it's already showing).
+
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::ApplePaySession::begin):
+ Check the return value of beginPaymentSession.
+
+ * Modules/applepay/PaymentCoordinator.cpp:
+ (WebCore::PaymentCoordinator::beginPaymentSession):
+ This now takes a payment session and returns a boolean.
+ (WebCore::PaymentCoordinator::showPaymentUI): Deleted.
+
+ * Modules/applepay/PaymentCoordinator.h:
+ * Modules/applepay/PaymentCoordinatorClient.h:
+ * loader/EmptyClients.cpp:
+ The showPaymentUI client function now returns a bool.
+
2016-07-11 Nan Wang <[email protected]>
AX: Crash when backspacing in number field with spin button
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (203083 => 203084)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2016-07-11 21:10:29 UTC (rev 203084)
@@ -806,16 +806,19 @@
return;
}
- paymentCoordinator().beginPaymentSession(*this);
-
Vector<URL> linkIconURLs;
for (auto& icon : LinkIconCollector { document }.iconsOfTypes({ LinkIconType::TouchIcon, LinkIconType::TouchPrecomposedIcon }))
linkIconURLs.append(icon.url);
+ if (!paymentCoordinator().beginPaymentSession(*this, document.url(), linkIconURLs, m_paymentRequest)) {
+ window.printErrorMessage("There is already has an active payment session.");
+
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+
m_state = State::Active;
- paymentCoordinator().showPaymentUI(document.url(), linkIconURLs, m_paymentRequest);
-
setPendingActivity(this);
}
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp (203083 => 203084)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp 2016-07-11 21:10:29 UTC (rev 203084)
@@ -59,20 +59,17 @@
m_client.canMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
}
-void PaymentCoordinator::beginPaymentSession(ApplePaySession& paymentSession)
+bool PaymentCoordinator::beginPaymentSession(ApplePaySession& paymentSession, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest& paymentRequest)
{
ASSERT(!m_activeSession);
+ if (!m_client.showPaymentUI(originatingURL, linkIconURLs, paymentRequest))
+ return false;
+
m_activeSession = &paymentSession;
+ return true;
}
-void PaymentCoordinator::showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest& paymentRequest)
-{
- ASSERT(m_activeSession);
-
- m_client.showPaymentUI(originatingURL, linkIconURLs, paymentRequest);
-}
-
void PaymentCoordinator::completeMerchantValidation(const PaymentMerchantSession& paymentMerchantSession)
{
ASSERT(m_activeSession);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h (203083 => 203084)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.h 2016-07-11 21:10:29 UTC (rev 203084)
@@ -52,8 +52,7 @@
bool hasActiveSession() const { return m_activeSession; }
- void beginPaymentSession(ApplePaySession&);
- void showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&);
+ bool beginPaymentSession(ApplePaySession&, const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&);
void completeMerchantValidation(const PaymentMerchantSession&);
void completeShippingMethodSelection(PaymentAuthorizationStatus, Optional<PaymentRequest::TotalAndLineItems> newItems);
void completeShippingContactSelection(PaymentAuthorizationStatus, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, Optional<PaymentRequest::TotalAndLineItems> newItems);
Modified: trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (203083 => 203084)
--- trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h 2016-07-11 21:10:29 UTC (rev 203084)
@@ -43,7 +43,7 @@
virtual bool canMakePayments() = 0;
virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) = 0;
- virtual void showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&) = 0;
+ virtual bool showPaymentUI(const URL& originatingURL, const Vector<URL>& linkIconURLs, const PaymentRequest&) = 0;
virtual void completeMerchantValidation(const PaymentMerchantSession&) = 0;
virtual void completeShippingMethodSelection(PaymentAuthorizationStatus, Optional<PaymentRequest::TotalAndLineItems> newTotalAndItems) = 0;
virtual void completeShippingContactSelection(PaymentAuthorizationStatus, const Vector<PaymentRequest::ShippingMethod>& newShippingMethods, Optional<PaymentRequest::TotalAndLineItems> newTotalAndItems) = 0;
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (203083 => 203084)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2016-07-11 21:10:29 UTC (rev 203084)
@@ -56,7 +56,7 @@
bool supportsVersion(unsigned) override { return false; }
bool canMakePayments() override { return false; }
void canMakePaymentsWithActiveCard(const String&, const String&, std::function<void (bool)> completionHandler) override { callOnMainThread([completionHandler] { completionHandler(false); }); }
- void showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) override { }
+ bool showPaymentUI(const URL&, const Vector<URL>&, const PaymentRequest&) override { return false; }
void completeMerchantValidation(const PaymentMerchantSession&) override { }
void completeShippingMethodSelection(PaymentAuthorizationStatus, Optional<PaymentRequest::TotalAndLineItems>) override { }
Modified: trunk/Source/WebKit/mac/ChangeLog (203083 => 203084)
--- trunk/Source/WebKit/mac/ChangeLog 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-07-11 21:10:29 UTC (rev 203084)
@@ -1,3 +1,17 @@
+2016-07-11 Anders Carlsson <[email protected]>
+
+ Able to open multiple payment sheets in Safari at the same time
+ https://bugs.webkit.org/show_bug.cgi?id=159637
+ rdar://problem/26411339
+
+ Reviewed by Beth Dakin.
+
+ Update for WebCore changes.
+
+ * WebCoreSupport/WebPaymentCoordinatorClient.h:
+ * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+ (WebPaymentCoordinatorClient::showPaymentUI):
+
2016-07-08 Andy Estes <[email protected]>
[Content Filtering] Load blocked pages more like other error pages are loaded
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (203083 => 203084)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.h 2016-07-11 21:10:29 UTC (rev 203084)
@@ -39,7 +39,7 @@
bool supportsVersion(unsigned) override;
bool canMakePayments() override;
void canMakePaymentsWithActiveCard(const String&, const String&, std::function<void (bool)> completionHandler) override;
- void showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
+ bool showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
void completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
void completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (203083 => 203084)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm 2016-07-11 21:10:29 UTC (rev 203084)
@@ -55,8 +55,9 @@
});
}
-void WebPaymentCoordinatorClient::showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>&, const WebCore::PaymentRequest&)
+bool WebPaymentCoordinatorClient::showPaymentUI(const WebCore::URL&, const Vector<WebCore::URL>&, const WebCore::PaymentRequest&)
{
+ return false;
}
void WebPaymentCoordinatorClient::completeMerchantValidation(const WebCore::PaymentMerchantSession&)
Modified: trunk/Source/WebKit2/ChangeLog (203083 => 203084)
--- trunk/Source/WebKit2/ChangeLog 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-11 21:10:29 UTC (rev 203084)
@@ -1,3 +1,25 @@
+2016-07-11 Anders Carlsson <[email protected]>
+
+ Able to open multiple payment sheets in Safari at the same time
+ https://bugs.webkit.org/show_bug.cgi?id=159637
+ rdar://problem/26411339
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
+ (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
+ Add result out parameter. Set the result to false if isShowingPaymentUI is true, otherwise set isShowingPaymentUI to true.
+
+ (WebKit::WebPaymentCoordinatorProxy::didReachFinalState):
+ Set isShowingPaymentUI to false.
+
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in:
+ * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+ (WebKit::WebPaymentCoordinator::showPaymentUI):
+ * WebProcess/ApplePay/WebPaymentCoordinator.h:
+ The showPaymentUI message and client functions now return booleans.
+
2016-07-11 Commit Queue <[email protected]>
Unreviewed, rolling out r203064.
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp (203083 => 203084)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp 2016-07-11 21:10:29 UTC (rev 203084)
@@ -36,6 +36,8 @@
namespace WebKit {
+static bool isShowingPaymentUI;
+
WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy(WebPageProxy& webPageProxy)
: m_webPageProxy(webPageProxy)
, m_weakPtrFactory(this)
@@ -70,11 +72,17 @@
});
}
-void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest& paymentRequest)
+void WebPaymentCoordinatorProxy::showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest& paymentRequest, bool& result)
{
// FIXME: Make this a message check.
ASSERT(canBegin());
+ if (isShowingPaymentUI) {
+ result = false;
+ return;
+ }
+ isShowingPaymentUI = true;
+
m_state = State::Activating;
WebCore::URL originatingURL(WebCore::URL(), originatingURLString);
@@ -92,6 +100,8 @@
m_state = State::Active;
});
+
+ result = true;
}
static bool isValidEnum(WebCore::PaymentAuthorizationStatus status)
@@ -315,6 +325,9 @@
{
m_state = State::Idle;
m_merchantValidationState = MerchantValidationState::Idle;
+
+ ASSERT(isShowingPaymentUI);
+ isShowingPaymentUI = false;
}
}
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (203083 => 203084)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2016-07-11 21:10:29 UTC (rev 203084)
@@ -76,7 +76,7 @@
// Message handlers.
void canMakePayments(bool& reply);
void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, uint64_t requestID);
- void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest&);
+ void showPaymentUI(const String& originatingURLString, const Vector<String>& linkIconURLStrings, const WebCore::PaymentRequest&, bool& result);
void completeMerchantValidation(const WebCore::PaymentMerchantSession&);
void completeShippingMethodSelection(uint32_t opaqueStatus, const Optional<WebCore::PaymentRequest::TotalAndLineItems>&);
void completeShippingContactSelection(uint32_t opaqueStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>& newShippingMethods, const Optional<WebCore::PaymentRequest::TotalAndLineItems>&);
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in (203083 => 203084)
--- trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/WebPaymentCoordinatorProxy.messages.in 2016-07-11 21:10:29 UTC (rev 203084)
@@ -29,7 +29,7 @@
CanMakePayments() -> (bool result)
CanMakePaymentsWithActiveCard(String merchantIdentifier, String domainName, uint64_t requestID)
- ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::PaymentRequest paymentRequest)
+ ShowPaymentUI(String originatingURLString, Vector<String> linkIconURLStrings, WebCore::PaymentRequest paymentRequest) -> (bool result)
CompleteMerchantValidation(WebCore::PaymentMerchantSession paymentMerchantSession);
CompleteShippingMethodSelection(uint32_t opaqueStatus, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
CompleteShippingContactSelection(uint32_t opaqueStatus, Vector<WebCore::PaymentRequest::ShippingMethod> newShippingMethods, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems)
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp (203083 => 203084)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.cpp 2016-07-11 21:10:29 UTC (rev 203084)
@@ -84,13 +84,17 @@
m_webPage.send(Messages::WebPaymentCoordinatorProxy::CanMakePaymentsWithActiveCard(merchantIdentifier, domainName, replyID));
}
-void WebPaymentCoordinator::showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest& paymentRequest)
+bool WebPaymentCoordinator::showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest& paymentRequest)
{
Vector<String> linkIconURLStrings;
for (const auto& linkIconURL : linkIconURLs)
linkIconURLStrings.append(linkIconURL.string());
- m_webPage.send(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest));
+ bool result;
+ if (!m_webPage.sendSync(Messages::WebPaymentCoordinatorProxy::ShowPaymentUI(originatingURL.string(), linkIconURLStrings, paymentRequest), Messages::WebPaymentCoordinatorProxy::ShowPaymentUI::Reply(result)))
+ return false;
+
+ return result;
}
void WebPaymentCoordinator::completeMerchantValidation(const WebCore::PaymentMerchantSession& paymentMerchantSession)
Modified: trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h (203083 => 203084)
--- trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2016-07-11 21:04:28 UTC (rev 203083)
+++ trunk/Source/WebKit2/WebProcess/ApplePay/WebPaymentCoordinator.h 2016-07-11 21:10:29 UTC (rev 203084)
@@ -56,7 +56,7 @@
bool supportsVersion(unsigned version) override;
bool canMakePayments() override;
void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, std::function<void (bool)> completionHandler) override;
- void showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
+ bool showPaymentUI(const WebCore::URL& originatingURL, const Vector<WebCore::URL>& linkIconURLs, const WebCore::PaymentRequest&) override;
void completeMerchantValidation(const WebCore::PaymentMerchantSession&) override;
void completeShippingMethodSelection(WebCore::PaymentAuthorizationStatus, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;
void completeShippingContactSelection(WebCore::PaymentAuthorizationStatus, const Vector<WebCore::PaymentRequest::ShippingMethod>&, Optional<WebCore::PaymentRequest::TotalAndLineItems> newTotalAndItems) override;