OLD | NEW |
---|---|
(Empty) | |
1 self.onmessage = function(e) { | |
2 var message = e.data; | |
3 if ('port' in message) { | |
4 port = message.port; | |
5 doNextFetchTest(port); | |
6 } | |
7 }; | |
8 | |
9 var testTargets = [ | |
10 'other.html', | |
11 'http://', | |
12 'http://www.example.com/foo' | |
13 ]; | |
14 | |
15 function doNextFetchTest(port) { | |
16 if (testTargets.length == 0) { | |
17 port.postMessage('quit'); | |
18 // Destroying the execution context while fetch is happening should not cause a crash. | |
19 fetch('dummy.html').then(function() {}).catch(function() {}); | |
20 self.close(); | |
21 return; | |
22 } | |
23 var target = testTargets.shift(); | |
24 fetch(target) | |
25 .then(function() { | |
26 port.postMessage('Resolved: ' + target); | |
27 doNextFetchTest(port); | |
28 }).catch(function(e) { | |
29 port.postMessage('Rejected: ' + target + ' : '+ e.message); | |
30 doNextFetchTest(port); | |
31 }) | |
dominicc (has gone to gerrit)
2014/06/16 06:07:50
Terminate the statement with a semicolon.
horo
2014/06/16 06:32:18
Done.
| |
32 } | |
OLD | NEW |