Skip to content

Improve "populate request from client" for null client cases #1820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
31 changes: 22 additions & 9 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4439,15 +4439,28 @@ the response. [[!HTTP-CACHING]]
<p>To <dfn>populate request from client</dfn> given a <a for=/>request</a> <var>request</var>:

<ol>
<li><p>If <var>request</var>'s <a for=request>window</a> is "<code>client</code>", then: set
<var>request</var>'s <a for=request>window</a> to <var>request</var>'s <a for=request>client</a>
if <var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">global object</a> is a {{Window}} object; otherwise
"<code>no-window</code>".

<li><p>If <var>request</var>'s <a for=request>origin</a> is "<code>client</code>", then set
<var>request</var>'s <a for=request>origin</a> to <var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">origin</a>.
<li>
<p>If <var>request</var>'s <a for=request>window</a> is "<code>client</code>":

<ol>
<li><p>If <var>request</var>'s <a for=request>client</a> is non-null and <var>request</var>'s
<a for=request>client</a>'s <a for="environment settings object">global object</a> is a
{{Window}} object, then set <var>request</var>'s <a for=request>window</a> to
<var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">global object</a>.

<li><p>Otherwise, set <var>request</var>'s <a for=request>window</a> to "<code>no-window</code>".
Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong for the null client case. Since I think a null client case is always a navigation (or perhaps something especially esoteric in the network stack) and thus would have a window to show dialogs in.

Copy link
Member Author

Choose a reason for hiding this comment

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

Upon reflection, I think most spec authors will use the null client case for things from the network stack. They won't necessarily be super-esoteric... just "browser features" like FedCM or similar.

So we might still want to do this automatically for them. Even if the browser UI navigation case goes a different path.

I'll leave this PR open in case we do want to go this route, and open a separate PR for the browser UI navigation path.

</ol>

<li>
<p>If <var>request</var>'s <a for=request>origin</a> is "<code>client</code>":

<ol>
<li><p><a>Assert</a>: <var>request</var>'s <a for=request>client</a> is non-null.

<li><p>Set <var>request</var>'s <a for=request>origin</a> to <var>request</var>'s
<a for=request>client</a>'s <a for="environment settings object">origin</a>.
</ol>

<li>
<p>If <var>request</var>'s <a for=request>policy container</a> is "<code>client</code>":
Expand Down