blob: bf582c770744391bfd38bec0da2e7701427c466a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
self.state = 'starting';
self.addEventListener('install', function() {
self.state = 'installing';
});
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;
}
self.skipWaiting()
.then(function(result) {
if (result !== undefined) {
port.postMessage('FAIL: Promise should be resolved with undefined');
return;
}
port.postMessage('PASS');
})
.catch(function(e) {
port.postMessage('FAIL: unexpected exception: ' + e);
});
});
|