Title: [226766] trunk
Revision
226766
Author
[email protected]
Date
2018-01-10 23:26:55 -0800 (Wed, 10 Jan 2018)

Log Message

[Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
https://bugs.webkit.org/show_bug.cgi?id=181437
<rdar://problem/36376481>

Reviewed by Tim Horton.
Source/WebCore:

Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.

Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html

* DerivedSources.make:
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
(WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
(WebCore::ApplePayPaymentHandler::validateMerchant):
* Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
* Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
(WebCore::MerchantValidationEvent::create):
(WebCore::MerchantValidationEvent::MerchantValidationEvent):
(WebCore::MerchantValidationEvent::eventInterface const):
(WebCore::MerchantValidationEvent::complete):
* Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
* Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
* Modules/paymentrequest/PaymentHandler.h:
* Modules/paymentrequest/PaymentRequest.cpp:
(WebCore::PaymentRequest::completeMerchantValidation):
* Modules/paymentrequest/PaymentRequest.h:
* Modules/paymentrequest/PaymentRequest.idl:
* WebCore.xcodeproj/project.pbxproj:
* dom/EventNames.h:
* dom/EventNames.in:

LayoutTests:

* http/tests/paymentrequest/payment-request-change-shipping-address.https.html:
* http/tests/paymentrequest/payment-request-change-shipping-option.https.html:
* http/tests/paymentrequest/payment-request-merchant-validation.https-expected.txt: Added.
* http/tests/paymentrequest/payment-request-merchant-validation.https.html: Added.
* http/tests/paymentrequest/resources/helpers.js:
(async.getPaymentRequestResponse):
* http/tests/paymentrequest/updateWith-method-pmi-handling.https.html:
* http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt: Removed.
* http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (226765 => 226766)


--- trunk/LayoutTests/ChangeLog	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/ChangeLog	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,3 +1,21 @@
+2018-01-10  Andy Estes  <[email protected]>
+
+        [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
+        https://bugs.webkit.org/show_bug.cgi?id=181437
+        <rdar://problem/36376481>
+
+        Reviewed by Tim Horton.
+
+        * http/tests/paymentrequest/payment-request-change-shipping-address.https.html:
+        * http/tests/paymentrequest/payment-request-change-shipping-option.https.html:
+        * http/tests/paymentrequest/payment-request-merchant-validation.https-expected.txt: Added.
+        * http/tests/paymentrequest/payment-request-merchant-validation.https.html: Added.
+        * http/tests/paymentrequest/resources/helpers.js:
+        (async.getPaymentRequestResponse):
+        * http/tests/paymentrequest/updateWith-method-pmi-handling.https.html:
+        * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt: Removed.
+        * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html: Removed.
+
 2018-01-10  Ryan Haddad  <[email protected]>
 
         Update TestExpectations for http/tests/misc/submit-post-keygen.html.

Modified: trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-address.https.html (226765 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-address.https.html	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-address.https.html	2018-01-11 07:26:55 UTC (rev 226766)
@@ -65,7 +65,7 @@
       null,
       "request.shippingAddress must initially be null"
     );
-    request._onapplepayvalidatemerchant_ = event => {
+    request._onmerchantvalidation_ = event => {
         event.complete({ });
     };
     const listenerPromise = new Promise(resolve => {

Modified: trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https.html (226765 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https.html	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-request-change-shipping-option.https.html	2018-01-11 07:26:55 UTC (rev 226766)
@@ -59,7 +59,7 @@
       detailsWithShippingOptions,
       requestShipping
     );
-    request._onapplepayvalidatemerchant_ = event => {
+    request._onmerchantvalidation_ = event => {
         event.complete({ });
         internals.mockPaymentCoordinator.changeShippingOption("valid-1");
     };

Added: trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https-expected.txt (0 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https-expected.txt	2018-01-11 07:26:55 UTC (rev 226766)
@@ -0,0 +1,11 @@
+
+PASS Calling complete() twice throws an InvalidStateError. 
+PASS Calling complete() after abort() throws an InvalidStateError. 
+PASS Calling complete() with a promise that is rejected aborts the request. 
+PASS Calling complete() with a number aborts the request with a TypeError. 
+PASS Calling complete() with undefined aborts the request with a TypeError. 
+PASS Calling complete() with null aborts the request with a TypeError. 
+PASS Calling complete() with a string aborts the request with a TypeError. 
+PASS Calling complete() with a promise resolving to a valid merchant session does not abort the request. 
+PASS Calling complete() with a valid merchant session does not abort the request. 
+

Added: trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https.html (0 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-request-merchant-validation.https.html	2018-01-11 07:26:55 UTC (rev 226766)
@@ -0,0 +1,156 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Test for the merchantvalidation event.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<body>
+<script>
+setup({ explicit_done: true, explicit_timeout: true });
+const applePay = Object.freeze({
+    supportedMethods: "https://apple.com/apple-pay",
+    data: {
+        version: 2,
+        merchantIdentifier: '',
+        merchantCapabilities: ['supports3DS'],
+        supportedNetworks: ['visa', 'masterCard'],
+        countryCode: 'US',
+    },
+});
+const validMethods = Object.freeze([applePay]);
+const validAmount = Object.freeze({ currency: "USD", value: "5.00" });
+const validTotal = Object.freeze({
+    label: "label",
+    amount: validAmount,
+});
+const validDetails = Object.freeze({
+    total: validTotal,
+});
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete({ });
+        assert_throws("InvalidStateError", () => event.complete({ }));
+        request.abort();
+    };
+    await promise_rejects(t, "AbortError", request.show());
+}, "Calling complete() twice throws an InvalidStateError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        request.abort();
+        assert_throws("InvalidStateError", () => event.complete({ }));
+    };
+    await promise_rejects(t, "AbortError", request.show());
+}, "Calling complete() after abort() throws an InvalidStateError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise((resolve, reject) => reject()));
+    };
+    await promise_rejects(t, "AbortError", request.show());
+}, "Calling complete() with a promise that is rejected aborts the request.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise(resolve => resolve(7)));
+    };
+    await promise_rejects(t, new TypeError(), request.show());
+}, "Calling complete() with a number aborts the request with a TypeError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise(resolve => resolve(undefined)));
+    };
+    await promise_rejects(t, new TypeError(), request.show());
+}, "Calling complete() with undefined aborts the request with a TypeError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise(resolve => resolve(null)));
+    };
+    await promise_rejects(t, new TypeError(), request.show());
+}, "Calling complete() with null aborts the request with a TypeError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise(resolve => resolve("")));
+    };
+    await promise_rejects(t, new TypeError(), request.show());
+}, "Calling complete() with a string aborts the request with a TypeError.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete(new Promise(resolve => resolve({ })));
+    };
+    request._onshippingaddresschange_ = event => {
+        event.updateWith(validDetails);
+        internals.mockPaymentCoordinator.acceptPayment();
+    };
+
+    const response = await request.show();
+    response.complete("success");
+}, "Calling complete() with a promise resolving to a valid merchant session does not abort the request.");
+
+user_activation_test(async t => {
+    const request = new PaymentRequest(
+        validMethods,
+        validDetails
+    );
+    request._onmerchantvalidation_ = event => {
+        assert_equals(event.validationURL, "https://webkit.org/");
+        event.complete({ });
+    };
+    request._onshippingaddresschange_ = event => {
+        event.updateWith(validDetails);
+        internals.mockPaymentCoordinator.acceptPayment();
+    };
+
+    const response = await request.show();
+    response.complete("success");
+}, "Calling complete() with a valid merchant session does not abort the request.");
+
+done();
+</script>
+

