chromium/third_party/blink/web_tests/http/tests/serviceworker/navigation_preload/resources/worker.js

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);
  });