[w3c/ServiceWorker] Filter out no-cors requests from the race-network-request (PR #1757)

This will address the comment in https://github.com/whatwg/fetch/pull/1737#issuecomment-2385734506.

When "race-network-request" is matched as the router rule, the service worker starts a network request in parallel with dispatching the fetch event. The response is keyed by request and managed in [race response map](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-race-response-map). And the fetch API will check this map whether the request is already started by the service worker, and use its response if the corresponding entry is found.

We use [ok-status](https://fetch.spec.whatwg.org/#ok-status) to tell if the response is successful or not, and use the response only when the status is ok-status. This is needed to support the offline capability. However, with the request mode "no-cors", the response will be [filtered](https://fetch.spec.whatwg.org/#concept-filtered-response-opaque). The filtered response's status is always 0, so this is handled as a failure in "race-network-request" even without this change. But it would be better that we explicitly filter out "no-cors" in the handle fetch algorithm.

Once we get an agreement to this change, I'll add a WPT and fix Chrome behavior.


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://pr-preview.s3.amazonaws.com/sisidovski/ServiceWorker/pull/1757.html" title="Last updated on Mar 3, 2025, 9:16 AM UTC (7e1ce69)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/ServiceWorker/1757/1d795e2...sisidovski:7e1ce69.html" title="Last updated on Mar 3, 2025, 9:16 AM UTC (7e1ce69)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/ServiceWorker/pull/1757

-- Commit Summary --

  * Filter out no-cors requests from the race-network-request

-- File Changes --

    M docs/index.bs (3)

-- Patch Links --

https://github.com/w3c/ServiceWorker/pull/1757.patch
https://github.com/w3c/ServiceWorker/pull/1757.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1757
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/pull/1757@github.com>

Received on Monday, 3 March 2025 09:16:35 UTC