Modified: trunk/LayoutTests/http/tests/paymentrequest/resources/helpers.js (226765 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/resources/helpers.js	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/paymentrequest/resources/helpers.js	2018-01-11 07:26:55 UTC (rev 226766)
@@ -92,12 +92,12 @@
     ],
   };
   const request = new PaymentRequest(methods, details, options);
-  request._onshippingaddresschange_ = ev => ev.updateWith(details);
-  request._onshippingoptionchange_ = ev => ev.updateWith(details);
-  request._onapplepayvalidatemerchant_ = ev => {
-      ev.complete({});
+  request._onshippingaddresschange_ = ev => {
+      ev.updateWith(details);
       internals.mockPaymentCoordinator.acceptPayment();
   };
+  request._onshippingoptionchange_ = ev => ev.updateWith(details);
+  request._onmerchantvalidation_ = ev => ev.complete({});
   const response = await activateThen(() => request.show());
   return { request, response };
 }

Modified: trunk/LayoutTests/http/tests/paymentrequest/updateWith-method-pmi-handling.https.html (226765 => 226766)


--- trunk/LayoutTests/http/tests/paymentrequest/updateWith-method-pmi-handling.https.html	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/paymentrequest/updateWith-method-pmi-handling.https.html	2018-01-11 07:26:55 UTC (rev 226766)
@@ -70,7 +70,7 @@
       validDetails,
       { requestShipping: true }
     );
