Diff
Modified: trunk/LayoutTests/ChangeLog (223192 => 223193)
--- trunk/LayoutTests/ChangeLog 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/LayoutTests/ChangeLog 2017-10-11 17:48:26 UTC (rev 223193)
@@ -1,3 +1,13 @@
+2017-10-11 Andy Estes <[email protected]>
+
+ [Payment Request] Implement Apple Pay merchant validation
+ https://bugs.webkit.org/show_bug.cgi?id=178159
+
+ Reviewed by Brady Eidson.
+
+ * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt: Added.
+ * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html: Added.
+
2017-10-11 Brady Eidson <[email protected]>
Add a SW context process (where SW scripts will actually execute).
Added: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt (0 => 223193)
--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt 2017-10-11 17:48:26 UTC (rev 223193)
@@ -0,0 +1,20 @@
+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
+
Added: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html (0 => 223193)
--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html (rev 0)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html 2017-10-11 17:48:26 UTC (rev 223193)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<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();
+ resolve();
+ };
+ 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 (223192 => 223193)
--- trunk/Source/WebCore/ChangeLog 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/ChangeLog 2017-10-11 17:48:26 UTC (rev 223193)
@@ -1,3 +1,41 @@
+2017-10-11 Andy Estes <[email protected]>
+
+ [Payment Request] Implement Apple Pay merchant validation
+ https://bugs.webkit.org/show_bug.cgi?id=178159
+
+ Reviewed by Brady Eidson.
+
+ When ApplePayPaymentHandler::validateMerchant() is called, dispatch the
+ applepayvalidatemerchant event to the PaymentRequest object.
+
+ The event object is an ApplePayMerchantValidationEvent, on which the client calls complete()
+ with a merchant session.
+
+ Test: http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html
+
+ * DerivedSources.make:
+ * Modules/applepay/ApplePayValidateMerchantEvent.h:
+ * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp: Added.
+ (WebCore::ApplePayMerchantValidationEvent::create):
+ (WebCore::ApplePayMerchantValidationEvent::ApplePayMerchantValidationEvent):
+ (WebCore::ApplePayMerchantValidationEvent::complete):
+ (WebCore::ApplePayMerchantValidationEvent::eventInterface const):
+ * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h: Added.
+ * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl: Added.
+ * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+ (WebCore::ApplePayPaymentHandler::validateMerchant):
+ * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
+ * Modules/paymentrequest/PaymentRequest.idl:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventNames.h:
+ * dom/EventNames.in:
+ * testing/Internals.cpp:
+ (WebCore::Internals::Internals):
+ * testing/MockPaymentCoordinator.cpp:
+ (WebCore::MockPaymentCoordinator::MockPaymentCoordinator):
+ (WebCore::MockPaymentCoordinator::showPaymentUI):
+ * testing/MockPaymentCoordinator.h:
+
2017-10-11 Chris Dumez <[email protected]>
Modernize Geolocation code
Modified: trunk/Source/WebCore/DerivedSources.make (223192 => 223193)
--- trunk/Source/WebCore/DerivedSources.make 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/DerivedSources.make 2017-10-11 17:48:26 UTC (rev 223193)
@@ -107,6 +107,7 @@
$(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/ApplePayRequest.idl \
$(WebCore)/Modules/beacon/NavigatorBeacon.idl \
$(WebCore)/Modules/cache/DOMWindowCaches.idl \
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h (223192 => 223193)
--- trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h 2017-10-11 17:48:26 UTC (rev 223193)
@@ -32,7 +32,7 @@
namespace WebCore {
-class ApplePayValidateMerchantEvent final : public Event {
+class ApplePayValidateMerchantEvent : public Event {
public:
static Ref<ApplePayValidateMerchantEvent> create(const AtomicString& type, const URL& validationURL)
{
@@ -43,12 +43,13 @@
const String& validationURL() const { return m_validationURL.string(); }
-private:
+protected:
ApplePayValidateMerchantEvent(const AtomicString& type, const URL& validationURL);
// Event.
EventInterface eventInterface() const override;
+private:
const URL m_validationURL;
};
Added: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp (0 => 223193)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp 2017-10-11 17:48:26 UTC (rev 223193)
@@ -0,0 +1,79 @@
+/*
+ * 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)
Copied: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h (from rev 223192, trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h) (0 => 223193)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h 2017-10-11 17:48:26 UTC (rev 223193)
@@ -0,0 +1,56 @@
+/*
+ * 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)
Copied: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl (from rev 223192, trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h) (0 => 223193)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl (rev 0)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl 2017-10-11 17:48:26 UTC (rev 223193)
@@ -0,0 +1,31 @@
+/*
+ * 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 (223192 => 223193)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp 2017-10-11 17:48:26 UTC (rev 223193)
@@ -30,8 +30,10 @@
#include "ApplePayContactField.h"
#include "ApplePayMerchantCapability.h"
+#include "ApplePayMerchantValidationEvent.h"
#include "ApplePaySessionPaymentRequest.h"
#include "Document.h"
+#include "EventNames.h"
#include "JSApplePayRequest.h"
#include "LinkIconCollector.h"
#include "MainFrame.h"
@@ -232,6 +234,12 @@
paymentCoordinator(document).canMakePaymentsWithActiveCard(m_applePayRequest->merchantIdentifier, document.domain(), WTFMove(completionHandler));
}
+void ApplePayPaymentHandler::validateMerchant(const URL& validationURL)
+{
+ if (validationURL.isValid())
+ m_paymentRequest->dispatchEvent(ApplePayMerchantValidationEvent::create(eventNames().applepayvalidatemerchantEvent, validationURL).get());
+}
+
} // namespace WebCore
#endif // ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST)
Modified: trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h (223192 => 223193)
--- trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h 2017-10-11 17:48:26 UTC (rev 223193)
@@ -53,7 +53,7 @@
void canMakePayment(Document&, WTF::Function<void(bool)>&& completionHandler) final;
// PaymentSession
- void validateMerchant(const URL&) final { }
+ void validateMerchant(const URL&) final;
void didAuthorizePayment(const Payment&) final { }
void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) final { }
void didSelectShippingContact(const PaymentContact&) final { }
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl (223192 => 223193)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl 2017-10-11 17:48:26 UTC (rev 223193)
@@ -42,6 +42,7 @@
readonly attribute PaymentShippingType? shippingType;
attribute EventHandler onshippingaddresschange;
+ attribute EventHandler onshippingoptionchange;
- attribute EventHandler onshippingoptionchange;
+ [Conditional=APPLE_PAY] attribute EventHandler onapplepayvalidatemerchant;
};
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (223192 => 223193)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-10-11 17:48:26 UTC (rev 223193)
@@ -4540,6 +4540,10 @@
A1F76B551F44D2C70014C318 /* PaymentShippingOption.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B521F44D2C70014C318 /* PaymentShippingOption.h */; };
A1F76B5B1F44D3B20014C318 /* PaymentComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B581F44D3B20014C318 /* PaymentComplete.h */; };
A1F78D0C1C25424C00245446 /* ResourceResponseCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */; };
+ 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 */; };
@@ -13050,6 +13054,11 @@
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>"; };
@@ -17447,6 +17456,8 @@
7C6579EA1E00856600E3A27A /* JSApplePayLineItem.h */,
A1DF5A891F7EC0000058A477 /* JSApplePayMerchantCapability.cpp */,
A1DF5A8A1F7EC0000058A477 /* JSApplePayMerchantCapability.h */,
+ A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */,
+ A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */,
7C65231D1E018B5A00677F22 /* JSApplePayPayment.cpp */,
7C65230A1E00DBB400677F22 /* JSApplePayPayment.h */,
1ADFDFE31E71DCA0008F5D34 /* JSApplePayPaymentAuthorizationResult.cpp */,
@@ -21742,6 +21753,9 @@
A1DF5A9F1F7EE0F10058A477 /* paymentrequest */ = {
isa = PBXGroup;
children = (
+ A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */,
+ A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */,
+ A1F929681F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.idl */,
A1DF5AA11F7EE1130058A477 /* ApplePayPaymentHandler.cpp */,
A1DF5AA01F7EE1130058A477 /* ApplePayPaymentHandler.h */,
A1DF5A7C1F7EBD0B0058A477 /* ApplePayRequest.h */,
@@ -27234,6 +27248,7 @@
A1DF5A941F7EC4320058A477 /* ApplePayContactField.h in Headers */,
7C6579E31E00827000E3A27A /* ApplePayLineItem.h in Headers */,
A1DF5A861F7EBDF20058A477 /* ApplePayMerchantCapability.h in Headers */,
+ A1F929691F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h in Headers */,
7C6523011E00D03400677F22 /* ApplePayPayment.h in Headers */,
1A8A64521D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.h in Headers */,
7C6522FB1E00C90900677F22 /* ApplePayPaymentContact.h in Headers */,
@@ -28499,6 +28514,7 @@
A1DF5A991F7EC8C00058A477 /* JSApplePayContactField.h in Headers */,
7C6579F01E00856600E3A27A /* JSApplePayLineItem.h in Headers */,
A1DF5A8E1F7EC0020058A477 /* JSApplePayMerchantCapability.h in Headers */,
+ A1F929701F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h in Headers */,
7C6523141E00DBB400677F22 /* JSApplePayPayment.h in Headers */,
1AE96A8B1D1A0DDD00B86768 /* JSApplePayPaymentAuthorizedEvent.h in Headers */,
7C6523161E00DBB500677F22 /* JSApplePayPaymentContact.h in Headers */,
@@ -31435,6 +31451,7 @@
A1DF5AB51F8078F30058A477 /* ApplePayContactField.cpp in Sources */,
1ADFDFE01E71D8EE008F5D34 /* ApplePayError.cpp in Sources */,
A1DF5AA91F8070D40058A477 /* ApplePayMerchantCapability.cpp in Sources */,
+ A1F9296A1F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp in Sources */,
1A8A64511D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.cpp in Sources */,
A1DF5AA31F7EE1130058A477 /* ApplePayPaymentHandler.cpp in Sources */,
1A8A64541D19FCFC00D0E00F /* ApplePayPaymentMethodSelectedEvent.cpp in Sources */,
@@ -32536,6 +32553,7 @@
1ADFDFEC1E71E455008F5D34 /* JSApplePayError.cpp in Sources */,
7C6579EF1E00856600E3A27A /* JSApplePayLineItem.cpp in Sources */,
A1DF5A8D1F7EC0020058A477 /* JSApplePayMerchantCapability.cpp in Sources */,
+ A1F9296F1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.cpp in Sources */,
7C65231E1E018B5A00677F22 /* JSApplePayPayment.cpp in Sources */,
1ADFDFF01E71E4AC008F5D34 /* JSApplePayPaymentAuthorizationResult.cpp in Sources */,
1AE96A8A1D1A0DDD00B86768 /* JSApplePayPaymentAuthorizedEvent.cpp in Sources */,
Modified: trunk/Source/WebCore/dom/EventNames.h (223192 => 223193)
--- trunk/Source/WebCore/dom/EventNames.h 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/dom/EventNames.h 2017-10-11 17:48:26 UTC (rev 223193)
@@ -53,6 +53,7 @@
macro(animationend) \
macro(animationiteration) \
macro(animationstart) \
+ macro(applepayvalidatemerchant) \
macro(audioend) \
macro(audioprocess) \
macro(audiostart) \
Modified: trunk/Source/WebCore/dom/EventNames.in (223192 => 223193)
--- trunk/Source/WebCore/dom/EventNames.in 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/dom/EventNames.in 2017-10-11 17:48:26 UTC (rev 223193)
@@ -35,6 +35,7 @@
WebKitTransitionEvent
WheelEvent
XMLHttpRequestProgressEvent
+ApplePayMerchantValidationEvent conditional=APPLE_PAY
ApplePayPaymentAuthorizedEvent conditional=APPLE_PAY
ApplePayPaymentMethodSelectedEvent conditional=APPLE_PAY
ApplePayShippingContactSelectedEvent conditional=APPLE_PAY
Modified: trunk/Source/WebCore/testing/Internals.cpp (223192 => 223193)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-10-11 17:48:26 UTC (rev 223193)
@@ -508,7 +508,7 @@
#if ENABLE(APPLE_PAY)
if (auto frame = document.frame())
- frame->mainFrame().setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*new MockPaymentCoordinator()));
+ frame->mainFrame().setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*new MockPaymentCoordinator(frame->mainFrame())));
#endif
}
Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp (223192 => 223193)
--- trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp 2017-10-11 17:48:26 UTC (rev 223193)
@@ -28,10 +28,18 @@
#if ENABLE(APPLE_PAY)
+#include "MainFrame.h"
+#include "PaymentCoordinator.h"
+#include "URL.h"
#include <wtf/RunLoop.h>
namespace WebCore {
+MockPaymentCoordinator::MockPaymentCoordinator(MainFrame& mainFrame)
+ : m_mainFrame { mainFrame }
+{
+}
+
bool MockPaymentCoordinator::supportsVersion(unsigned version)
{
ASSERT(version > 0);
@@ -66,6 +74,9 @@
bool MockPaymentCoordinator::showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&)
{
+ RunLoop::main().dispatch([mainFrame = makeRef(m_mainFrame)]() {
+ mainFrame->paymentCoordinator().validateMerchant({ URL(), ASCIILiteral("https://webkit.org/") });
+ });
return true;
}
Modified: trunk/Source/WebCore/testing/MockPaymentCoordinator.h (223192 => 223193)
--- trunk/Source/WebCore/testing/MockPaymentCoordinator.h 2017-10-11 17:41:59 UTC (rev 223192)
+++ trunk/Source/WebCore/testing/MockPaymentCoordinator.h 2017-10-11 17:48:26 UTC (rev 223193)
@@ -30,8 +30,13 @@
#include "PaymentCoordinatorClient.h"
namespace WebCore {
+
+class MainFrame;
class MockPaymentCoordinator final : public PaymentCoordinatorClient {
+public:
+ explicit MockPaymentCoordinator(MainFrame&);
+
private:
bool supportsVersion(unsigned) final;
bool canMakePayments() final;
@@ -46,6 +51,8 @@
void abortPaymentSession() final { }
void cancelPaymentSession() final { }
void paymentCoordinatorDestroyed() final;
+
+ MainFrame& m_mainFrame;
};
} // namespace WebCore