← Back to release summary

ServiceWorkerStaticRouterTimingInfo

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

Summary

Adds timing information for ServiceWorker Static routing API, exposed in navigation timing API and resource timing API for developer use. Service Worker provides timing information to mark certain points in time. We add two Static routing API-relevant timing information: RouterEvaluationStart, time to start matching a request with registered router rules, and CacheLookupStart, time to start looking up the cache storage if the source is "cache". In addition, we also add two router source information, the matched router source and the final router source.

Motivation

Service Worker provides timing information to mark certain points in time. This is exposed and used by the navigation timing API as well as the resource timing API. It currently records two times: - Start time - Fetch event dispatch time However, it currently does not have any fields related to the ServiceWorker Static Routing API. Developers would benefit from having fields that provide information such as: - the matched route (the route that the Static Routing API evaluated) - the actual source from which the resource was retrieved - the time it took to match the route This information will allow developers to measure the latency incurred by the API such as router evaluation time or time required to conduct cache lookup, or determine if the matched source is the final source used (can find out if the matched source failed to get the resource or not, and which source was used as the alternative).

Standards & signals

Explainers: https://github.com/WICG/service-worker-static-routing-api/blob/main/resource-timing-api.md

View on chromestatus.com