Skip to content

Commit c7ba397

Browse files
domenicAlice Boxhall
authored and
Alice Boxhall
committed
Add allow-top-navigation-by-user-activation sandbox token
Fixes WICG/interventions#42.
1 parent ac61720 commit c7ba397

File tree

1 file changed

+76
-18
lines changed

1 file changed

+76
-18
lines changed

source

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28453,8 +28453,9 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2845328453
data-x="attr-iframe-sandbox-allow-popups-to-escape-sandbox">allow-popups-to-escape-sandbox</code>,
2845428454
<code data-x="attr-iframe-sandbox-allow-presentation">allow-presentation</code>, <code
2845528455
data-x="attr-iframe-sandbox-allow-same-origin">allow-same-origin</code>, <code
28456-
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, and <code
28457-
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>.</p>
28456+
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, <code
28457+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>, and <code
28458+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>.</p>
2845828459

2845928460
<p>When the attribute is set, the content is treated as being from a unique <span>origin</span>,
2846028461
forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
@@ -28463,7 +28464,11 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2846328464
the content to be treated as being from its real origin instead of forcing it into a unique
2846428465
origin; the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>
2846528466
keyword allows the content to <span>navigate</span> its <span>top-level browsing context</span>;
28466-
and the <code data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
28467+
the <code
28468+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
28469+
keyword behaves similarly but only allows such <span data-x="navigate">navigation</span> when
28470+
<span>triggered by user activation</span>; and the <code
28471+
data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
2846728472
data-x="attr-iframe-sandbox-allow-modals">allow-modals</code>, <code
2846828473
data-x="attr-iframe-sandbox-allow-orientation-lock">allow-orientation-lock</code>, <code
2846928474
data-x="attr-iframe-sandbox-allow-pointer-lock">allow-pointer-lock</code>, <code
@@ -28476,6 +28481,13 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2847628481
context">auxiliary browsing contexts</span> respectively. <ref spec=POINTERLOCK>
2847728482
<ref spec=SCREENORIENTATION> <ref spec=PRESENTATION></p>
2847828483

28484+
<p>The <code
28485+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> and <code
28486+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
28487+
keywords must not both be specified, as doing so is redundant; only <code
28488+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> will have an effect
28489+
in such non-conformant markup.</p>
28490+
2847928491
<p class="warning">Setting both the <code
2848028492
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code> and <code
2848128493
data-x="attr-iframe-sandbox-allow-same-origin">allow-same-origin</code> keywords together when the
@@ -77280,11 +77292,23 @@ console.assert(iframeWindow.frameElement === null);
7728077292
document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed navigation
7728177293
browsing context flag</span> set, then abort these steps negatively.</p></li>
7728277294

77283-
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77284-
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>, and
77285-
<var>A</var>'s <span>active document</span>'s <span>active sandboxing flag set</span> has its
77286-
<span>sandboxed top-level navigation browsing context flag</span> set, then abort these steps
77287-
negatively.</p></li>
77295+
<li>
77296+
<p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77297+
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>,
77298+
then:</p>
77299+
77300+
<ol>
77301+
<li><p>If this algorithm is <span>triggered by user activation</span> and <var>A</var>'s
77302+
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
77303+
top-level navigation with user activation browsing context flag</span> set, then abort these
77304+
steps negatively.</p></li>
77305+
77306+
<li><p>Otherwise, If this algorithm is not <span>triggered by user activation</span> and
77307+
<var>A</var>'s <span>active document</span>'s <span>active sandboxing flag set</span> has its
77308+
<span>sandboxed top-level navigation without user activation browsing context flag</span> set,
77309+
then abort these steps negatively.</p></li>
77310+
</ol>
77311+
</li>
7728877312