-    request._onapplepayvalidatemerchant_ = event => {
+    request._onmerchantvalidation_ = event => {
         event.complete({ });
     };
     const listener = ev => {

Deleted: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt (226765 => 226766)


--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,20 +0,0 @@
-Test the applepayvalidatemerchant event.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Testing ApplePayMerchantValidationEvent
-
-PASS () => event.complete(undefined) threw exception TypeError: Type error.
-PASS () => event.complete(null) threw exception TypeError: Type error.
-PASS () => event.complete([]) threw exception TypeError: Type error.
-PASS () => event.complete('') threw exception TypeError: Type error.
-PASS () => event.complete(7) threw exception TypeError: Type error.
-PASS () => { event.complete({}); event.complete({}); } threw exception InvalidStateError: The object is in an invalid state..
-PASS () => { paymentRequest.abort(); event.complete({}); } threw exception InvalidStateError: The object is in an invalid state..
-PASS () => event.complete({}) did not throw exception.
-PASS event.validationURL is 'https://webkit.org/'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html (226765 => 226766)


--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,76 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<script src=""
-<script src=""
-<script src=""
-</head>
-<body>
-<script>
-
-description("Test the applepayvalidatemerchant event.");
-
-window.jsTestIsAsync = true;
-
-function validPaymentMethod() {
-    return {
-        supportedMethods: 'https://apple.com/apple-pay',
-        data: {
-            version: 2,
-            merchantIdentifier: '',
-            countryCode: 'US',
-            supportedNetworks: ['visa', 'masterCard'],
-            merchantCapabilities: ['supports3DS'],
-        },
-    }
-}
-
-function validPaymentDetails() {
-    return {
-        total: { label: 'Your label', amount: { currency: 'USD', value: '10.00' } },
-    }
-}
-
-function runTest(test) {
-    return new Promise((resolve, reject) => {
-        var paymentRequest = new PaymentRequest([validPaymentMethod()], validPaymentDetails());
-        paymentRequest._onapplepayvalidatemerchant_ = (event) => {
-            test(event, paymentRequest);
-            paymentRequest.abort().catch(() => {});
-            resolve();
-        };
-        activateThen(() => paymentRequest.show().catch(() => {}));
-    });
-}
-
-async function go() {
-    debug("Testing ApplePayMerchantValidationEvent")
-    debug("")
-
-    await runTest(event => shouldThrow(() => event.complete(undefined)));
-    await runTest(event => shouldThrow(() => event.complete(null)));
-    await runTest(event => shouldThrow(() => event.complete([])));
-    await runTest(event => shouldThrow(() => event.complete('')));
-    await runTest(event => shouldThrow(() => event.complete(7)));
-    await runTest(event => shouldThrow(() => { event.complete({}); event.complete({}); }));
-    await runTest((event, paymentRequest) => shouldThrow(() => { paymentRequest.abort(); event.complete({}); }));
-    await runTest(event => shouldNotThrow(() => event.complete({})));
-    await runTest(event => shouldBe("event.validationURL", "'https://webkit.org/'"));
-
-    document.querySelector("button").remove();
-    finishJSTest();
-}
-
-window._onload_ = function() {
-    var button = document.querySelector("button");
-    let x = button.offsetLeft + 2;
-    let y = button.offsetTop + 2;
-    UIHelper.activateAt(x, y);
-}
-
-</script>
-<button _onclick_='go()'>Go</button>
-<script src=""
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (226765 => 226766)


--- trunk/Source/WebCore/ChangeLog	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/ChangeLog	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,3 +1,36 @@
+2018-01-10  Andy Estes  <[email protected]>
+
+        [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
+        https://bugs.webkit.org/show_bug.cgi?id=181437
+        <rdar://problem/36376481>
+
+        Reviewed by Tim Horton.
+        
+        Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
+
+        Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
+
+        * DerivedSources.make:
+        * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+        (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
+        (WebCore::ApplePayPaymentHandler::validateMerchant):
+        * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+        * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
+        (WebCore::MerchantValidationEvent::create):
+        (WebCore::MerchantValidationEvent::MerchantValidationEvent):
+        (WebCore::MerchantValidationEvent::eventInterface const):
+        (WebCore::MerchantValidationEvent::complete):
+        * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
+        * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
+        * Modules/paymentrequest/PaymentHandler.h:
+        * Modules/paymentrequest/PaymentRequest.cpp:
+        (WebCore::PaymentRequest::completeMerchantValidation):
+        * Modules/paymentrequest/PaymentRequest.h:
+        * Modules/paymentrequest/PaymentRequest.idl:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/EventNames.h:
+        * dom/EventNames.in:
+
 2018-01-10  Basuke Suzuki  <[email protected]>
 
         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms

Modified: trunk/Source/WebCore/DerivedSources.make (226765 => 226766)


--- trunk/Source/WebCore/DerivedSources.make	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/DerivedSources.make	2018-01-11 07:26:55 UTC (rev 226766)
@@ -111,7 +111,6 @@
     $(WebCore)/Modules/applepay/ApplePayShippingMethodSelectedEvent.idl \
 	$(WebCore)/Modules/applepay/ApplePayShippingMethodUpdate.idl \
     $(WebCore)/Modules/applepay/ApplePayValidateMerchantEvent.idl \
-    $(WebCore)/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl \
     $(WebCore)/Modules/applepay/paymentrequest/ApplePayModifier.idl \
     $(WebCore)/Modules/applepay/paymentrequest/ApplePayRequest.idl \
     $(WebCore)/Modules/beacon/NavigatorBeacon.idl \
@@ -256,6 +255,7 @@
     $(WebCore)/Modules/notifications/Notification.idl \
     $(WebCore)/Modules/notifications/NotificationPermission.idl \
     $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \
+    $(WebCore)/Modules/paymentrequest/MerchantValidationEvent.idl \
     $(WebCore)/Modules/paymentrequest/PaymentAddress.idl \
     $(WebCore)/Modules/paymentrequest/PaymentComplete.idl \
     $(WebCore)/Modules/paymentrequest/PaymentCurrencyAmount.idl \

Deleted: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp (226765 => 226766)


--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ApplePayMerchantValidationEvent.h"
-
-#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST)
-
-#include "Document.h"
-#include "MainFrame.h"
-#include "PaymentCoordinator.h"
-#include "PaymentMerchantSession.h"
-#include <runtime/JSCJSValueInlines.h>
-#include <runtime/JSObject.h>
-
-namespace WebCore {
-
-Ref<ApplePayMerchantValidationEvent> ApplePayMerchantValidationEvent::create(const AtomicString& type, const URL& validationURL)
-{
-    return adoptRef(*new ApplePayMerchantValidationEvent(type, validationURL));
-}
-
-ApplePayMerchantValidationEvent::ApplePayMerchantValidationEvent(const AtomicString& type, const URL& validationURL)
-    : ApplePayValidateMerchantEvent { type, validationURL }
-{
-}
-
-ExceptionOr<void> ApplePayMerchantValidationEvent::complete(Document& document, JSC::JSValue merchantSessionValue)
-{
-    if (m_isCompleted)
-        return Exception { InvalidStateError };
-    m_isCompleted = true;
-
-    auto& paymentCoordinator = document.frame()->mainFrame().paymentCoordinator();
-    if (!paymentCoordinator.hasActiveSession())
-        return Exception { InvalidStateError };
-
-    if (!merchantSessionValue.isObject())
-        return Exception { TypeError };
-
-    String errorMessage;
-    auto merchantSession = PaymentMerchantSession::fromJS(*document.execState(), asObject(merchantSessionValue), errorMessage);
-    if (!merchantSession)
-        return Exception { TypeError, WTFMove(errorMessage) };
-
-    paymentCoordinator.completeMerchantValidation(*merchantSession);
-    return { };
-}
-
-EventInterface ApplePayMerchantValidationEvent::eventInterface() const
-{
-    return ApplePayMerchantValidationEventInterfaceType;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST)

Deleted: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h (226765 => 226766)


--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST)
-
-#include "ApplePayValidateMerchantEvent.h"
-
-namespace JSC {
-class JSValue;
-}
-
-namespace WebCore {
-
-class Document;
-
-class ApplePayMerchantValidationEvent final : public ApplePayValidateMerchantEvent {
-public:
-    static Ref<ApplePayMerchantValidationEvent> create(const AtomicString&, const URL&);
-    ExceptionOr<void> complete(Document&, JSC::JSValue);
-
-private:
-    ApplePayMerchantValidationEvent(const AtomicString&, const URL&);
-
-    // Event
-    EventInterface eventInterface() const final;
-
-    bool m_isCompleted { false };
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST)

Deleted: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl (226765 => 226766)


--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl	2018-01-11 07:26:55 UTC (rev 226766)
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-[
-    Conditional=APPLE_PAY&PAYMENT_REQUEST,
-    NoInterfaceObject,
-] interface ApplePayMerchantValidationEvent : ApplePayValidateMerchantEvent {
-    [MayThrowException, CallWith=Document] void complete(any merchantSession);
-};

Modified: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (226765 => 226766)


--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2018-01-11 07:26:55 UTC (rev 226766)
@@ -30,7 +30,6 @@
 
 #include "ApplePayContactField.h"
 #include "ApplePayMerchantCapability.h"
-#include "ApplePayMerchantValidationEvent.h"
 #include "ApplePayModifier.h"
 #include "ApplePayPayment.h"
 #include "ApplePaySessionPaymentRequest.h"
@@ -40,11 +39,13 @@
 #include "JSApplePayRequest.h"
 #include "LinkIconCollector.h"
 #include "MainFrame.h"
+#include "MerchantValidationEvent.h"
 #include "Page.h"
 #include "Payment.h"
 #include "PaymentAuthorizationStatus.h"
 #include "PaymentContact.h"
 #include "PaymentCoordinator.h"
+#include "PaymentMerchantSession.h"
 #include "PaymentMethod.h"
 #include "PaymentRequestValidator.h"
 #include "PaymentResponse.h"
@@ -318,6 +319,23 @@
     return { };
 }
 
+ExceptionOr<void> ApplePayPaymentHandler::merchantValidationCompleted(JSC::JSValue&& merchantSessionValue)
+{
+    if (!paymentCoordinator().hasActiveSession())
+        return Exception { InvalidStateError };
+
+    if (!merchantSessionValue.isObject())
+        return Exception { TypeError };
+
+    String errorMessage;
+    auto merchantSession = PaymentMerchantSession::fromJS(*document().execState(), asObject(merchantSessionValue), errorMessage);
+    if (!merchantSession)
+        return Exception { TypeError, WTFMove(errorMessage) };
+
+    paymentCoordinator().completeMerchantValidation(*merchantSession);
+    return { };
+}
+
 ExceptionOr<void> ApplePayPaymentHandler::shippingAddressUpdated(const String& error)
 {
     ShippingContactUpdate update;
@@ -399,7 +417,7 @@
 void ApplePayPaymentHandler::validateMerchant(const URL& validationURL)
 {
     if (validationURL.isValid())
-        m_paymentRequest->dispatchEvent(ApplePayMerchantValidationEvent::create(eventNames().applepayvalidatemerchantEvent, validationURL).get());
+        m_paymentRequest->dispatchEvent(MerchantValidationEvent::create(eventNames().merchantvalidationEvent, validationURL, m_paymentRequest.get()).get());
 }
 
 static Ref<PaymentAddress> convert(const ApplePayPaymentContact& contact)

Modified: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h (226765 => 226766)


--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -64,6 +64,7 @@
     void hide() final;
     void canMakePayment(WTF::Function<void(bool)>&& completionHandler) final;
     ExceptionOr<void> detailsUpdated(const AtomicString& eventType, const String& error) final;
+    ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) final;
     void complete(std::optional<PaymentComplete>&&) final;
 
     // PaymentSession

Copied: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp (from rev 226765, trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp) (0 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.cpp	2018-01-11 07:26:55 UTC (rev 226766)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MerchantValidationEvent.h"
+
+#if ENABLE(PAYMENT_REQUEST)
+
+#include "PaymentRequest.h"
+
+namespace WebCore {
+
+Ref<MerchantValidationEvent> MerchantValidationEvent::create(const AtomicString& type, const URL& validationURL, PaymentRequest& paymentRequest)
+{
+    return adoptRef(*new MerchantValidationEvent(type, validationURL, paymentRequest));
+}
+
+MerchantValidationEvent::MerchantValidationEvent(const AtomicString& type, const URL& validationURL, PaymentRequest& paymentRequest)
+    : Event { type, false, false }
+    , m_validationURL { validationURL }
+    , m_paymentRequest { paymentRequest }
+{
+}
+
+EventInterface MerchantValidationEvent::eventInterface() const
+{
+    return MerchantValidationEventInterfaceType;
+}
+
+ExceptionOr<void> MerchantValidationEvent::complete(Ref<DOMPromise>&& merchantSessionPromise)
+{
+    if (!isTrusted())
+        return Exception { InvalidStateError };
+
+    if (m_isCompleted)
+        return Exception { InvalidStateError };
+
+    auto exception = m_paymentRequest->completeMerchantValidation(*this, WTFMove(merchantSessionPromise));
+    if (exception.hasException())
+        return exception.releaseException();
+
+    m_isCompleted = true;
+    return { };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(PAYMENT_REQUEST)

Copied: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h (from rev 226765, trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h) (0 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(PAYMENT_REQUEST)
+
+#include "Event.h"
+#include "URL.h"
+
+namespace WebCore {
+
+class DOMPromise;
+class Document;
+class PaymentRequest;
+
+class MerchantValidationEvent final : public Event {
+public:
+    static Ref<MerchantValidationEvent> create(const AtomicString&, const URL&, PaymentRequest&);
+
+    const String& validationURL() const { return m_validationURL.string(); }
+    ExceptionOr<void> complete(Ref<DOMPromise>&&);
+
+private:
+    MerchantValidationEvent(const AtomicString&, const URL&, PaymentRequest&);
+
+    // Event
+    EventInterface eventInterface() const final;
+
+    bool m_isCompleted { false };
+    URL m_validationURL;
+    Ref<PaymentRequest> m_paymentRequest;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(PAYMENT_REQUEST)

Copied: trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl (from rev 226765, trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl) (0 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/paymentrequest/MerchantValidationEvent.idl	2018-01-11 07:26:55 UTC (rev 226766)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=PAYMENT_REQUEST,
+    NoInterfaceObject,
+] interface MerchantValidationEvent : Event {
+    readonly attribute DOMString validationURL;
+    [MayThrowException] void complete(Promise<any> merchantSessionPromise);
+};

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.h (226765 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.h	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentHandler.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -50,6 +50,7 @@
     virtual void hide() = 0;
     virtual void canMakePayment(WTF::Function<void(bool)>&& completionHandler) = 0;
     virtual ExceptionOr<void> detailsUpdated(const AtomicString& eventType, const String& error) = 0;
+    virtual ExceptionOr<void> merchantValidationCompleted(JSC::JSValue&&) = 0;
     virtual void complete(std::optional<PaymentComplete>&&) = 0;
 };
 

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (226765 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp	2018-01-11 07:26:55 UTC (rev 226766)
@@ -562,6 +562,34 @@
     return { };
 }
 
+ExceptionOr<void> PaymentRequest::completeMerchantValidation(Event& event, Ref<DOMPromise>&& merchantSessionPromise)
+{
+    if (m_state != State::Interactive)
+        return Exception { InvalidStateError };
+
+    event.stopPropagation();
+    event.stopImmediatePropagation();
+
+    m_merchantSessionPromise = WTFMove(merchantSessionPromise);
+    m_merchantSessionPromise->whenSettled([this, protectedThis = makeRefPtr(this)]() {
+        if (m_state != State::Interactive)
+            return;
+
+        if (m_merchantSessionPromise->status() == DOMPromise::Status::Rejected) {
+            stop();
+            return;
+        }
+
+        auto exception = m_activePaymentHandler->merchantValidationCompleted(m_merchantSessionPromise->result());
+        if (exception.hasException()) {
+            abortWithException(exception.releaseException());
+            return;
+        }
+    });
+
+    return { };
+}
+
 void PaymentRequest::settleDetailsPromise(const AtomicString& type)
 {
     auto scopeExit = makeScopeExit([&] {

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h (226765 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -80,6 +80,7 @@
     void shippingAddressChanged(Ref<PaymentAddress>&&);
     void shippingOptionChanged(const String& shippingOption);
     ExceptionOr<void> updateWith(Event&, Ref<DOMPromise>&&);
+    ExceptionOr<void> completeMerchantValidation(Event&, Ref<DOMPromise>&&);
     void accept(const String& methodName, JSC::Strong<JSC::JSObject>&& details, Ref<PaymentAddress>&& shippingAddress, const String& payerName, const String& payerEmail, const String& payerPhone);
     void complete(std::optional<PaymentComplete>&&);
     void cancel();
@@ -120,6 +121,7 @@
     std::optional<ShowPromise> m_showPromise;
     RefPtr<PaymentHandler> m_activePaymentHandler;
     RefPtr<DOMPromise> m_detailsPromise;
+    RefPtr<DOMPromise> m_merchantSessionPromise;
     bool m_isUpdating { false };
 };
 

Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl (226765 => 226766)


--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl	2018-01-11 07:26:55 UTC (rev 226766)
@@ -43,6 +43,5 @@
 
     attribute EventHandler onshippingaddresschange;
     attribute EventHandler onshippingoptionchange;
-
-    [Conditional=APPLE_PAY] attribute EventHandler onapplepayvalidatemerchant;
+    attribute EventHandler onmerchantvalidation;
 };

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (226765 => 226766)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-01-11 07:26:55 UTC (rev 226766)
@@ -2712,6 +2712,10 @@
 		A10DBF4718F92317000D70C6 /* PreviewLoaderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DBF4618F92317000D70C6 /* PreviewLoaderClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A10DC76B14747BAB005E2471 /* StyleGridData.h in Headers */ = {isa = PBXBuildFile; fileRef = A10DC76914747BAB005E2471 /* StyleGridData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A110DB9B14F5DF7700A03B93 /* StyleGridItemData.h in Headers */ = {isa = PBXBuildFile; fileRef = A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A11AE0CC1FFD60530047348B /* MerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */; };
+		A11AE0CD1FFD60530047348B /* MerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A11AE0CA1FFD60530047348B /* MerchantValidationEvent.cpp */; };
+		A11AE0D21FFD61DF0047348B /* JSMerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A11AE0D01FFD61DE0047348B /* JSMerchantValidationEvent.cpp */; };
+		A11AE0D31FFD61DF0047348B /* JSMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A11AE0D11FFD61DF0047348B /* JSMerchantValidationEvent.h */; };
 		A11E8C051B1E28F40003A7C7 /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = A11E8C001B1E28BE0003A7C7 /* copyCursor.png */; };
 		A11E8C061B1E28FA0003A7C7 /* moveCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = A11E8C011B1E28BE0003A7C7 /* moveCursor.png */; };
 		A11E8C071B1E28FE0003A7C7 /* northEastSouthWestResizeCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = A11E8C021B1E28BE0003A7C7 /* northEastSouthWestResizeCursor.png */; };
@@ -2831,10 +2835,6 @@
 		A1F76B4F1F44D2420014C318 /* PaymentDetailsModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B4C1F44D2420014C318 /* PaymentDetailsModifier.h */; };
 		A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B521F44D2C70014C318 /* PaymentShippingOption.h */; };
 		A1F76B5B1F44D3B20014C318 /* PaymentComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B581F44D3B20014C318 /* PaymentComplete.h */; };
-		A1F929691F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */; };
-		A1F9296A1F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */; };
-		A1F9296F1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */; };
-		A1F929701F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */; };
 		A2B9217316C5CC420041DCD9 /* IntRectExtent.h in Headers */ = {isa = PBXBuildFile; fileRef = A2B9217216C5CC420041DCD9 /* IntRectExtent.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A31C4E4D16E02AA6002F7957 /* OESTextureHalfFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */; };
 		A31C4E4F16E02AB4002F7957 /* OESTextureHalfFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = A31C4E4E16E02AB4002F7957 /* OESTextureHalfFloat.h */; };
