Skip to content

Editorial: clarify FetchEvent clientId, resultingClientId, and replacesClientId initialization#1832

Merged
monica-ch merged 4 commits into
w3c:mainfrom
monica-ch:fetch-event-client-id-fixes
Jul 17, 2026
Merged

Editorial: clarify FetchEvent clientId, resultingClientId, and replacesClientId initialization#1832
monica-ch merged 4 commits into
w3c:mainfrom
monica-ch:fetch-event-client-id-fixes

Conversation

@monica-ch

@monica-ch monica-ch commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Aligns the Create Fetch Event and Dispatch algorithm and the FetchEvent.clientId / resultingClientId attribute definitions with actual browser behavior (Chrome, Firefox, Safari) and MDN.

Fixes #1267.

Changes

1. FetchEvent.clientId algorithm step

Previously the spec unconditionally initialized clientId from request's client, including for navigations. However, all major browsers return an empty string for clientId on navigation requests. Per @wanderview's suggestion:

My inclination is to probably implement resultingClientId and keep navigation clientId empty at first.

Before:

If |client| is not null, initialize |e|'s clientId attribute to |client|'s environment id.

After:

If |request| is a subresource request and |client| is not null, initialize |e|'s clientId attribute to |client|'s environment id.

2. FetchEvent.resultingClientId algorithm step

Adds an explicit reservedClient null check and removes the redundant "and to the empty string otherwise" clause (the IDL default already provides "").

3. FetchEvent.replacesClientId algorithm step

Removes the redundant "and to the empty string otherwise" clause for consistency with the sibling attributes.

4. Explanatory notes

Added descriptive notes for both FetchEvent.clientId and FetchEvent.resultingClientId attribute sections, documenting all cases where the value is the empty string. These match MDN's documented behavior.


Preview | Diff

…esClientId initialization

Aligns the Create Fetch Event and Dispatch algorithm with actual browser
behavior (Chrome, Firefox, Safari) and MDN documentation:

- FetchEvent.clientId is now only initialized for subresource requests
  when the request has a non-null client. For navigation and other
  non-subresource requests it stays at the IDL default (empty string).
  This matches wanderview's suggestion in issue w3c#1267.

- FetchEvent.resultingClientId now also checks that reservedClient is
  not null before initializing, and drops the redundant explicit
  `and to the empty string otherwise'' clause (the attribute default
  handles it).

- FetchEvent.replacesClientId drops the redundant `and to the empty
  string otherwise'' clause for consistency with the other two.

- Adds explanatory notes to the FetchEvent.clientId and
  FetchEvent.resultingClientId attribute sections describing the
  empty-string cases.

Fixes w3c#1267
@monica-ch
monica-ch marked this pull request as ready for review July 13, 2026 19:45
@monica-ch

Copy link
Copy Markdown
Collaborator Author

@yoshisatoyanagisawa Could you review these changes and let me know if this is the right approach for updating the spec?

Comment thread index.bs Outdated
Comment thread index.bs

@yoshisatoyanagisawa yoshisatoyanagisawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!
Thank you.

@monica-ch monica-ch closed this Jul 17, 2026
@monica-ch monica-ch reopened this Jul 17, 2026
@monica-ch
monica-ch merged commit 96e7a5e into w3c:main Jul 17, 2026
3 checks passed
github-actions Bot added a commit that referenced this pull request Jul 17, 2026
…esClientId initialization (#1832)

SHA: 96e7a5e
Reason: push, by monica-ch

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clarify when FetchEvent.clientId will or will not be set for navigations

2 participants