Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Unified Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2705293010: PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side) (Closed)
Patch Set: PaymentApp: Implement respondWith() in PaymentRequestEvent. (blink side) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b64b6fc17ba2567fc04caada969023b1df37e358..5896576b46e83767b55835833f17d06b4c09d179 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -50,6 +50,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"
@@ -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() {
« no previous file with comments | « third_party/WebKit/Source/web/ServiceWorkerGlobalScopeClientImpl.cpp ('k') | third_party/WebKit/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698