Skip to content

Commit 7070b90

Browse files
committed
Handle request's window when from browser UI
In whatwg/html#11250 we are working to specify browser UI-initiated navigations better. Without this change, it is unclear what to set their request's window to. They will have null clients, so "client" is not appropriate. They will show prompts, so "no-window" is not appropriate. And setting it to whatever's shown currently in the being-navigated window is not correct. This introduces a new value, "from-browser-ui", which indicates that browser UI is initiating the request, and so any prompts should still be shown, but on a neutral backdrop, not associated with a specific Window object.
1 parent 5a96806 commit 7070b90

File tree

1 file changed

+49
-21
lines changed

1 file changed

+49
-21
lines changed

fetch.bs

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,17 +1666,48 @@ 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>window</dfn>, that is "<code>no-window</code>",
1670+
"<code>from-browser-ui</code>", "<code>client</code>", or an <a>environment settings object</a>
1671+
whose <a for="environment settings object">global object</a> is a {{Window}} object. Unless stated
1672+
otherwise it is "<code>client</code>".
1673+
1674+
<div class=note>
1675+
<p>This is used to determine whether and where to show necessary UI for the request, such as
1676+
authentication prompts or client certificate dialogs.
1677+
1678+
<dl>
1679+
<dt>"<code>no-window</code>"
1680+
<dd>No UI is shown; usually the request fails with a <a>network error</a>.
16751681

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>.
1682+
<dt>"<code>from-browser-ui</code>"
1683+
<dd>This request was initiated by browser UI, and so any UI shown will not be associated to a
1684+
specific window.
1685+
1686+
<dt>"<code>client</code>"
1687+
<dd>This value will automatically be changed to either "<code>no-window</code>" or the request's
1688+
<a for=request>client</a> during <a lt=fetch for=/>fetching</a>. This provides a convenient way
1689+
for standards to not have to explicitly set a request's <a for=request>window</a>.
1690+
1691+
<dt>an <a>environment settings object</a>
1692+
<dd>The UI shown will be associated with the specified {{Window}} object.
1693+
</dl>
1694+
</div>
1695+
1696+
<p>The <dfn for=request>appropriate user prompt context</dfn> for a <a for=/>request</a>
1697+
<var>request</var> is determined as follows:
1698+
1699+
<ol>
1700+
<li><p><a>Assert</a>: <var>request</var>'s <a for=request>window</a> is not "<code>client</code>".
1701+
1702+
<li><p>If the request's <a for=request>window</a> is an <a>environment settings object</a>, then
1703+
the prompt should occur in a way attributable to <var>request</var>'s <a for=request>window</a>.
1704+
1705+
<li><p>Otherwise, if <var>request</var>'s <a for=request>window</a> is
1706+
"<code>from-browser-ui</code>", then the prompt should occur in a neutral context, e.g., on top of
1707+
a blank page.
1708+
1709+
<li><p>Otherwise, there is no appropriate user prompt context.
1710+
</ol>
16801711

16811712
<p id=keep-alive-flag>A <a for=/>request</a> has an associated boolean
16821713
<dfn for=request export id=request-keepalive-flag>keepalive</dfn>. Unless stated otherwise it is
@@ -5919,8 +5950,8 @@ run these steps:
59195950
<li>
59205951
<p>If <var>response</var>'s <a for=response>status</a> is 401, <var>httpRequest</var>'s
59215952
<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:
5953+
true, and <var>request</var>'s <a for=request>window</a> is either an
5954+
<a>environment settings object</a> or "<code>from-browser-ui</code>":
59245955

59255956
<ol>
59265957
<li class=XXX><p>Needs testing: multiple `<code>WWW-Authenticate</code>` headers, missing,
@@ -5947,8 +5978,8 @@ run these steps:
59475978
<a for=/>appropriate network error</a> for <var>fetchParams</var>.
59485979

59495980
<li><p>Let <var>username</var> and <var>password</var> be the result of prompting the end user
5950-
for a username and password, respectively, in <var>request</var>'s
5951-
<a for=request>window</a>.
5981+
for a username and password, respectively, in the <a>appropriate user prompt context</a> for
5982+
<var>request</var>.
59525983

59535984
<li><p><a>Set the username</a> given <var>request</var>'s <a for=request>current URL</a> and
59545985
<var>username</var>.
@@ -5975,9 +6006,8 @@ run these steps:
59756006
<a for=/>appropriate network error</a> for <var>fetchParams</var>.
59766007

59776008
<li>
5978-
<p>Prompt the end user as appropriate in <var>request</var>'s
5979-
<a for=request>window</a> and store the result as a
5980-
<a>proxy-authentication entry</a>. [[!HTTP]]
6009+
<p>Prompt the end user as appropriate, in the <a>appropriate user prompt context</a> for
6010+
<var>request</var>, and store the result as a <a>proxy-authentication entry</a>. [[!HTTP]]
59816011

59826012
<p class=note>Remaining details surrounding proxy authentication are defined by HTTP.
59836013

@@ -6156,10 +6186,8 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
61566186
<p>If the HTTP request results in a TLS client certificate dialog, then:
61576187

61586188
<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>.
6189+
<li><p>If <var>request</var> has an <a>appropriate user prompt context</a>, then make the
6190+
dialog available in <var>request</var>'s <a>appropriate user prompt context</a>.
61636191

61646192
<li><p>Otherwise, return a <a>network error</a>.
61656193
</ol>

0 commit comments

Comments
 (0)