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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/worker.js

Issue 2684933011: M57: Add UseCounter for ServiceWorkerNavigationPreload. (Closed)
Patch Set: Created 3 years, 10 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/navigation-preload/chromium/resources/worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..7fddbc3f4393b8f2bb8c62ecde366a8fbcee116f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/worker.js
@@ -0,0 +1,12 @@
+self.addEventListener('activate', e => {
+ if (self.location.search == '?no-preload')
+ return;
+ e.waitUntil(self.registration.navigationPreload.enable());
+ });
+
+self.addEventListener('fetch', e => {
+ if (e.request.url.endsWith('passthrough'))
+ return;
+ if (e.request.url.endsWith('respondWith'))
+ e.respondWith(e.preloadResponse);
+ });

Powered by Google App Engine
This is Rietveld 408576698