Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 self.onmessage = function(e) { | 1 self.onmessage = function(e) { |
| 2 var message = e.data; | 2 var message = e.data; |
| 3 if ('port' in message) { | 3 if ('port' in message) { |
| 4 port = message.port; | 4 port = message.port; |
| 5 doNextFetchTest(port); | 5 doNextFetchTest(port); |
| 6 } | 6 } |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 var testTargets = [ | 9 var testTargets = [ |
| 10 'other.html', | 10 'other.html', |
| 11 'http://', | 11 'http://', |
| 12 'http://www.example.com/foo', | 12 'http://www.example.com/foo', |
| 13 'fetch-status.php?status=200', | 13 'fetch-status.php?status=200', |
| 14 'fetch-status.php?status=404' | 14 'fetch-status.php?status=404' |
| 15 ]; | 15 ]; |
| 16 | 16 |
| 17 function doNextFetchTest(port) { | 17 function doNextFetchTest(port) { |
| 18 if (testTargets.length == 0) { | 18 if (testTargets.length == 0) { |
| 19 port.postMessage('quit'); | 19 port.postMessage('quit'); |
| 20 // Destroying the execution context while fetch is happening should not cause a crash. | 20 // Destroying the execution context while fetch is happening should not cause a crash. |
| 21 fetch('dummy.html').then(function() {}).catch(function() {}); | 21 fetch('dummy.html').then(function() {}).catch(function() {}); |
| 22 self.close(); | 22 // FIXME: Since we can't ensure the context is torn down while |
|
horo
2014/08/27 02:24:50
Could you please add this method
function runInfi
jsbell
2014/08/27 16:27:09
Done. Let's see what the try bots think.
| |
| 23 // this fetch is outstanding, consider making it re-fetch on | |
| 24 // success. | |
| 23 return; | 25 return; |
| 24 } | 26 } |
| 25 var target = testTargets.shift(); | 27 var target = testTargets.shift(); |
| 26 fetch(target) | 28 fetch(target) |
| 27 .then(function(response) { | 29 .then(function(response) { |
| 28 port.postMessage('Resolved: ' + target + ' [' + response.status + ']' + response.statusText); | 30 port.postMessage('Resolved: ' + target + ' [' + response.status + ']' + response.statusText); |
| 29 doNextFetchTest(port); | 31 doNextFetchTest(port); |
| 30 }).catch(function(e) { | 32 }).catch(function(e) { |
| 31 port.postMessage('Rejected: ' + target + ' : '+ e.message); | 33 port.postMessage('Rejected: ' + target + ' : '+ e.message); |
| 32 doNextFetchTest(port); | 34 doNextFetchTest(port); |
| 33 }); | 35 }); |
| 34 }; | 36 }; |
| OLD | NEW |