Title: [202584] trunk/Source/WebCore
Revision
202584
Author
[email protected]
Date
2016-06-28 14:02:52 -0700 (Tue, 28 Jun 2016)

Log Message

Move the user gesture requirement to the ApplePaySession constructor
https://bugs.webkit.org/show_bug.cgi?id=159225
rdar://problem/26507267

Reviewed by Tim Horton.

By doing this, clients can do pre-validation before showing the sheet, while we still maintain the user gesture requirement.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::ApplePaySession::create):
(WebCore::ApplePaySession::begin): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202583 => 202584)


--- trunk/Source/WebCore/ChangeLog	2016-06-28 20:19:01 UTC (rev 202583)
+++ trunk/Source/WebCore/ChangeLog	2016-06-28 21:02:52 UTC (rev 202584)
@@ -1,3 +1,17 @@
+2016-06-28  Anders Carlsson  <[email protected]>
+
+        Move the user gesture requirement to the ApplePaySession constructor
+        https://bugs.webkit.org/show_bug.cgi?id=159225
+        rdar://problem/26507267
+
+        Reviewed by Tim Horton.
+
+        By doing this, clients can do pre-validation before showing the sheet, while we still maintain the user gesture requirement.
+
+        * Modules/applepay/ApplePaySession.cpp:
+        (WebCore::ApplePaySession::create):
+        (WebCore::ApplePaySession::begin): Deleted.
+
 2016-06-28  Youenn Fablet  <[email protected]>
 
         Iterable interfaces should have their related prototype @@iterator property writable

Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (202583 => 202584)


--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2016-06-28 20:19:01 UTC (rev 202583)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2016-06-28 21:02:52 UTC (rev 202584)
@@ -647,6 +647,12 @@
         return nullptr;
     }
 
+    if (!ScriptController::processingUserGesture()) {
+        window.printErrorMessage("Must create a new ApplePaySession from a user gesture handler.");
+        ec = INVALID_ACCESS_ERR;
+        return nullptr;
+    }
+
     auto& paymentCoordinator = document.frame()->mainFrame().paymentCoordinator();
 
     if (!version || !paymentCoordinator.supportsVersion(version)) {
@@ -762,13 +768,6 @@
     auto& document = *downcast<Document>(scriptExecutionContext());
     auto& window = *document.domWindow();
 
-    if (!ScriptController::processingUserGesture()) {
-        window.printErrorMessage("Must call ApplePaySession.begin from a user gesture handler.");
-
-        ec = INVALID_ACCESS_ERR;
-        return;
-    }
-
     if (!canBegin()) {
         window.printErrorMessage("Payment session is already active.");
         ec = INVALID_ACCESS_ERR;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to