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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js

Issue 1668473002: ServiceWorker: Wait for the completion of async tasks on ExtendableMessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-to-client-worker.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
index 12fdb47ba725c59f6aca71e1501c480a00e38ddd..56b97a718034a4000a7a3b9519f452b97abbd999 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js
@@ -1,3 +1,5 @@
+// TODO(nhiroki): stop using global states because service workers can be killed
+// at any point (http://crbug.com/558244).
self.state = 'starting';
self.addEventListener('install', function() {
@@ -14,7 +16,7 @@ self.addEventListener('message', function(event) {
port.postMessage('FAIL: Worker should be waiting in installed state');
return;
}
- self.skipWaiting()
+ event.waitUntil(self.skipWaiting()
.then(function(result) {
if (result !== undefined) {
port.postMessage('FAIL: Promise should be resolved with undefined');
@@ -29,5 +31,5 @@ self.addEventListener('message', function(event) {
})
.catch(function(e) {
port.postMessage('FAIL: unexpected exception: ' + e);
- });
+ }));
});
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/postmessage-to-client-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698