Skip to content

Commit 0232b45

Browse files
committed
Add allow-top-navigation-by-user-activation sandbox token
Fixes WICG/interventions#42.
1 parent 296da73 commit 0232b45

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
@@ -28486,8 +28486,9 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2848628486
data-x="attr-iframe-sandbox-allow-popups-to-escape-sandbox">allow-popups-to-escape-sandbox</code>,
2848728487
<code data-x="attr-iframe-sandbox-allow-presentation">allow-presentation</code>, <code
2848828488
data-x="attr-iframe-sandbox-allow-same-origin">allow-same-origin</code>, <code
28489-
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, and <code
28490-
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>.</p>
28489+
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, <code
28490+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>, and <code
28491+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>.</p>
2849128492

2849228493
<p>When the attribute is set, the content is treated as being from a unique <span>origin</span>,
2849328494
forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
@@ -28496,7 +28497,11 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2849628497
the content to be treated as being from its real origin instead of forcing it into a unique
2849728498
origin; the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>
2849828499
keyword allows the content to <span>navigate</span> its <span>top-level browsing context</span>;
28499-
and the <code data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
28500+
the <code
28501+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
28502+
keyword behaves similarly but only allows such <span data-x="navigate">navigation</span> when
28503+
<span>triggered by user activation</span>; and the <code
28504+
data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
2850028505
data-x="attr-iframe-sandbox-allow-modals">allow-modals</code>, <code
2850128506
data-x="attr-iframe-sandbox-allow-orientation-lock">allow-orientation-lock</code>, <code
2850228507
data-x="attr-iframe-sandbox-allow-pointer-lock">allow-pointer-lock</code>, <code
@@ -28509,6 +28514,13 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2850928514
context">auxiliary browsing contexts</span> respectively. <ref spec=POINTERLOCK>
2851028515
<ref spec=SCREENORIENTATION> <ref spec=PRESENTATION></p>
2851128516

28517+
<p>The <code
28518+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> and <code
28519+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
28520+
keywords must not both be specified, as doing so is redundant; only <code
28521+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> will have an effect
28522+
in such non-conformant markup.</p>
28523+
2851228524
<p class="warning">Setting both the <code
2851328525
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code> and <code
2851428526
data-x="attr-iframe-sandbox-allow-same-origin">allow-same-origin</code> keywords together when the
@@ -77090,11 +77102,23 @@ console.assert(iframeWindow.frameElement === null);
7709077102
document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed navigation
7709177103
browsing context flag</span> set, then abort these steps negatively.</p></li>
7709277104

77093-
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77094-
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>, and
77095-
<var>A</var>'s <span>active document</span>'s <span>active sandboxing flag set</span> has its
77096-
<span>sandboxed top-level navigation browsing context flag</span> set, then abort these steps
77097-
negatively.</p></li>
77105+
<li>
77106+
<p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77107+
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>,
77108+
then:</p>
77109+
77110+
<ol>
77111+
<li><p>If this algorithm is <span>triggered by user activation</span> and <var>A</var>'s
77112+
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
77113+
top-level navigation with user activation browsing context flag</span> set, then abort these
77114+
steps negatively.</p></li>
77115+
77116+
<li><p>If this algorithm is not <span>triggered by user activation</span> and <var>A</var>'s
77117+
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
77118+
top-level navigation without user activation browsing context flag</span> set, then abort these
77119+
steps negatively.</p></li>
77120+
</ol>
77121+
</li>
7709877122

7709977123
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is
7710077124
neither <var>A</var> nor one of the <span data-x="ancestor browsing context">ancestor
@@ -79414,7 +79438,8 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7941479438
<span data-x="auxiliary browsing context">auxiliary browsing contexts</span> (which are protected
7941579439
by the <span>sandboxed auxiliary navigation browsing context flag</span> defined next), and the
7941679440
<span>top-level browsing context</span> (which is protected by the <span>sandboxed top-level
79417-
navigation browsing context flag</span> defined below).</p>
79441+
navigation without user activation browsing context flag</span> and <span>sandboxed top-level
79442+
navigation with user activation browsing context flag</span> defined below).</p>
7941879443

7941979444
<p>If the <span>sandboxed auxiliary navigation browsing context flag</span> is not set, then in
7942079445
certain cases the restrictions nonetheless allow popups (new <span data-x="top-level browsing
@@ -79438,19 +79463,39 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7943879463
</dd>
7943979464

7944079465

79441-
<dt>The <dfn data-export="">sandboxed top-level navigation browsing context flag</dfn></dt>
79466+
<dt>The <dfn data-export="">sandboxed top-level navigation without user activation browsing
79467+
context flag</dfn></dt>
79468+
79469+
<dd>
79470+
79471+
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
79472+
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79473+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that are
79474+
<em>not</em> <span>triggered by user activation</span>.</p>
79475+
79476+
<p>When the <span>sandboxed top-level navigation without user activation browsing context
79477+
flag</span> is <em>not</em> set, content can navigate its <span>top-level browsing
79478+
context</span>, but other <span data-x="browsing context">browsing contexts</span> are still
79479+
protected by the <span>sandboxed navigation browsing context flag</span> and possibly
79480+
the <span>sandboxed auxiliary navigation browsing context flag</span>.</p>
79481+
79482+
</dd>
79483+
79484+
79485+
<dt>The <dfn data-export="">sandboxed top-level navigation with user activation browsing context
79486+
flag</dfn></dt>
7944279487

7944379488
<dd>
7944479489

7944579490
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
7944679491
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79447-
<span>top-level browsing context</span></a>.</p>
79492+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that
79493+
<em>are</em> <span>triggered by user activation</span>.</p>
7944879494

79449-
<p>When the <span>sandboxed top-level navigation browsing context flag</span> is <em>not</em>
79450-
set, content can navigate its <span>top-level browsing context</span>, but other <span
79451-
data-x="browsing context">browsing contexts</span> are still protected by the <span>sandboxed
79452-
navigation browsing context flag</span> and possibly the <span>sandboxed auxiliary navigation
79453-
browsing context flag</span>.</p>
79495+
<p>As with the <span>sandboxed top-level navigation without user activation browsing context
79496+
flag</span>, this flag only affects the <span>top-level browsing context</span>; if it is not
79497+
set, other <span data-x="browsing context">browsing contexts</span> might still be protected by
79498+
other flags.</p>
7945479499

7945579500
</dd>
7945679501

@@ -79610,8 +79655,21 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7961079655

7961179656
<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>
7961279657

79613-
<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>
79614-
keyword.</p></li>
79658+
<li><p>The <span>sandboxed top-level navigation without user activation browsing context flag</span>, unless
79659+
<var>tokens</var> contains the <dfn><code
79660+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code></dfn> keyword.</p></li>
79661+
79662+
<li>
79663+
<p>The <span>sandboxed top-level navigation with user activation browsing context flag</span>, unless
79664+
<var>tokens</var> contains either the <dfn><code
79665+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code></dfn>
79666+
keyword or the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> keyword.</p>
79667+
79668+
<p class="note">This means that if the <code
79669+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> is present, the <code
79670+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
79671+
keyword will have no effect. For this reason, specifying both is a document conformance error.</p>
79672+
</li>
7961579673

7961679674
<li><p>The <span>sandboxed plugins browsing context flag</span>.</p></li>
7961779675

0 commit comments

Comments
 (0)