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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js

Issue 2877543003: [ServiceWorker] Allow waitUntil to be called multiple times asynchronously (Closed)
Patch Set: Fix other tests using waitUntil incorrectly Created 3 years, 7 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/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
index 09b7724613d25acac74c9fdeed73b1c9be1ac87e..10e86d357cb69a811d90732e07f09b1b51f9d4b8 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
@@ -4,7 +4,13 @@ function match_query(query_string) {
function receive_event(event_name) {
return new Promise(function(resolve) {
- self.addEventListener(event_name, resolve, false);
+ var handler = function(e) {
+ resolve(e);
+ // To allow waitUntil to be called inside execution of the microtask
+ // enqueued by above resolve function.
+ e.waitUntil(Promise.resolve());
+ };
+ self.addEventListener(event_name, handler, false);
});
}

Powered by Google App Engine
This is Rietveld 408576698