← Back to release summary

ServiceWorkerBypassFetchHandlerForMainResources

Category
Service Worker
Type
New or changed feature
Status
Origin trial (Chrome Origin trial)
Intent stage
None

Summary

ServiceWorkerBypassFetchHandlerForMainResource (ServiceWorker fetch fast-path), is a change to the service worker implementation designed to let the browser bypass fetch handlers when appropriate. With this feature, the request for the main resource will immediately happen without waiting for the ServiceWorker bootstrap and will also bypass the fetch handlers. The ServiceWorker is started at the same time as the request happens, but won’t intercept the request/response in the fetch handler. As a result, the browser can mitigate the bootstrap cost and the fetch handler execution.

Motivation

Normally, the ServiceWorker activation is triggered before sending a request if the resource is in the ServiceWorker’s scope. In other words, the bootstrap process typically blocks the actual request regardless of whether the resource actually needs to be handled by handlers or not. This is unfortunate in the cases where the fetch handlers do not need to handle the resource. What if there was a way to tell the browser in advance which resource requests can bypass the fetch handler? This is what the feature is about.

Standards & signals

Explainers: https://github.com/sisidovski/service-worker-bypass-fetch-handler-for-main-resource

View on chromestatus.com