Skip to content

Commit 62f4e9d

Browse files
committed
Compute "has transient activation" synchronously in navigation
Helps with #1130 by removing more deep-in-the-algorithm-tree uses of source browsing context.
1 parent 22e821b commit 62f4e9d

File tree

1 file changed

+53
-35
lines changed

1 file changed

+53
-35
lines changed

source

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -84625,6 +84625,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8462584625
download</span> algorithm given the <span>source browsing context</span> and
8462684626
<var>browsingContext</var>.</p></li>
8462784627

84628+
<li><p>Let <var>hasTransientActivation</var> be true if the <span>source browsing
84629+
context</span>'s <span>active window</span> has <span>transient activation</span>; otherwise
84630+
false.</p></li>
84631+
8462884632
<li><p>Return to whatever algorithm invoked the navigation steps and continue running these steps
8462984633
<span>in parallel</span>.</p></li>
8463084634

@@ -84679,7 +84683,8 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8467984683
handling</span> is <var>historyHandling</var>.</p></li>
8468084684

8468184685
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
84682-
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
84686+
<var>allowedToDownload</var>, <var>hasTransientActivation</var>, and
84687+
<var>navigationParams</var>.</p></li>
8468384688
</ol>
8468484689
</dd>
8468584690

@@ -84730,7 +84735,8 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8473084735
handling</span> is <var>historyHandling</var>.</p></li>
8473184736

8473284737
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
84733-
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
84738+
<var>allowedToDownload</var>, <var>hasTransientActivation</var>, and
84739+
<var>navigationParams</var>.</p></li>
8473484740
</ol>
8473584741

8473684742
<p class="example">So for example a <span data-x="javascript
@@ -84749,15 +84755,17 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8474984755
is a <span>fetch scheme</span></dt>
8475084756
<dd><p>Run <span>process a navigate fetch</span> given <var>resource</var>, the <span>source
8475184757
browsing context</span>, <var>browsingContext</var>, <var>navigationType</var>,
84752-
<var>sandboxFlags</var>, <var>allowedToDownload</var>, <var>incumbentNavigationOrigin</var>,
84753-
<var>activeDocumentNavigationOrigin</var>, and <var>historyHandling</var>.</p></dd>
84758+
<var>sandboxFlags</var>, <var>allowedToDownload</var>, <var>hasTransientActivation</var>,
84759+
<var>incumbentNavigationOrigin</var>, <var>activeDocumentNavigationOrigin</var>, and
84760+
<var>historyHandling</var>.</p></dd>
8475484761

8475584762
<dt>Otherwise, <var>resource</var> is a <span data-x="concept-request">request</span> whose
8475684763
<span data-x="concept-request-url">url</span>'s <span data-x="concept-url-scheme">scheme</span>
8475784764
is neither "<code data-x="javascript protocol">javascript</code>" nor a <span>fetch
8475884765
scheme</span></dt>
8475984766
<dd><p>Run <span>process a navigate URL scheme</span> given <var>resource</var>'s <span
84760-
data-x="concept-request-url">url</span> and <var>browsingContext</var>.</p></dd>
84767+
data-x="concept-request-url">url</span>, <var>browsingContext</var>, and
84768+
<var>hasTransientActivation</var>.</p></dd>
8476184769
</dl>
8476284770
</li>
8476384771
</ol>
@@ -84766,9 +84774,10 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8476684774
data-x="concept-request">request</span> <var>request</var>, two <span data-x="browsing
8476784775
context">browsing contexts</span> <var>sourceBrowsingContext</var> and <var>browsingContext</var>,
8476884776
a string <var>navigationType</var>, a <span>sandboxing flag set</span> <var>sandboxFlags</var>, a
84769-
boolean <var>allowedToDownload</var>, two <span data-x="origin">origins</span>
84770-
<var>incumbentNavigationOrigin</var> and <var>activeDocumentNavigationOrigin</var>, and a
84771-
<span>history handling behavior</span> <var>historyHandling</var>:</p>
84777+
boolean <var>allowedToDownload</var>, a boolean <var>hasTransientActivation</var>, two <span
84778+
data-x="origin">origins</span> <var>incumbentNavigationOrigin</var> and
84779+
<var>activeDocumentNavigationOrigin</var>, and a <span>history handling behavior</span>
84780+
<var>historyHandling</var>:</p>
8477284781

