Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/fetch-worker.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..636b541c15f6660607915061f6e3978b378e494e |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/resources/fetch-worker.js |
| @@ -0,0 +1,32 @@ |
| +self.onmessage = function(e) { |
| + var message = e.data; |
| + if ('port' in message) { |
| + port = message.port; |
| + doNextFetchTest(port); |
| + } |
| +}; |
| + |
| +var testTargets = [ |
| + 'other.html', |
| + 'http://', |
| + 'http://www.example.com/foo' |
| +]; |
| + |
| +function doNextFetchTest(port) { |
| + if (testTargets.length == 0) { |
| + port.postMessage('quit'); |
| + // Destroying the execution context while fetch is happening should not cause a crash. |
| + fetch('dummy.html').then(function() {}).catch(function() {}); |
| + self.close(); |
| + return; |
| + } |
| + var target = testTargets.shift(); |
| + fetch(target) |
| + .then(function() { |
| + port.postMessage('Resolved: ' + target); |
| + doNextFetchTest(port); |
| + }).catch(function(e) { |
| + port.postMessage('Rejected: ' + target + ' : '+ e.message); |
| + doNextFetchTest(port); |
| + }) |
|
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.
|
| +} |