v151 · performance · service-worker · resource-timing
Resource Timing: Add spec-compliant Service Worker Router timing fields
Chrome 151 adds two new attributes to PerformanceResourceTiming (and PerformanceNavigationTiming): workerMatchedRouterSource and workerFinalRouterSource, which identify which Service Worker Static Router rule was matched and the final source used to fulfil the request.
at a glance
| Shipped in | Chrome 151 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Standards position (Firefox) | No signal |
| Standards position (Safari) | No signal |
| ChromeStatus | 5172259800088576 — Resource Timing: Add spec-compliant Service Worker Router timing fields |
background: Service Worker Static Routing
The Service Worker Static Routing API (shipped in Chrome 123) allows service workers to declare routing rules that short-circuit the fetch event, directing requests to the network, cache, or the fetch handler without waking the service worker. The RouterSource values identify where the final response came from: "network", "cache", "fetch-event", or "race-network-and-fetch-handler".
shape of the API
| Attribute | Interface | Description |
|---|---|---|
workerMatchedRouterSource | PerformanceResourceTiming, PerformanceNavigationTiming | The RouterSource of the Static Router rule that first matched this request (or "" if no rule matched) |
workerFinalRouterSource | PerformanceResourceTiming, PerformanceNavigationTiming | The RouterSource that ultimately served the response (may differ from matched if a race resolved differently) |
Deprecation note: The existing non-compliant fields workerMatchedSourceType and workerFinalSourceType will be deprecated in a separate future intent once usage data is collected.
example
// After a page load, inspect resource timing entries for SW router info
const entries = performance.getEntriesByType('resource');
for (const entry of entries) {
if (entry.workerMatchedRouterSource) {
console.log(
entry.name,
'→ matched:', entry.workerMatchedRouterSource,
'→ final:', entry.workerFinalRouterSource
);
// Example output:
// "/api/data.json" → matched: "race-network-and-fetch-handler" → final: "network"
}
}
// Navigation timing also includes these fields (Chrome 151+)
const [nav] = performance.getEntriesByType('navigation');
console.log('Nav router source:', nav.workerFinalRouterSource);
Source: chromestatus feature summary
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 151+ | Enabled by default | All platforms |
| Firefox | No signal | — |
| Safari | No signal | — |