Changeset 223193 in webkit
- Timestamp:
- Oct 11, 2017 10:48:26 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 13 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223191 r223193 1 2017-10-11 Andy Estes <aestes@apple.com> 2 3 [Payment Request] Implement Apple Pay merchant validation 4 https://bugs.webkit.org/show_bug.cgi?id=178159 5 6 Reviewed by Brady Eidson. 7 8 * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https-expected.txt: Added. 9 * http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html: Added. 10 1 11 2017-10-11 Brady Eidson <beidson@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r223192 r223193 1 2017-10-11 Andy Estes <aestes@apple.com> 2 3 [Payment Request] Implement Apple Pay merchant validation 4 https://bugs.webkit.org/show_bug.cgi?id=178159 5 6 Reviewed by Brady Eidson. 7 8 When ApplePayPaymentHandler::validateMerchant() is called, dispatch the 9 applepayvalidatemerchant event to the PaymentRequest object. 10 11 The event object is an ApplePayMerchantValidationEvent, on which the client calls complete() 12 with a merchant session. 13 14 Test: http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html 15 16 * DerivedSources.make: 17 * Modules/applepay/ApplePayValidateMerchantEvent.h: 18 * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp: Added. 19 (WebCore::ApplePayMerchantValidationEvent::create): 20 (WebCore::ApplePayMerchantValidationEvent::ApplePayMerchantValidationEvent): 21 (WebCore::ApplePayMerchantValidationEvent::complete): 22 (WebCore::ApplePayMerchantValidationEvent::eventInterface const): 23 * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h: Added. 24 * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl: Added. 25 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: 26 (WebCore::ApplePayPaymentHandler::validateMerchant): 27 * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: 28 * Modules/paymentrequest/PaymentRequest.idl: 29 * WebCore.xcodeproj/project.pbxproj: 30 * dom/EventNames.h: 31 * dom/EventNames.in: 32 * testing/Internals.cpp: 33 (WebCore::Internals::Internals): 34 * testing/MockPaymentCoordinator.cpp: 35 (WebCore::MockPaymentCoordinator::MockPaymentCoordinator): 36 (WebCore::MockPaymentCoordinator::showPaymentUI): 37 * testing/MockPaymentCoordinator.h: 38 1 39 2017-10-11 Chris Dumez <cdumez@apple.com> 2 40 -
trunk/Source/WebCore/DerivedSources.make
r222997 r223193 108 108 $(WebCore)/Modules/applepay/ApplePayShippingMethodUpdate.idl \ 109 109 $(WebCore)/Modules/applepay/ApplePayValidateMerchantEvent.idl \ 110 $(WebCore)/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl \ 110 111 $(WebCore)/Modules/applepay/paymentrequest/ApplePayRequest.idl \ 111 112 $(WebCore)/Modules/beacon/NavigatorBeacon.idl \ -
trunk/Source/WebCore/Modules/applepay/ApplePayValidateMerchantEvent.h
r202309 r223193 33 33 namespace WebCore { 34 34 35 class ApplePayValidateMerchantEvent final: public Event {35 class ApplePayValidateMerchantEvent : public Event { 36 36 public: 37 37 static Ref<ApplePayValidateMerchantEvent> create(const AtomicString& type, const URL& validationURL) … … 44 44 const String& validationURL() const { return m_validationURL.string(); } 45 45 46 pr ivate:46 protected: 47 47 ApplePayValidateMerchantEvent(const AtomicString& type, const URL& validationURL); 48 48 … … 50 50 EventInterface eventInterface() const override; 51 51 52 private: 52 53 const URL m_validationURL; 53 54 }; -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h
r223192 r223193 1 1 /* 2 * Copyright (C) 201 6Apple Inc. All rights reserved.2 * Copyright (C) 2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #if ENABLE(APPLE_PAY) 28 #if ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST) 29 29 30 #include "Event.h" 31 #include "URL.h" 30 #include "ApplePayValidateMerchantEvent.h" 31 32 namespace JSC { 33 class JSValue; 34 } 32 35 33 36 namespace WebCore { 34 37 35 class ApplePayValidateMerchantEvent final : public Event { 38 class Document; 39 40 class ApplePayMerchantValidationEvent final : public ApplePayValidateMerchantEvent { 36 41 public: 37 static Ref<ApplePayValidateMerchantEvent> create(const AtomicString& type, const URL& validationURL) 38 { 39 return adoptRef(*new ApplePayValidateMerchantEvent(type, validationURL)); 40 } 41 42 virtual ~ApplePayValidateMerchantEvent(); 43 44 const String& validationURL() const { return m_validationURL.string(); } 42 static Ref<ApplePayMerchantValidationEvent> create(const AtomicString&, const URL&); 43 ExceptionOr<void> complete(Document&, JSC::JSValue); 45 44 46 45 private: 47 ApplePay ValidateMerchantEvent(const AtomicString& type, const URL& validationURL);46 ApplePayMerchantValidationEvent(const AtomicString&, const URL&); 48 47 49 // Event .50 EventInterface eventInterface() const override;48 // Event 49 EventInterface eventInterface() const final; 51 50 52 const URL m_validationURL;51 bool m_isCompleted { false }; 53 52 }; 54 53 55 } 54 } // namespace WebCore 56 55 57 #endif 56 #endif // ENABLE(APPLE_PAY) && ENABLE(PAYMENT_REQUEST) -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl
r223192 r223193 1 1 /* 2 * Copyright (C) 201 6Apple Inc. All rights reserved.2 * Copyright (C) 2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 27 28 #if ENABLE(APPLE_PAY) 29 30 #include "Event.h" 31 #include "URL.h" 32 33 namespace WebCore { 34 35 class ApplePayValidateMerchantEvent final : public Event { 36 public: 37 static Ref<ApplePayValidateMerchantEvent> create(const AtomicString& type, const URL& validationURL) 38 { 39 return adoptRef(*new ApplePayValidateMerchantEvent(type, validationURL)); 40 } 41 42 virtual ~ApplePayValidateMerchantEvent(); 43 44 const String& validationURL() const { return m_validationURL.string(); } 45 46 private: 47 ApplePayValidateMerchantEvent(const AtomicString& type, const URL& validationURL); 48 49 // Event. 50 EventInterface eventInterface() const override; 51 52 const URL m_validationURL; 26 [ 27 Conditional=APPLE_PAY&PAYMENT_REQUEST, 28 NoInterfaceObject, 29 ] interface ApplePayMerchantValidationEvent : ApplePayValidateMerchantEvent { 30 [MayThrowException, CallWith=Document] void complete(any merchantSession); 53 31 }; 54 55 }56 57 #endif -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp
r223188 r223193 31 31 #include "ApplePayContactField.h" 32 32 #include "ApplePayMerchantCapability.h" 33 #include "ApplePayMerchantValidationEvent.h" 33 34 #include "ApplePaySessionPaymentRequest.h" 34 35 #include "Document.h" 36 #include "EventNames.h" 35 37 #include "JSApplePayRequest.h" 36 38 #include "LinkIconCollector.h" … … 233 235 } 234 236 237 void ApplePayPaymentHandler::validateMerchant(const URL& validationURL) 238 { 239 if (validationURL.isValid()) 240 m_paymentRequest->dispatchEvent(ApplePayMerchantValidationEvent::create(eventNames().applepayvalidatemerchantEvent, validationURL).get()); 241 } 242 235 243 } // namespace WebCore 236 244 -
trunk/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.h
r223160 r223193 54 54 55 55 // PaymentSession 56 void validateMerchant(const URL&) final { }56 void validateMerchant(const URL&) final; 57 57 void didAuthorizePayment(const Payment&) final { } 58 58 void didSelectShippingMethod(const ApplePaySessionPaymentRequest::ShippingMethod&) final { } -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.idl
r223160 r223193 43 43 44 44 attribute EventHandler onshippingaddresschange; 45 attribute EventHandler onshippingoptionchange; 45 46 46 attribute EventHandler onshippingoptionchange;47 [Conditional=APPLE_PAY] attribute EventHandler onapplepayvalidatemerchant; 47 48 }; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r223192 r223193 4541 4541 A1F76B5B1F44D3B20014C318 /* PaymentComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F76B581F44D3B20014C318 /* PaymentComplete.h */; }; 4542 4542 A1F78D0C1C25424C00245446 /* ResourceResponseCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */; }; 4543 A1F929691F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */; }; 4544 A1F9296A1F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */; }; 4545 A1F9296F1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */; }; 4546 A1F929701F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */; }; 4543 4547 A2B9217316C5CC420041DCD9 /* IntRectExtent.h in Headers */ = {isa = PBXBuildFile; fileRef = A2B9217216C5CC420041DCD9 /* IntRectExtent.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4544 4548 A31C4E4D16E02AA6002F7957 /* OESTextureHalfFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A31C4E4C16E02AA6002F7957 /* OESTextureHalfFloat.cpp */; }; … … 13051 13055 A1F76B5A1F44D3B20014C318 /* PaymentComplete.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PaymentComplete.idl; sourceTree = "<group>"; }; 13052 13056 A1F78D0B1C25422C00245446 /* ResourceResponseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceResponseCocoa.mm; sourceTree = "<group>"; }; 13057 A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplePayMerchantValidationEvent.h; sourceTree = "<group>"; }; 13058 A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePayMerchantValidationEvent.cpp; sourceTree = "<group>"; }; 13059 A1F929681F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ApplePayMerchantValidationEvent.idl; sourceTree = "<group>"; }; 13060 A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSApplePayMerchantValidationEvent.cpp; sourceTree = "<group>"; }; 13061 A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSApplePayMerchantValidationEvent.h; sourceTree = "<group>"; }; 13053 13062 A208E222A56A0C7575F2A72E /* RenderMathMLMenclose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLMenclose.h; sourceTree = "<group>"; }; 13054 13063 A2B9217216C5CC420041DCD9 /* IntRectExtent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntRectExtent.h; sourceTree = "<group>"; }; … … 17448 17457 A1DF5A891F7EC0000058A477 /* JSApplePayMerchantCapability.cpp */, 17449 17458 A1DF5A8A1F7EC0000058A477 /* JSApplePayMerchantCapability.h */, 17459 A1F9296D1F8D9F5A00523AF3 /* JSApplePayMerchantValidationEvent.cpp */, 17460 A1F9296E1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h */, 17450 17461 7C65231D1E018B5A00677F22 /* JSApplePayPayment.cpp */, 17451 17462 7C65230A1E00DBB400677F22 /* JSApplePayPayment.h */, … … 21743 21754 isa = PBXGroup; 21744 21755 children = ( 21756 A1F929671F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp */, 21757 A1F929661F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h */, 21758 A1F929681F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.idl */, 21745 21759 A1DF5AA11F7EE1130058A477 /* ApplePayPaymentHandler.cpp */, 21746 21760 A1DF5AA01F7EE1130058A477 /* ApplePayPaymentHandler.h */, … … 27235 27249 7C6579E31E00827000E3A27A /* ApplePayLineItem.h in Headers */, 27236 27250 A1DF5A861F7EBDF20058A477 /* ApplePayMerchantCapability.h in Headers */, 27251 A1F929691F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.h in Headers */, 27237 27252 7C6523011E00D03400677F22 /* ApplePayPayment.h in Headers */, 27238 27253 1A8A64521D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.h in Headers */, … … 28500 28515 7C6579F01E00856600E3A27A /* JSApplePayLineItem.h in Headers */, 28501 28516 A1DF5A8E1F7EC0020058A477 /* JSApplePayMerchantCapability.h in Headers */, 28517 A1F929701F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.h in Headers */, 28502 28518 7C6523141E00DBB400677F22 /* JSApplePayPayment.h in Headers */, 28503 28519 1AE96A8B1D1A0DDD00B86768 /* JSApplePayPaymentAuthorizedEvent.h in Headers */, … … 31436 31452 1ADFDFE01E71D8EE008F5D34 /* ApplePayError.cpp in Sources */, 31437 31453 A1DF5AA91F8070D40058A477 /* ApplePayMerchantCapability.cpp in Sources */, 31454 A1F9296A1F8D9CDB00523AF3 /* ApplePayMerchantValidationEvent.cpp in Sources */, 31438 31455 1A8A64511D19FCFB00D0E00F /* ApplePayPaymentAuthorizedEvent.cpp in Sources */, 31439 31456 A1DF5AA31F7EE1130058A477 /* ApplePayPaymentHandler.cpp in Sources */, … … 32537 32554 7C6579EF1E00856600E3A27A /* JSApplePayLineItem.cpp in Sources */, 32538 32555 A1DF5A8D1F7EC0020058A477 /* JSApplePayMerchantCapability.cpp in Sources */, 32556 A1F9296F1F8D9F5B00523AF3 /* JSApplePayMerchantValidationEvent.cpp in Sources */, 32539 32557 7C65231E1E018B5A00677F22 /* JSApplePayPayment.cpp in Sources */, 32540 32558 1ADFDFF01E71E4AC008F5D34 /* JSApplePayPaymentAuthorizationResult.cpp in Sources */, -
trunk/Source/WebCore/dom/EventNames.h
r221966 r223193 54 54 macro(animationiteration) \ 55 55 macro(animationstart) \ 56 macro(applepayvalidatemerchant) \ 56 57 macro(audioend) \ 57 58 macro(audioprocess) \ -
trunk/Source/WebCore/dom/EventNames.in
r221966 r223193 36 36 WheelEvent 37 37 XMLHttpRequestProgressEvent 38 ApplePayMerchantValidationEvent conditional=APPLE_PAY 38 39 ApplePayPaymentAuthorizedEvent conditional=APPLE_PAY 39 40 ApplePayPaymentMethodSelectedEvent conditional=APPLE_PAY -
trunk/Source/WebCore/testing/Internals.cpp
r223109 r223193 509 509 #if ENABLE(APPLE_PAY) 510 510 if (auto frame = document.frame()) 511 frame->mainFrame().setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*new MockPaymentCoordinator( )));511 frame->mainFrame().setPaymentCoordinator(std::make_unique<PaymentCoordinator>(*new MockPaymentCoordinator(frame->mainFrame()))); 512 512 #endif 513 513 } -
trunk/Source/WebCore/testing/MockPaymentCoordinator.cpp
r223076 r223193 29 29 #if ENABLE(APPLE_PAY) 30 30 31 #include "MainFrame.h" 32 #include "PaymentCoordinator.h" 33 #include "URL.h" 31 34 #include <wtf/RunLoop.h> 32 35 33 36 namespace WebCore { 37 38 MockPaymentCoordinator::MockPaymentCoordinator(MainFrame& mainFrame) 39 : m_mainFrame { mainFrame } 40 { 41 } 34 42 35 43 bool MockPaymentCoordinator::supportsVersion(unsigned version) … … 67 75 bool MockPaymentCoordinator::showPaymentUI(const URL&, const Vector<URL>&, const ApplePaySessionPaymentRequest&) 68 76 { 77 RunLoop::main().dispatch([mainFrame = makeRef(m_mainFrame)]() { 78 mainFrame->paymentCoordinator().validateMerchant({ URL(), ASCIILiteral("https://webkit.org/") }); 79 }); 69 80 return true; 70 81 } -
trunk/Source/WebCore/testing/MockPaymentCoordinator.h
r223076 r223193 31 31 32 32 namespace WebCore { 33 34 class MainFrame; 33 35 34 36 class MockPaymentCoordinator final : public PaymentCoordinatorClient { 37 public: 38 explicit MockPaymentCoordinator(MainFrame&); 39 35 40 private: 36 41 bool supportsVersion(unsigned) final; … … 47 52 void cancelPaymentSession() final { } 48 53 void paymentCoordinatorDestroyed() final; 54 55 MainFrame& m_mainFrame; 49 56 }; 50 57
Note: See TracChangeset
for help on using the changeset viewer.