Re: [w3c/ServiceWorker] Add race-network-and-cache source to static routing api. (PR #1764)

@yoshisatoyanagisawa commented on this pull request.



> +              1. Run the following substeps [=in parallel=]:
+                  1. [=map/For each=] |cacheName| → |cache| of the |registration|'s [=service worker registration/storage key=]'s [=name to cache map=]:
+                      1. If |source|["{{RouterSourceDict/raceNetworkAndCacheCacheName}}"] [=map/exists=] and |source|["{{RouterSourceDict/raceNetworkAndCacheCacheName}}"] [=string/is=] not |cacheName|, [=continue=].
+                      1. Let |requestResponses| be the result of running [=Query Cache=] with |request|, a new {{CacheQueryOptions}}, and |cache|.
+                      1. Let |globalObject| be null.
+                      1. If |requestResponses| is not an empty [=list=], then:
+                          1. Let |requestResponse| be the first element of |requestResponses|.
+                          1. Let |response| be |requestResponse|'s response.
+                          1. If |response|'s [=response/type=] is "`opaque`", and |globalObject| is null:
+                              1. Set |globalObject| to the result of running [=Setup ServiceWorkerGlobalScope=] with |activeWorker|.
+                          1. If |globalObject| is null, [=continue=].
+                          1. If |response|'s [=response/type=] is "`opaque`", and [=cross-origin resource policy check=] with |globalObject|'s [=environment settings object/origin=], |globalObject|, "", and |response|'s [=filtered response/internal response=] returns <b>blocked</b>, then [=continue=].
+                          1. [=queue/Enqueue=] |response| to |queue|.
+                          1. If |raceFetchController| is not null, [=fetch controller/abort=] |raceFetchController|.
+              1. Wait until |queue| is not empty.
+              1. If |queue| is empty, return null.

Thanks for the update.
The algorithm looks good except for the abort network scenario.
I want a spec expert to check the way to write the procedure down to specification.

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

Message ID: <w3c/ServiceWorker/pull/1764/review/2774578834@github.com>

Received on Thursday, 17 April 2025 05:01:06 UTC