Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js |
index fc64e6ce567e3371ea9996d46d1cad76a66e5c88..40a4cbba2a2f10176f6461f1758086509e81185a 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js |
@@ -50,12 +50,24 @@ self.addEventListener('message', function(event) { |
}); |
self.addEventListener('fetch', function(event) { |
- var resolveFetch; |
- let response = new Promise((res) => { resolveFetch = res; }); |
- event.respondWith(response); |
- async_task_waituntil(event) |
- .then(reportResultExpecting('OK')) |
- .then(() => { resolveFetch(new Response('OK')); }); |
+ if (event.request.url.indexOf('pending-respondwith-async-waituntil') != -1) { |
+ var resolveFetch; |
+ let response = new Promise((res) => { resolveFetch = res; }); |
+ event.respondWith(response); |
+ async_task_waituntil(event) |
+ .then(reportResultExpecting('OK')) |
+ .then(() => { resolveFetch(new Response('OK')); }); |
+ } else if (event.request.url.indexOf('respondwith-microtask-sync-waituntil') != -1) { |
+ response = Promise.resolve(new Response('RESP')); |
+ event.respondWith(response); |
+ response.then(() => { return sync_waituntil(event); }) |
+ .then(reportResultExpecting('OK')) |
+ } else if (event.request.url.indexOf('respondwith-microtask-async-waituntil') != -1) { |
+ response = Promise.resolve(new Response('RESP')); |
+ event.respondWith(response); |
+ response.then(() => { return async_microtask_waituntil(event); }) |
+ .then(reportResultExpecting('InvalidStateError')) |
+ } |
}); |
function reportResultExpecting(expectedResult) { |