Skip to content

Commit cd1da21

Browse files
committed
Replace request's "window" with "traversable for user prompts"
After much discussion in #1820 and #1821, this seems to be more correct. Closes #1820. Closes #1821. Helps whatwg/html#11250 specify browser-initiated navigations better.
1 parent 5a96806 commit cd1da21

File tree

1 file changed

+88
-43
lines changed

1 file changed

+88
-43
lines changed

fetch.bs

+88-43
Original file line numberDiff line numberDiff line change
@@ -1666,17 +1666,38 @@ of the <a for="environment">target browsing context</a>'s <a>active document</a>
16661666
<a>environment settings object</a>.
16671667

16681668
<p>A <a for=/>request</a> has an associated
1669-
<dfn export for=request id=concept-request-window>window</dfn>
1670-
("<code>no-window</code>", "<code>client</code>", or an
1671-
<a>environment settings object</a> whose
1672-
<a for="environment settings object">global object</a> is a
1673-
{{Window}} object). Unless stated otherwise it is
1674-
"<code>client</code>".
1669+
<dfn export for=request id=concept-request-window>traversable for user prompts</dfn>, that is
1670+
"<code>no-traversable</code>", "<code>client</code>", or a <a for=/>traversable navigable</a>.
1671+
Unless stated otherwise it is "<code>client</code>".
1672+
1673+
<div class=note>
1674+
<p>This is used to determine whether and where to show necessary UI for the request, such as
1675+
authentication prompts or client certificate dialogs.
1676+
1677+
<dl>
1678+
<dt>"<code>no-traversable</code>"
1679+
<dd>No UI is shown; usually the request fails with a <a>network error</a>.
1680+
1681+
<dt>"<code>client</code>"
1682+
<dd>This value will automatically be changed to either "<code>no-traversable</code>" or to a
1683+
<a for=/>traversable navigable</a> derived from the request's <a for=request>client</a> during
1684+
<a lt=fetch for=/>fetching</a>. This provides a convenient way for standards to not have to
1685+
explicitly set a request's <a for=request>traversable for user prompts</a>.
1686+
1687+
<dt>a <a for=/>traversable navigable</a>
1688+
<dd>The UI shown will be associated with the browser interface elements that are displaying that
1689+
<a for=/>traversable navigable</a>.
1690+
</dl>
1691+
</div>
16751692

1676-
<p class=note>The "<code>client</code>" value is changed to "<code>no-window</code>" or
1677-
<a for=/>request</a>'s <a for=request>client</a> during <a lt=fetch for=/>fetching</a>. It provides
1678-
a convenient way for standards to not have to explicitly set <a for=/>request</a>'s
1679-
<a for=request>window</a>.
1693+
<p>When displaying a user interface associated with a request in that request's
1694+
<a for=request>traversable for user prompts</a>, the user agent should update the address bar to
1695+
display something derived from the request's <a for=request>current URL</a> (and not, e.g., leave
1696+
it at its previous value, derived from the URL of the request's initiator). Additionally, the user
1697+
agent should avoid displaying content from the request's initiator in the
1698+
<a for=request>traversable for user prompts</a>, especially in the case of cross-origin requests.
1699+
Displaying a blank page behind such prompts is a good way to fulfill these requirements. Failing to
1700+
follow these guidelines can confuse users as to which origin is responsible for the prompt.
16801701

16811702
<p id=keep-alive-flag>A <a for=/>request</a> has an associated boolean
16821703
<dfn for=request export id=request-keepalive-flag>keepalive</dfn>. Unless stated otherwise it is
@@ -4334,7 +4355,8 @@ the response. [[!HTTP-CACHING]]
43344355
<li><p><var>request</var>'s <a for=request>mode</a> is "<code>same-origin</code>",
43354356
"<code>cors</code>", or "<code>no-cors</code>"
43364357

4337-
<li><p><var>request</var>'s <a for=request>window</a> is an <a>environment settings object</a>
4358+
<li><p><var>request</var>'s <a for=request>client</a>'s
4359+
<a for="environment settings object">global object</a> is a {{Window}} object
43384360

43394361
<li><p><var>request</var>'s <a for=request>method</a> is `<code>GET</code>`
43404362

@@ -4354,7 +4376,7 @@ the response. [[!HTTP-CACHING]]
43544376
<a for="fetch params">preloaded response candidate</a> to <var>response</var>.
43554377

