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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/mint-new-worker.php

Issue 2119143002: service worker: Wait for inflight requests before activating (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: private Created 4 years, 5 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/http/tests/serviceworker/resources/mint-new-worker.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/mint-new-worker.php b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/mint-new-worker.php
new file mode 100644
index 0000000000000000000000000000000000000000..2189e99fd00fa71351242ebe711d81de1476fb15
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/mint-new-worker.php
@@ -0,0 +1,23 @@
+<?php
+// Mint a new worker each load.
+header("Cache-Control: no-cache, must-revalidate");
+header("Pragma: no-cache");
+header('Content-Type:application/javascript');
+echo "// " . microtime() . "\n";
+
+if ($_SERVER['QUERY_STRING'] == 'skip-waiting') {
+ echo "skipWaiting();\n";
+}
+?>
+onactivate = (e) => e.waitUntil(clients.claim());
+
+var resolve_wait_until;
+var wait_until = new Promise(resolve => {
+ resolve_wait_until = resolve;
+ });
+onmessage = (e) => {
+ if (e.data == 'wait')
+ e.waitUntil(wait_until);
+ if (e.data == 'go')
+ resolve_wait_until();
+ };

Powered by Google App Engine
This is Rietveld 408576698