Index: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index b3d1850adf7115988cb12ace8c85a4223eb20caa..8c4c4900b2bdbf4f993a515fa437756a655b0d7d 100644 |
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -45,6 +45,9 @@ |
#include "modules/notifications/Notification.h" |
#include "modules/notifications/NotificationEvent.h" |
#include "modules/notifications/NotificationEventInit.h" |
+#include "modules/payments/PaymentAppRequestData.h" |
+#include "modules/payments/PaymentAppRequestDataConversion.h" |
+#include "modules/payments/PaymentRequestEvent.h" |
#include "modules/push_messaging/PushEvent.h" |
#include "modules/push_messaging/PushMessageData.h" |
#include "modules/serviceworkers/ExtendableEvent.h" |
@@ -326,6 +329,21 @@ void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent( |
workerGlobalScope()->dispatchExtendableEvent(event, observer); |
} |
+void ServiceWorkerGlobalScopeProxy::dispatchPaymentRequestEvent( |
+ int eventID, |
+ const WebPaymentAppRequestData& webData) { |
+ ScriptState::Scope scope( |
+ workerGlobalScope()->scriptController()->getScriptState()); |
haraken
2016/12/01 08:24:27
You need to check scriptState->contextIsValid() be
haraken
2016/12/01 08:24:27
nhiroki@: I'm confused when SW should enter Script
kinuko
2016/12/01 13:01:52
dispatchFetchEvent and dispatchForeignFetchEvent n
nhiroki
2016/12/02 02:30:15
Thank you for pointing this out. As kinuko mention
zino
2016/12/02 03:13:49
The toPaymentAppRequestData() is also using Script
|
+ WaitUntilObserver* observer = WaitUntilObserver::create( |
+ workerGlobalScope(), WaitUntilObserver::PaymentRequest, eventID); |
+ Event* event = PaymentRequestEvent::create( |
+ EventTypeNames::paymentrequest, |
+ PaymentAppRequestDataConversion::toPaymentAppRequestData( |
+ workerGlobalScope()->scriptController()->getScriptState(), webData), |
+ observer); |
+ workerGlobalScope()->dispatchExtendableEvent(event, observer); |
+} |
+ |
bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler() { |
DCHECK(m_workerGlobalScope); |
return m_workerGlobalScope->hasEventListeners(EventTypeNames::fetch); |