Skip to content
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

Compute "allowed to download" synchronously in navigation #6497

Merged
merged 1 commit into from
Mar 16, 2021
Merged
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
33 changes: 18 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -84617,6 +84617,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
flags</span> given <var>browsingContext</var> and <var>browsingContext</var>'s <span
data-x="bc-container">container</span>.</p></li>

<li><p>Let <var>allowedToDownload</var> be the result of running the <span>allowed to
download</span> algorithm given the <span>source browsing context</span> and
<var>browsingContext</var>.</p></li>

<li><p>Return to whatever algorithm invoked the navigation steps and continue running these steps
<span>in parallel</span>.</p></li>

Expand Down Expand Up @@ -84670,8 +84674,8 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<var>browsingContext</var>, and <span data-x="navigation-params-hh">history
handling</span> is <var>historyHandling</var>.</p></li>

<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>, the
<span>source browsing context</span>, and <var>navigationParams</var>.</p></li>
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a navigationParams? When we eventually move <a download> into navigation that might be simplified by this. Are you considering that it's part of navigation in practice as part of app history? See #5548.

Copy link
Member Author

Choose a reason for hiding this comment

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

So far I've kept navigationParams as only for the things that need to flow all the way into Document creation (so, they need to go from navigate -> process a navigate fetch -> process a navigate response -> page load processing model for X -> update the session history with a new page -> create and initialize a Document object).

As we pull more things off of source BC (e.g. user activation) the parameter lists for these "top-level" algorithms will grow a bit (e.g., things like this that need threading through the first three steps, navigate -> process a navigate fetch -> process a navigate response). At that point we might want to consider something more structured, such as renaming "navigation params" to "document creation params" and then using "navigation params" for these top-level things...

Good call on taking into account <a download> for app history. I'll open a tracking issue on the app history side to make sure that's tested and accounted for, and maybe I'll try to fix #5548 as part of this.

</ol>
</dd>

Expand Down Expand Up @@ -84721,8 +84725,8 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<var>browsingContext</var>, and <span data-x="navigation-params-hh">history
handling</span> is <var>historyHandling</var>.</p></li>

<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>, the
<span>source browsing context</span>, and <var>navigationParams</var>.</p></li>
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
</ol>

<p class="example">So for example a <span data-x="javascript
Expand All @@ -84741,7 +84745,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
is a <span>fetch scheme</span></dt>
<dd><p>Run <span>process a navigate fetch</span> given <var>resource</var>, the <span>source
browsing context</span>, <var>browsingContext</var>, <var>navigationType</var>,
<var>sandboxFlags</var>, <var>incumbentNavigationOrigin</var>,
<var>sandboxFlags</var>, <var>allowedToDownload</var>, <var>incumbentNavigationOrigin</var>,
<var>activeDocumentNavigationOrigin</var>, and <var>historyHandling</var>.</p></dd>

<dt>Otherwise, <var>resource</var> is a <span data-x="concept-request">request</span> whose
Expand All @@ -84757,10 +84761,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<p>To <dfn export>process a navigate fetch</dfn>, given a <span
data-x="concept-request">request</span> <var>request</var>, two <span data-x="browsing
context">browsing contexts</span> <var>sourceBrowsingContext</var> and <var>browsingContext</var>,
a string <var>navigationType</var>, a <span>sandboxing flag set</span> <var>sandboxFlags</var>,
two <span data-x="origin">origins</span> <var>incumbentNavigationOrigin</var> and
<var>activeDocumentNavigationOrigin</var>, and a <span>history handling behavior</span>
<var>historyHandling</var>:</p>
a string <var>navigationType</var>, a <span>sandboxing flag set</span> <var>sandboxFlags</var>, a
boolean <var>allowedToDownload</var>, two <span data-x="origin">origins</span>
<var>incumbentNavigationOrigin</var> and <var>activeDocumentNavigationOrigin</var>, and a
<span>history handling behavior</span> <var>historyHandling</var>:</p>

<ol>
<li><p>Let <var>response</var> be null.</p></li>
Expand Down Expand Up @@ -84993,7 +84997,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<span>process a navigate fetch</span> with a new <span data-x="concept-request">request</span>
whose <span data-x="concept-request-url">url</span> is <var>locationURL</var>,
<var>sourceBrowsingContext</var>, <var>browsingContext</var>, <var>navigationType</var>,
<var>sandboxFlags</var>, <var>incumbentNavigationOrigin</var>,
<var>allowedToDownload</var>, <var>sandboxFlags</var>, <var>incumbentNavigationOrigin</var>,
<var>activeDocumentNavigationOrigin</var>, and <var>historyHandling</var>, and return.

<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span>, run the <span>process a
Expand All @@ -85015,12 +85019,12 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
<var>browsingContext</var>, and <span data-x="navigation-params-hh">history handling</span> is
<var>historyHandling</var>.</p></li>

<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>, the
<span>source browsing context</span>, and <var>navigationParams</var>.</p></li>
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
</ol>

<p>To <dfn export>process a navigate response</dfn>, given a string <var>navigationType</var>, a
<span>browsing context</span> <var>source</var>, and a <span>navigation params</span>
boolean <var>allowedToDownload</var>, and a <span>navigation params</span>
<var>navigationParams</var>:</p>

<ol>
Expand Down Expand Up @@ -85087,8 +85091,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
data-x="">attachment</code> disposition type, then:</p>

<ol>
<li><p>If the result of running the <span>allowed to download</span> given <var>source</var>
and <var>browsingContext</var> is true, then handle <var>response</var> <span>as a
<li><p>If <var>allowedToDownload</var> is true, then handle <var>response</var> <span>as a
download</span>.</p></li>

<li><p>Return.</p></li>
Expand Down