@@ -10554,6 +10554,11 @@
 		A10DC76914747BAB005E2471 /* StyleGridData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridData.h; sourceTree = "<group>"; };
 		A110DB9A14F5DF7700A03B93 /* StyleGridItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleGridItemData.h; sourceTree = "<group>"; };
 		A110DB9C14F5DF8700A03B93 /* StyleGridItemData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleGridItemData.cpp; sourceTree = "<group>"; };
+		A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MerchantValidationEvent.h; sourceTree = "<group>"; };
+		A11AE0CA1FFD60530047348B /* MerchantValidationEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MerchantValidationEvent.cpp; sourceTree = "<group>"; };
+		A11AE0CB1FFD60530047348B /* MerchantValidationEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MerchantValidationEvent.idl; sourceTree = "<group>"; };
+		A11AE0D01FFD61DE0047348B /* JSMerchantValidationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMerchantValidationEvent.cpp; sourceTree = "<group>"; };
+		A11AE0D11FFD61DF0047348B /* JSMerchantValidationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMerchantValidationEvent.h; sourceTree = "<group>"; };
 		A11E8C001B1E28BE0003A7C7 /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
 		A11E8C011B1E28BE0003A7C7 /* moveCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = moveCursor.png; sourceTree = "<group>"; };
 		A11E8C021B1E28BE0003A7C7 /* northEastSouthWestResizeCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = northEastSouthWestResizeCursor.png; sourceTree = "<group>"; };
@@ -10759,11 +10764,6 @@
 		A1F76B581F44D3B20014C318 /* PaymentComplete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaymentComplete.h; sourceTree = "<group>"; };
 		A1F76B5A1F44D3B20014C318 /* PaymentComplete.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PaymentComplete.idl; sourceTree = "<group>"; };
 		A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseCocoa.mm; sourceTree = "<group>"; };
-		A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayMerchantValidationEvent.h; sourceTree = "<group>"; };
-		A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePayMerchantValidationEvent.cpp; sourceTree = "<group>"; };
-		A1F929681F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayMerchantValidationEvent.idl; sourceTree = "<group>"; };
-		A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayMerchantValidationEvent.cpp; sourceTree = "<group>"; };
-		A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePayMerchantValidationEvent.h; sourceTree = "<group>"; };
 		A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLMenclose.h; sourceTree = "<group>"; };
 		A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = "<group>"; };
 		A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESTextureHalfFloat.cpp; sourceTree = "<group>"; };
@@ -15654,8 +15654,6 @@
 				7C6579EA1E00856600E3A27A /* JSApplePayLineItem.h */,
 				A1DF5A891F7EC0000058A477 /* JSApplePayMerchantCapability.cpp */,
 				A1DF5A8A1F7EC0000058A477 /* JSApplePayMerchantCapability.h */,