43564378
<li><p>Let <var>foundPreloadedResource</var> be the result of invoking
4357-
<a>consume a preloaded resource</a> for <var>request</var>'s <a for=request>window</a>, given
4379+
<a>consume a preloaded resource</a> for <var>request</var>'s <a for=request>client</a>, given
43584380
<var>request</var>'s <a for=request>URL</a>, <var>request</var>'s <a for=request>destination</a>,
43594381
<var>request</var>'s <a for=request>mode</a>, <var>request</var>'s
43604382
<a for=request>credentials mode</a>, <var>request</var>'s <a for=request>integrity metadata</a>,
@@ -4439,15 +4461,36 @@ the response. [[!HTTP-CACHING]]
44394461
<p>To <dfn>populate request from client</dfn> given a <a for=/>request</a> <var>request</var>:
44404462

44414463
<ol>
4442-
<li><p>If <var>request</var>'s <a for=request>window</a> is "<code>client</code>", then: set
4443-
<var>request</var>'s <a for=request>window</a> to <var>request</var>'s <a for=request>client</a>
4444-
if <var>request</var>'s <a for=request>client</a>'s
4445-
<a for="environment settings object">global object</a> is a {{Window}} object; otherwise
4446-
"<code>no-window</code>".
4447-
4448-
<li><p>If <var>request</var>'s <a for=request>origin</a> is "<code>client</code>", then set
4449-
<var>request</var>'s <a for=request>origin</a> to <var>request</var>'s <a for=request>client</a>'s
4450-
<a for="environment settings object">origin</a>.
4464+
<li>
4465+
<p>If <var>request</var>'s <a for=request>traversable for user prompts</a> is "<code>client</code>":
4466+
4467+
<ol>
4468+
<li><p>Set <var>request</var>'s <a for=request>traversable for user prompts</a> to
4469+
"<code>no-traversable</code>".
4470+
4471+
<li>
4472+
<p>If <var>request</var>'s <a for=request>client</a> is non-null, then:
4473+
4474+
<ol>
4475+
<li><p>Let <var>global</var> be <var>request</var>'s <a for=request>client</a>'s
4476+
<a for="environment settings object">global object</a>.
4477+
4478+
<li><p>If <var>global</var> is a {{Window}} object, and <var>global</var>'s
4479+
<a for=Window>navigable</a> is not null, then set <var>request</var>'s
4480+
<a for=request>traversable for user prompts</a> to <var>global</var>'s <a for=Window>navigable</a>'s
4481+
<a for=navigable>traversable navigable</a>.
4482+
</ol>
4483+
</ol>
4484+
4485+
<li>
4486+
<p>If <var>request</var>'s <a for=request>origin</a> is "<code>client</code>":
4487+
4488+
<ol>
4489+
<li><p><a>Assert</a>: <var>request</var>'s <a for=request>client</a> is non-null.
4490+
4491+
<li><p>Set <var>request</var>'s <a for=request>origin</a> to <var>request</var>'s
4492+
<a for=request>client</a>'s <a for="environment settings object">origin</a>.
4493+
</ol>
44514494

44524495
<li>
44534496
<p>If <var>request</var>'s <a for=request>policy container</a> is "<code>client</code>":
@@ -5517,10 +5560,13 @@ run these steps:
55175560
<a for="fetch params">canceled</a>:
55185561

55195562
<ol>
5520-
<li><p>If <var>request</var>'s <a for=request>window</a> is "<code>no-window</code>" and
5521-
<var>request</var>'s <a for=request>redirect mode</a> is "<code>error</code>", then set
5522-
<var>httpFetchParams</var> to <var>fetchParams</var> and <var>httpRequest</var> to
5523-
<var>request</var>.
5563+
<li>
5564+
<p>If <var>request</var>'s <a for=request>traversable for user prompts</a> is "<code>no-traversable</code>" and
5565+
<var>request</var>'s <a for=request>redirect mode</a> is "<code>error</code>", then set
5566+
<var>httpFetchParams</var> to <var>fetchParams</var> and <var>httpRequest</var> to
5567+
<var>request</var>.
5568+
5569+
<p class=note>If user prompts are possible, then we need to clone <var>request</var> because ???
55245570

55255571
<li>
55265572
<p>Otherwise:
@@ -5919,8 +5965,8 @@ run these steps:
59195965
<li>
59205966
<p>If <var>response</var>'s <a for=response>status</a> is 401, <var>httpRequest</var>'s
59215967
<a for=request>response tainting</a> is not "<code>cors</code>", <var>includeCredentials</var> is
5922-
true, and <var>request</var>'s <a for=request>window</a> is an <a>environment settings object</a>,
5923-
then:
5968+
true, and <var>request</var>'s <a for=request>traversable for user prompts</a> is a
5969+
<a for=/>traversable navigable</a>:
59245970

