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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-async-waituntil.js

Issue 2877543003: [ServiceWorker] Allow waitUntil to be called multiple times asynchronously (Closed)
Patch Set: Address comments from falken@ Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698