| 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 73f863cb305a2a19c97bfdb01695a4e72f3ac4e2..943b15bf194d5bd4ac68b2c26e165a19c5e4c915 100644
|
| --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| @@ -30,6 +30,8 @@
|
|
|
| #include "web/ServiceWorkerGlobalScopeProxy.h"
|
|
|
| +#include <memory>
|
| +#include <utility>
|
| #include "bindings/core/v8/SourceLocation.h"
|
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
|
| #include "core/dom/Document.h"
|
| @@ -49,6 +51,7 @@
|
| #include "modules/payments/PaymentAppRequest.h"
|
| #include "modules/payments/PaymentAppRequestConversion.h"
|
| #include "modules/payments/PaymentRequestEvent.h"
|
| +#include "modules/payments/PaymentRequestRespondWithObserver.h"
|
| #include "modules/push_messaging/PushEvent.h"
|
| #include "modules/push_messaging/PushMessageData.h"
|
| #include "modules/serviceworkers/ExtendableEvent.h"
|
| @@ -70,8 +73,6 @@
|
| #include "wtf/Assertions.h"
|
| #include "wtf/Functional.h"
|
| #include "wtf/PtrUtil.h"
|
| -#include <memory>
|
| -#include <utility>
|
|
|
| namespace blink {
|
|
|
| @@ -341,15 +342,27 @@ void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(
|
| void ServiceWorkerGlobalScopeProxy::dispatchPaymentRequestEvent(
|
| int eventID,
|
| const WebPaymentAppRequest& webAppRequest) {
|
| - WaitUntilObserver* observer = WaitUntilObserver::create(
|
| + WaitUntilObserver* waitUntilObserver = WaitUntilObserver::create(
|
| workerGlobalScope(), WaitUntilObserver::PaymentRequest, eventID);
|
| + RespondWithObserver* respondWithObserver =
|
| + PaymentRequestRespondWithObserver::create(workerGlobalScope(), eventID,
|
| + waitUntilObserver);
|
| +
|
| Event* event = PaymentRequestEvent::create(
|
| EventTypeNames::paymentrequest,
|
| PaymentAppRequestConversion::toPaymentAppRequest(
|
| workerGlobalScope()->scriptController()->getScriptState(),
|
| webAppRequest),
|
| - observer);
|
| - workerGlobalScope()->dispatchExtendableEvent(event, observer);
|
| + respondWithObserver, waitUntilObserver);
|
| +
|
| + waitUntilObserver->willDispatchEvent();
|
| + respondWithObserver->willDispatchEvent();
|
| + DispatchEventResult dispatchResult =
|
| + workerGlobalScope()->dispatchEvent(event);
|
| + respondWithObserver->didDispatchEvent(dispatchResult);
|
| + // false is okay because waitUntil for payment request event doesn't care
|
| + // about the promise rejection or an uncaught runtime script error.
|
| + waitUntilObserver->didDispatchEvent(false /* errorOccurred */);
|
| }
|
|
|
| bool ServiceWorkerGlobalScopeProxy::hasFetchEventHandler() {
|
|
|