8477384782
<ol>
8477484783
<li><p>Let <var>response</var> be null.</p></li>
@@ -84784,8 +84793,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8478484793
<var>browsingContext</var>'s <span>active document</span>'s <span>relevant settings
8478584794
object</span>'s <span data-x="concept-environment-id">id</span>.</p></li>
8478684795

84787-
<li><p>If <var>sourceBrowsingContext</var>'s <code>WindowProxy</code>'s [[Window]] value has
84788-
<span>transient activation</span>, then set <var>request</var>'s <span
84796+
<li><p>If <var>hasTransientActivation</var> is true, then set <var>request</var>'s <span
8478984797
data-x="concept-request-user-activation">user-activation</span> to true.</p></li>
8479084798

8479184799
<li>
@@ -84808,7 +84816,7 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8480884816

8480984817
<li><p>Let <var>currentContextIsSource</var> be the result of whether
8481084818
<var>browsingContext</var>'s <span>active document</span> is <span>same origin</span> with
84811-
<var>source</var>'s <span>active document</span>.</p></li>
84819+
<var>sourceBrowsingContext</var>'s <span>active document</span>.</p></li>
8481284820

8481384821
<li><p>Let <var>coopEnforcementResult</var> be a new <span
8481484822
data-x="coop-enforcement-result">cross-origin opener policy enforcement result</span> whose <span
@@ -85001,12 +85009,20 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8500185009
<span>process a navigate fetch</span> with a new <span data-x="concept-request">request</span>
8500285010
whose <span data-x="concept-request-url">url</span> is <var>locationURL</var>,
8500385011
<var>sourceBrowsingContext</var>, <var>browsingContext</var>, <var>navigationType</var>,
85004-
<var>allowedToDownload</var>, <var>sandboxFlags</var>, <var>incumbentNavigationOrigin</var>,
85005-
<var>activeDocumentNavigationOrigin</var>, and <var>historyHandling</var>, and return.
85012+
<var>allowedToDownload</var>, <var>hasTransientActivation</var>, <var>sandboxFlags</var>,
85013+
<var>incumbentNavigationOrigin</var>, <var>activeDocumentNavigationOrigin</var>, and
85014+
<var>historyHandling</var>, and return.
8500685015

85007-
<li><p>Otherwise, if <var>locationURL</var> is a <span>URL</span>, run the <span>process a
85008-
navigate URL scheme</span> given <var>locationURL</var> and <var>browsingContext</var>, and
85009-
return.</p></li>
85016+
<li>
85017+
<p>Otherwise, if <var>locationURL</var> is a <span>URL</span>:</p>
85018+
85019+
<ol>
85020+
<li><p><span>Process a navigate URL scheme</span> given <var>locationURL</var>,
85021+
<var>browsingContext</var>, and <var>hasTransientActivation</var>.</p></li>
85022+
85023+
<li><p>Return.</p></li>
85024+
</ol>
85025+
</li>
8501085026

8501185027
<li><p>Let <var>navigationParams</var> be a new <span>navigation params</span> whose <span
8501285028
data-x="navigation-params-request">request</span> is <var>request</var>, <span
@@ -85024,12 +85040,13 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8502485040
<var>historyHandling</var>.</p></li>
8502585041

8502685042
<li><p>Run <span>process a navigate response</span> with <var>navigationType</var>,
85027-
<var>allowedToDownload</var>, and <var>navigationParams</var>.</p></li>
85043+
<var>allowedToDownload</var>, <var>hasTransientActivation</var>, and
85044+
<var>navigationParams</var>.</p></li>
8502885045
</ol>
8502985046

8503085047
<p>To <dfn export>process a navigate response</dfn>, given a string <var>navigationType</var>, a
85031-
boolean <var>allowedToDownload</var>, and a <span>navigation params</span>
85032-
<var>navigationParams</var>:</p>
85048+
boolean <var>allowedToDownload</var>, a boolean <var>hasTransientActivation</var>, and a
85049+
<span>navigation params</span> <var>navigationParams</var>:</p>
8503385050