7728977313
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is
7729077314
neither <var>A</var> nor one of the <span data-x="ancestor browsing context">ancestor
@@ -79615,7 +79639,8 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7961579639
<span data-x="auxiliary browsing context">auxiliary browsing contexts</span> (which are protected
7961679640
by the <span>sandboxed auxiliary navigation browsing context flag</span> defined next), and the
7961779641
<span>top-level browsing context</span> (which is protected by the <span>sandboxed top-level
79618-
navigation browsing context flag</span> defined below).</p>
79642+
navigation without user activation browsing context flag</span> and <span>sandboxed top-level
79643+
navigation with user activation browsing context flag</span> defined below).</p>
7961979644

7962079645
<p>If the <span>sandboxed auxiliary navigation browsing context flag</span> is not set, then in
7962179646
certain cases the restrictions nonetheless allow popups (new <span data-x="top-level browsing
@@ -79639,19 +79664,39 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7963979664
</dd>
7964079665

7964179666

79642-
<dt>The <dfn data-export="">sandboxed top-level navigation browsing context flag</dfn></dt>
79667+
<dt>The <dfn data-export="">sandboxed top-level navigation without user activation browsing
79668+
context flag</dfn></dt>
79669+
79670+
<dd>
79671+
79672+
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
79673+
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79674+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that are
79675+
<em>not</em> <span>triggered by user activation</span>.</p>
79676+
79677+
<p>When the <span>sandboxed top-level navigation without user activation browsing context
79678+
flag</span> is <em>not</em> set, content can navigate its <span>top-level browsing
79679+
context</span>, but other <span data-x="browsing context">browsing contexts</span> are still
79680+
protected by the <span>sandboxed navigation browsing context flag</span> and possibly
79681+
the <span>sandboxed auxiliary navigation browsing context flag</span>.</p>
79682+
79683+
</dd>
79684+
79685+
79686+
<dt>The <dfn data-export="">sandboxed top-level navigation with user activation browsing context
79687+
flag</dfn></dt>
7964379688

7964479689
<dd>
7964579690

7964679691
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
7964779692
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79648-
<span>top-level browsing context</span></a>.</p>
79693+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that
79694+
<em>are</em> <span>triggered by user activation</span>.</p>
7964979695

79650-
<p>When the <span>sandboxed top-level navigation browsing context flag</span> is <em>not</em>
79651-
set, content can navigate its <span>top-level browsing context</span>, but other <span
79652-
data-x="browsing context">browsing contexts</span> are still protected by the <span>sandboxed
79653-
navigation browsing context flag</span> and possibly the <span>sandboxed auxiliary navigation
79654-
browsing context flag</span>.</p>
79696+
<p>As with the <span>sandboxed top-level navigation without user activation browsing context
79697+
flag</span>, this flag only affects the <span>top-level browsing context</span>; if it is not
79698+
set, other <span data-x="browsing context">browsing contexts</span> might still be protected by
79699+
other flags.</p>
7965579700

7965679701
</dd>
7965779702

@@ -79811,8 +79856,21 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7981179856

7981279857
<li><p>The <span>sandboxed auxiliary navigation browsing context flag</span>, unless <var>tokens</var> contains the <dfn><code data-x="attr-iframe-sandbox-allow-popups">allow-popups</code></dfn> keyword.</p></li>
7981379858

79814-
<li><p>The <span>sandboxed top-level navigation browsing context flag</span>, unless <var>tokens</var> contains the <dfn><code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code></dfn>
79815-
keyword.</p></li>
79859+
<li><p>The <span>sandboxed top-level navigation without user activation browsing context flag</span>, unless
79860+
<var>tokens</var> contains the <dfn><code
79861+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code></dfn> keyword.</p></li>
79862+
79863+
<li>
79864+
<p>The <span>sandboxed top-level navigation with user activation browsing context flag</span>, unless
79865+
<var>tokens</var> contains either the <dfn><code
79866+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code></dfn>
79867+
keyword or the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> keyword.</p>
79868+
79869+
<p class="note">This means that if the <code
79870+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> is present, the <code
79871+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
79872+
keyword will have no effect. For this reason, specifying both is a document conformance error.</p>
79873+
</li>
7981679874

7981779875
<li><p>The <span>sandboxed plugins browsing context flag</span>.</p></li>
7981879876

0 commit comments

Comments
 (0)