Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5363,14 +5363,41 @@ returning a response directly, or allowing the request to proceed by returning n
<li><p>Let <var>isTopLevelNavigation</var> be true if <var>request</var>'s
<a for=request>destination</a> is "<code>document</code>"; otherwise, false.

<li><p>If <var>isTopLevelNavigation</var> is false and <var>requestEnvironment</var> is null,
then return a <a>network error</a>.
<li><p>Let <var>isTopLevelSelfFetch</var> be false.

<li><p>If <var>request</var>'s <a for=request>client</a> is non-null:
<ol>
<li><p>Let <var>global</var> be <var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">global object</a>.

<li>
<p>If all of the following conditions are true:

<ul class=brief>
<li><p><var>global</var> is a {{Window}} object;

<li><p><var>global</var>'s <a for=Window>navigable</a> is not null;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there are cases where this would be null and you can get this far into a fetch. Hmm.

Copy link
Member

@domfarolino domfarolino Nov 19, 2025

Choose a reason for hiding this comment

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

Specifically where client is non-null but not associated with a Window object? Would worker fetches count here? Maybe even navigation requests themselves, with their reserved client machinery...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mirrored this off of the logic in https://fetch.spec.whatwg.org/#populate-request-from-client, but I'm not certain that the cases there are possible here as well...


<li><p>Let <var>navigationOrEnvironment</var> be the string "<code>navigation</code>" if
<var>isTopLevelNavigation</var> is true; otherwise, <var>requestEnvironment</var>.
<li><p><var>global</var>'s <a for=Window>navigable</a>'s <a for=navigable>parent</a>
is null; and

<li><p><var>requestEnvironment</var>'s <a for="environment">creation URL</a>
<a for=url>equals</a> <var>request</var>'s <a for=request>current URL</a>,
</ul>

<p>then set <var>isTopLevelSelfFetch</var> to false.

<li><p>Let <var>stringOrEnvironment</var> be <var>requestEnvironment</var>.

<li><p>If <var>isTopLevelNavigation</var> is true, then set <var>stringOrEnvironment</var>
to the string "<code>navigation</code>".

<li><p>Otherwise, if <var>isTopLevelSelfFetch</var> is true, then set
<var>stringOrEnvironment</var> to the string "<code>top-level-self-fetch</code>".
</ol>

<li><p>Let <var>blob</var> be the result of <a>obtaining a blob object</a> given
<var>blobURLEntry</var> and <var>navigationOrEnvironment</var>.
<var>blobURLEntry</var> and <var>stringOrEnvironment</var>.

<li><p>If <var>blob</var> is not a {{Blob}} object, then return a <a>network error</a>.

Expand Down