Chromium Code Reviews

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js

Issue 2877543003: [ServiceWorker] Allow waitUntil to be called multiple times asynchronously (Closed)
Patch Set: Part of comments from falken@ Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js
index 3f81a544f3f02181e3d460f994b63af897902da1..974416ef6011b52bb0ea1d42a82f1694ff2ba290 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/sw-test-helpers.js
@@ -61,6 +61,9 @@ self.synthesizeNotificationClick = function() {
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());
e.notification.close();
self.removeEventListener('notificationclick', handler);
};

Powered by Google App Engine