59255971
<ol>
59265972
<li class=XXX><p>Needs testing: multiple `<code>WWW-Authenticate</code>` headers, missing,
@@ -5948,7 +5994,7 @@ run these steps:
59485994

59495995
<li><p>Let <var>username</var> and <var>password</var> be the result of prompting the end user
59505996
for a username and password, respectively, in <var>request</var>'s
5951-
<a for=request>window</a>.
5997+
<a for=request>traversable for user prompts</a>.
59525998

59535999
<li><p><a>Set the username</a> given <var>request</var>'s <a for=request>current URL</a> and
59546000
<var>username</var>.
@@ -5965,8 +6011,8 @@ run these steps:
59656011
<p>If <var>response</var>'s <a for=response>status</a> is 407, then:
59666012

59676013
<ol>
5968-
<li><p>If <var>request</var>'s <a for=request>window</a> is
5969-
"<code>no-window</code>", then return a <a>network error</a>.
6014+
<li><p>If <var>request</var>'s <a for=request>traversable for user prompts</a> is
6015+
"<code>no-traversable</code>", then return a <a>network error</a>.
59706016

59716017
<li class=XXX><p>Needs testing: multiple `<code>Proxy-Authenticate</code>` headers, missing,
59726018
parsing issues.
@@ -5976,7 +6022,7 @@ run these steps:
59766022

59776023
<li>
59786024
<p>Prompt the end user as appropriate in <var>request</var>'s
5979-
<a for=request>window</a> and store the result as a
6025+
<a for=request>traversable for user prompts</a> and store the result as a
59806026
<a>proxy-authentication entry</a>. [[!HTTP]]
59816027

59826028
<p class=note>Remaining details surrounding proxy authentication are defined by HTTP.
@@ -6156,10 +6202,9 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
61566202
<p>If the HTTP request results in a TLS client certificate dialog, then:
61576203

61586204
<ol>
6159-
<li><p>If <var>request</var>'s <a for=request>window</a>
6160-
is an <a>environment settings object</a>, make the dialog
6161-
available in <var>request</var>'s
6162-
<a for=request>window</a>.
6205+
<li><p>If <var>request</var>'s <a for=request>traversable for user prompts</a> is a
6206+
<a for=/>traversable navigable</a>, then make the dialog available in <var>request</var>'s
6207+
<a for=request>traversable for user prompts</a>.
61636208

61646209
<li><p>Otherwise, return a <a>network error</a>.
61656210
</ol>
@@ -7741,19 +7786,19 @@ constructor steps are:
77417786
<li><p>Let <var>origin</var> be <a>this</a>'s <a>relevant settings object</a>'s
77427787
<a for="environment settings object">origin</a>.
77437788

7744-
<li><p>Let <var>window</var> be "<code>client</code>".
7789+
<li><p>Let <var>traversableForUserPrompts</var> be "<code>client</code>".
77457790

7746-
<li><p>If <var>request</var>'s <a for=request>window</a> is
7747-
an <a>environment settings object</a> and its
7791+
<li><p>If <var>request</var>'s <a for=request>traversable for user prompts</a>
7792+
is an <a>environment settings object</a> and its
77487793
<a for="environment settings object">origin</a> is <a>same origin</a> with
7749-
<var>origin</var>, then set <var>window</var> to <var>request</var>'s
7750-
<a for=request>window</a>.
7794+
<var>origin</var>, then set <var>traversableForUserPrompts</var> to
7795+
<var>request</var>'s <a for=request>traversable for user prompts</a>.
77517796

77527797
<li><p>If <var>init</var>["{{RequestInit/window}}"] <a for=map>exists</a> and is non-null, then
77537798
<a>throw</a> a {{TypeError}}.
77547799

77557800
<li><p>If <var>init</var>["{{RequestInit/window}}"] <a for=map>exists</a>, then set
7756-
<var>window</var> to "<code>no-window</code>".
7801+
<var>traversableForUserPrompts</var> to "<code>no-traversable</code>".
77577802

77587803
<li>
77597804
<p>Set <var>request</var> to a new <a for=/>request</a> with the following properties:
@@ -7774,8 +7819,8 @@ constructor steps are:
77747819
<dt><a for=request>client</a>
77757820
<dd><a>This</a>'s <a>relevant settings object</a>.
77767821

7777-
<dt><a for=request>window</a>
7778-
<dd><var>window</var>.
7822+
<dt><a for=request>traversable for user prompts</a>
7823+
<dd><var>traversableForUserPrompts</var>.
77797824

77807825
<dt><a for=request>internal priority</a>
77817826
<dd><var>request</var>'s <a for=request>internal priority</a>.

0 commit comments

Comments
 (0)