8503485051
<ol>
8503585052
<li><p>Let <var>response</var> be <var>navigationParams</var>'s <span
@@ -85171,18 +85188,20 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8517185188

8517285189
<li><p>Otherwise, the document's <var>type</var> is such that the resource will not affect
8517385190
<var>browsingContext</var>, e.g., because the resource is to be handed to an external application
85174-
or because it is an unknown type that will be processed <span>as a download</span>. <span
85175-
data-x="hand-off to external software">Process the resource appropriately</span>.</p>
85191+
or because it is an unknown type that will be processed <span>as a download</span>.
85192+
<span>Hand-off to external software</span> given <var>response</var> and
85193+
<var>hasTransientActivation</var>.</p></li>
8517685194
</ol>
8517785195

85178-
<p>To <dfn>process a navigate URL scheme</dfn>, given a <span>URL</span> <var>url</var> and
85179-
<span>browsing context</span> <var>browsingContext</var>, run these steps:</p>
85196+
<p>To <dfn>process a navigate URL scheme</dfn>, given a <span>URL</span> <var>url</var>, a
85197+
<span>browsing context</span> <var>browsingContext</var>, and a boolean
85198+
<var>hasTransientActivation</var>:</p>
8518085199

8518185200
<ol>
8518285201
<li><p>If <var>url</var> is to be handled using a mechanism that does not affect
8518385202
<var>browsingContext</var>, e.g., because <var>url</var>'s <span
85184-
data-x="concept-url-scheme">scheme</span> is handled externally, then <span data-x="hand-off to
85185-
external software">proceed with that mechanism instead</span>.</p></li>
85203+
data-x="concept-url-scheme">scheme</span> is handled externally, then <span>hand-off to external
85204+
software</span> given <var>url</var> and <var>hasTransientActivation</var>.</p></li>
8518685205

8518785206
<li>
8518885207
<p>Otherwise, <var>url</var> is to be handled by displaying some sort of inline content, e.g.,
@@ -85196,16 +85215,15 @@ interface <dfn>Location</dfn> { // but see also <a href="#the-location-interface
8519685215
</li>
8519785216
</ol>
8519885217

85199-
<p>When a resource is handled by <dfn data-x="hand-off to external software">passing its URL or
85200-
data to an external software package</dfn> separate from the user agent (e.g. handing a <code
85201-
data-x="mailto protocol">mailto:</code> URL to a mail client, or a Word document to a word
85202-
processor), user agents should attempt to mitigate the risk that this is an attempt to exploit the
85203-
target software, e.g. by prompting the user to confirm that the <span>source browsing
85204-
context</span>'s <span>active document</span>'s <span
85205-
data-x="concept-document-origin">origin</span> is to be allowed to invoke the specified software.
85206-
In particular, if the <span>navigate</span> algorithm was invoked when <span>source browsing
85207-
context</span>'s <span>active window</span> does not have <span>transient activation</span>, the
85208-
user agent should not invoke the external software package without prior user confirmation.</p>
85218+
<p>To <dfn>hand-off to external software</dfn> given a <span>URL</span> or <span
85219+
data-x="concept-response">response</span> <var>resource</var> and a boolean
85220+
<var>hasTransientActivation</var>, user agents should perform the appropriate handoff of
85221+
<var>resource</var> while attempting to mitigate the risk that this is an attempt to exploit the
85222+
target software. For example, user agents could prompt the user to confirm that the <span>source
85223+
browsing context</span>'s <span>active document</span>'s <span
85224+
data-x="concept-document-origin">origin</span> is to be allowed to invoke the external software in
85225+
question. In particular, if <var>hasTransientActivation</var> is false, then the user agent should
85226+
not invoke the external software package without prior user confirmation.</p>
8520985227

8521085228
<p class="example">For example, there could be a vulnerability in the target software's URL
8521185229
handler which a hostile page would attempt to exploit by tricking a user into clicking a link.</p>

0 commit comments

Comments
 (0)