-				A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */,
-				A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */,
 				A1F6D00A1FE099210018078C /* JSApplePayModifier.cpp */,
 				A1F6D00C1FE099220018078C /* JSApplePayModifier.h */,
 				7C65231D1E018B5A00677F22 /* JSApplePayPayment.cpp */,
@@ -20574,6 +20572,8 @@
 		A1CC564A1F4613BB00A4555B /* PaymentRequest */ = {
 			isa = PBXGroup;
 			children = (
+				A11AE0D01FFD61DE0047348B /* JSMerchantValidationEvent.cpp */,
+				A11AE0D11FFD61DF0047348B /* JSMerchantValidationEvent.h */,
 				A1CC565F1F46146100A4555B /* JSPaymentAddress.cpp */,
 				A1CC56651F46146800A4555B /* JSPaymentAddress.h */,
 				A1CC56601F46146200A4555B /* JSPaymentComplete.cpp */,
@@ -20613,9 +20613,6 @@
 		A1DF5A9F1F7EE0F10058A477 /* paymentrequest */ = {
 			isa = PBXGroup;
 			children = (
-				A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */,
-				A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */,
-				A1F929681F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.idl */,
 				A1F6CFFC1FE096210018078C /* ApplePayModifier.h */,
 				A1F6CFFE1FE096210018078C /* ApplePayModifier.idl */,
 				A1DF5AA11F7EE1130058A477 /* ApplePayPaymentHandler.cpp */,
@@ -20629,6 +20626,9 @@
 		A1F76B0E1F44C0CF0014C318 /* paymentrequest */ = {
 			isa = PBXGroup;
 			children = (
+				A11AE0CA1FFD60530047348B /* MerchantValidationEvent.cpp */,
+				A11AE0C91FFD60530047348B /* MerchantValidationEvent.h */,
+				A11AE0CB1FFD60530047348B /* MerchantValidationEvent.idl */,
 				A1CFE0311F9E71290065C345 /* PaymentAddress.cpp */,
 				A1F76B401F44CF7F0014C318 /* PaymentAddress.h */,
 				A1F76B421F44CF7F0014C318 /* PaymentAddress.idl */,
@@ -26291,7 +26291,6 @@
 				A1DF5A941F7EC4320058A477 /* ApplePayContactField.h in Headers */,
 				7C6579E31E00827000E3A27A /* ApplePayLineItem.h in Headers */,
 				A1DF5A861F7EBDF20058A477 /* ApplePayMerchantCapability.h in Headers */,
-				A1F929691F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h in Headers */,
 				A1F6CFFF1FE096210018078C /* ApplePayModifier.h in Headers */,
 				7C6523011E00D03400677F22 /* ApplePayPayment.h in Headers */,
 				1A8A64521D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.h in Headers */,
@@ -27572,7 +27571,6 @@
 				A1DF5A991F7EC8C00058A477 /* JSApplePayContactField.h in Headers */,
 				7C6579F01E00856600E3A27A /* JSApplePayLineItem.h in Headers */,
 				A1DF5A8E1F7EC0020058A477 /* JSApplePayMerchantCapability.h in Headers */,
-				A1F929701F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h in Headers */,
 				A1F6D0121FE099B40018078C /* JSApplePayModifier.h in Headers */,
 				7C6523141E00DBB400677F22 /* JSApplePayPayment.h in Headers */,
 				1AE96A8B1D1A0DDD00B86768 /* JSApplePayPaymentAuthorizedEvent.h in Headers */,
@@ -27965,6 +27963,7 @@
 				07277E5517D018CC0015534D /* JSMediaStreamTrackEvent.h in Headers */,
 				932CC0D51DFFD667004C0F9F /* JSMediaTrackConstraints.h in Headers */,
 				0787C46A1BFBDF6F006DCD7F /* JSMediaTrackSupportedConstraints.h in Headers */,
+				A11AE0D31FFD61DF0047348B /* JSMerchantValidationEvent.h in Headers */,
 				E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */,
 				75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */,
 				E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
@@ -28579,6 +28578,7 @@
 				51771DFF1BDB485000CAE8E4 /* MemoryObjectStore.h in Headers */,
 				517139061BF64DEC000D5F01 /* MemoryObjectStoreCursor.h in Headers */,
 				413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */,
+				A11AE0CC1FFD60530047348B /* MerchantValidationEvent.h in Headers */,
 				93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */,
 				E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
 				75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */,
@@ -30524,7 +30524,6 @@
 				A9787CB41F5F5C6600C551C6 /* AccessibilityMediaObject.cpp in Sources */,
 				31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */,
 				490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */,
-				A1F9296A1F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp in Sources */,
 				CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */,
 				CD5596911475B678001D0BD0 /* AudioFileReaderIOS.cpp in Sources */,
 				CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */,
@@ -30588,9 +30587,9 @@
 				BE16C59417CFE17200852C04 /* InbandWebVTTTextTrack.cpp in Sources */,
 				CD063F821E23FA8900812BE3 /* InitDataRegistry.cpp in Sources */,
 				6A72798C1F16C29C003F39B8 /* InspectorShaderProgram.cpp in Sources */,
-				A1F9296F1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.cpp in Sources */,
 				A1F6D0111FE099B20018078C /* JSApplePayModifier.cpp in Sources */,
 				A1F6D0101FE099960018078C /* JSApplePayPaymentMethodType.cpp in Sources */,
+				A11AE0D21FFD61DF0047348B /* JSMerchantValidationEvent.cpp in Sources */,
 				538EC93E1F99BF5A004D22A8 /* JSQuickTimePluginReplacement.cpp in Sources */,
 				935C477009AC4D7300A6AAB4 /* KeyEventMac.mm in Sources */,
 				CDA98E0B1603CD6000FEA3B1 /* LegacyCDM.cpp in Sources */,
@@ -30622,6 +30621,7 @@
 				C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */,
 				07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
 				CDC8B5A6180474F70016E685 /* MediaSourcePrivateAVFObjC.mm in Sources */,
+				A11AE0CD1FFD60530047348B /* MerchantValidationEvent.cpp in Sources */,
 				CDF2B0101820540600F2B424 /* MockBox.cpp in Sources */,
 				51058ADF1D67C229009A538C /* MockGamepad.cpp in Sources */,
 				51058AE11D67C229009A538C /* MockGamepadProvider.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/EventNames.h (226765 => 226766)


--- trunk/Source/WebCore/dom/EventNames.h	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/dom/EventNames.h	2018-01-11 07:26:55 UTC (rev 226766)
@@ -53,7 +53,6 @@
     macro(animationend) \
     macro(animationiteration) \
     macro(animationstart) \
-    macro(applepayvalidatemerchant) \
     macro(audioend) \
     macro(audioprocess) \
     macro(audiostart) \
@@ -153,6 +152,7 @@
     macro(loadingerror) \
     macro(loadstart) \
     macro(mark) \
+    macro(merchantvalidation) \
     macro(message) \
     macro(messageerror) \
     macro(mousedown) \

Modified: trunk/Source/WebCore/dom/EventNames.in (226765 => 226766)


--- trunk/Source/WebCore/dom/EventNames.in	2018-01-11 07:07:52 UTC (rev 226765)
+++ trunk/Source/WebCore/dom/EventNames.in	2018-01-11 07:26:55 UTC (rev 226766)
@@ -39,7 +39,6 @@
 WebKitTransitionEvent
 WheelEvent
 XMLHttpRequestProgressEvent
-ApplePayMerchantValidationEvent conditional=APPLE_PAY
 ApplePayPaymentAuthorizedEvent conditional=APPLE_PAY
 ApplePayPaymentMethodSelectedEvent conditional=APPLE_PAY
 ApplePayShippingContactSelectedEvent conditional=APPLE_PAY
@@ -49,6 +48,7 @@
 OfflineAudioCompletionEvent conditional=WEB_AUDIO
 MediaStreamEvent conditional=WEB_RTC
 MediaStreamTrackEvent conditional=MEDIA_STREAM
+MerchantValidationEvent conditional=PAYMENT_REQUEST
 PaymentRequestUpdateEvent conditional=PAYMENT_REQUEST
 RTCPeerConnectionIceEvent conditional=WEB_RTC
 RTCDataChannelEvent conditional=WEB_RTC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to