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

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

Issue 2933463002: [Merge to M59] Keep the wrapper of FetchEvent alive while waiting for the preload response. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/navigation-preload-gc-before-response-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/navigation-preload-gc-before-response-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/navigation-preload-gc-before-response-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..73341c6efbcaa54d3f1b52fcfa3b0bd99727a295
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/chromium/resources/navigation-preload-gc-before-response-worker.js
@@ -0,0 +1,10 @@
+self.addEventListener('activate', e => {
+ e.waitUntil(self.registration.navigationPreload.enable());
+ });
+
+self.addEventListener('fetch', e => {
+ setTimeout(_ => { internals.collectGarbage(); }, 0);
+ e.respondWith(
+ e.preloadResponse
+ .then(response => { return response; }));
+ });

Powered by Google App Engine
This is Rietveld 408576698