Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/fetch-worker.js

Issue 318393002: Initial implementation of ServiceWorkerGlobalScope.fetch() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for destroying the execution context while fetch is happening. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698