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 return; |
| 19 } |
| 20 var target = testTargets.shift(); |
| 21 fetch(target) |
| 22 .then(function() { |
| 23 port.postMessage('Resolved: ' + target); |
| 24 doNextFetchTest(port); |
| 25 }).catch(function(e) { |
| 26 port.postMessage('Rejected: ' + target + ' : '+ e.message); |
| 27 doNextFetchTest(port); |
| 28 }) |
| 29 } |
OLD | NEW |