Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/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/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js |
similarity index 59% |
copy from third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js |
copy to third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js |
index 56b97a718034a4000a7a3b9519f452b97abbd999..bf582c770744391bfd38bec0da2e7701427c466a 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/skip-waiting-installed-worker.js |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/skip-waiting-installed-worker.js |
@@ -1,35 +1,24 @@ |
-// 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() { |
self.state = 'installing'; |
}); |
-self.addEventListener('activate', function() { |
- self.state = 'activating'; |
- }); |
- |
self.addEventListener('message', function(event) { |
var port = event.data.port; |
if (self.state !== 'installing') { |
port.postMessage('FAIL: Worker should be waiting in installed state'); |
return; |
} |
- event.waitUntil(self.skipWaiting() |
+ self.skipWaiting() |
.then(function(result) { |
if (result !== undefined) { |
port.postMessage('FAIL: Promise should be resolved with undefined'); |
return; |
} |
- if (self.state !== 'activating') { |
- port.postMessage( |
- 'FAIL: Promise should be resolved after worker activated'); |
- return; |
- } |
port.postMessage('PASS'); |
}) |
.catch(function(e) { |
port.postMessage('FAIL: unexpected exception: ' + e); |
- })); |
+ }); |
}); |