Re: [w3c/ServiceWorker] Editorial: clarify FetchEvent clientId, resultingClientId, and replacesClientId initialization (PR #1832)

@monica-ch commented on this pull request.



> @@ -3410,9 +3414,9 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
               1. Initialize |e|’s {{Event/cancelable}} attribute to true.
               1. Initialize |e|’s {{FetchEvent/request}} attribute to |requestObject|.
               1. Initialize |e|’s {{FetchEvent/preloadResponse}} to |preloadResponse|.
-              1. Initialize |e|'s {{FetchEvent/clientId}} attribute to |client|'s [=environment/id=].
-              1. If |request| is a <a>non-subresource request</a> and |request|'s [=request/destination=] is not {{RequestDestination/"report"}}, initialize |e|'s {{FetchEvent/resultingClientId}} attribute to |reservedClient|'s [=environment/id=], and to the empty string otherwise.
-              1. If |request| is a <a>navigation request</a>, initialize |e|'s {{FetchEvent/replacesClientId}} attribute to |request|'s [=request/replaces client id=], and to the empty string otherwise.
+              1. If |client| is not null, initialize |e|'s {{FetchEvent/clientId}} attribute to |client|'s [=environment/id=].
+              1. If |request| is a <a>non-subresource request</a>, |request|'s [=request/destination=] is not {{RequestDestination/"report"}}, and |reservedClient| is not null, initialize |e|'s {{FetchEvent/resultingClientId}} attribute to |reservedClient|'s [=environment/id=].

Yes the step relies on it. resultingClientId is guaranteed to be "" before this step (IDL default FetchEventInit.resultingClientId = "" and the attribute dfn "must be initialized to the empty string" on event creation). That's why the step only conditionally sets a non-empty value, the "empty otherwise" case is covered by the pre-step default, so no explicit else clause is needed. Same pattern for clientId and replacesClientId.


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

Message ID: <w3c/ServiceWorker/pull/1832/review/4706784740@github.com>

Received on Wednesday, 15 July 2026 17:50:03 UTC