Contact emails
[email protected]

Explainer
https://crbug.com/584504247


Specification
https://w3c.github.io/ServiceWorker/#dom-routersourceenum-race-network-and-fetch-handler


Summary
When a Service Worker matches a Static Routing rule with 
'race-network-and-fetch-handler' and calls fetch(event.request) inside its 
fetch handler, Chromium deduplicates the network request. If that raced request 
is cancelled before response headers arrive (net::ERR_ABORTED)—for example, 
when an offline fallback timer resolves event.respondWith() first or the 
navigation is aborted—Chromium now rejects the fetch(event.request) promise 
with TypeError("The service worker race-network-and-fetch-handler request was 
cancelled before 'fetch()' settled.") instead of the generic TypeError("Failed 
to fetch"). This matches Service Worker Navigation Preload 
(event.preloadResponse) and allows web applications to distinguish expected 
pre-settlement race cancellations from genuine network errors. Note: This is a 
small behavioral refinement to the already-shipped Service Worker Static 
Routing API with no IDL or specification changes. Because web applications may 
observe the updated TypeError message string, we are sending an Intent to Ship 
directly for web compatibility review.


Blink component
Blink>ServiceWorker


Web Feature ID
service-workers-static-routes


Motivation
In Service Worker Navigation Preload (event.preloadResponse), Chromium already 
distinguishes pre-settlement cancellation (net::ERR_ABORTED) from genuine 
network failures by rejecting event.preloadResponse with "The service worker 
navigation preload request was cancelled before 'preloadResponse' settled.". 
Offline-capable web applications migrating from Navigation Preload to Static 
Routing ('race-network-and-fetch-handler') inspect this cancellation message to 
suppress expected cancellation noise in client error telemetry while still 
alerting on genuine network outages. Because 'race-network-and-fetch-handler' 
currently collapses net::ERR_ABORTED into TypeError("Failed to fetch"), 
migrating causes false-positive network error spikes and triggers unnecessary 
offline fallback paths.


Initial public proposal
No information provided


TAG review
No information provided


TAG review status
Not applicable


Goals for experimentation
None


Risks




Interoperability and Compatibility
Low. Fetch only specifies rejecting the promise with a TypeError on network 
errors, and Web IDL explicitly leaves simple exception message strings 
implementation-defined. Browser engines already use distinct TypeError messages 
for fetch() failures. This change only affects fetch() calls inside a Service 
Worker that match a 'race-network-and-fetch-handler' rule and fail specifically 
with net::ERR_ABORTED prior to response headers.

Gecko: No signal

WebKit: No signal

Web developers: Positive Requested by web applications migrating from 
Navigation Preload to Service Worker Static Routing 
'race-network-and-fetch-handler'.

Other signals:


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it 
has potentially high risk for Android WebView-based applications?
None



Debuggability
Improves debuggability for developers using Service Worker Static Routing 
('race-network-and-fetch-handler') by distinguishing pre-settlement request 
cancellation from genuine network failures in console logs and exception 
handlers, matching Navigation Preload.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, 
ChromeOS, Android, and Android WebView)?
Yes


Is this feature fully tested by web-platform-tests?
No
Because TypeError message strings are implementation-defined and vary across 
browser engines, WPT only asserts the exception type. Tested in Chromium 
browser tests (content/browser/service_worker/service_worker_browsertest.cc) 
and Blink unit tests 
(third_party/blink/renderer/modules/service_worker/service_worker_global_scope_test.cc).


Flag name on about://flags
No information provided


Finch feature name
ServiceWorkerRaceNetworkRequestAbortedErrorMessage


Rollout plan
Will ship enabled for all users


Requires code in //chrome?
False


Tracking bug
https://crbug.com/584504247


Estimated milestones


Shipping on desktop 159

Shipping on Android 159

Shipping on WebView 159




Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop 
issues. Please list open issues (eg links to known github issues in the project 
for the feature specification) whose resolution may introduce web 
compat/interop risk (eg, changing to naming or structure of the API in a 
non-backward-compatible way).
None. The fetch spec (https://fetch.spec.whatwg.org/#dom-global-fetch) only 
specifies rejecting the promise with a TypeError on network errors, and Web IDL 
(https://webidl.spec.whatwg.org/#dfn-create-exception) explicitly leaves simple 
exception message strings implementation-defined.


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5124748525830144?gate=6639049170354176


This intent message was generated by Chrome Platform Status.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/6af42035.c4d90b0f.20186.0030.GAE%40google.com.

Reply via email to