Skip to content

Commit 22d885a

Browse files
committed
Add allow-top-navigation-by-user-activation sandbox token
Fixes WICG/interventions#42.
1 parent 10d61c4 commit 22d885a

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
@@ -28451,8 +28451,9 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2845128451
data-x="attr-iframe-sandbox-allow-popups-to-escape-sandbox">allow-popups-to-escape-sandbox</code>,
2845228452
<code data-x="attr-iframe-sandbox-allow-presentation">allow-presentation</code>, <code
2845328453
data-x="attr-iframe-sandbox-allow-same-origin">allow-same-origin</code>, <code
28454-
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, and <code
28455-
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>.</p>
28454+
data-x="attr-iframe-sandbox-allow-scripts">allow-scripts</code>, <code
28455+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>, and <code
28456+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>.</p>
2845628457

2845728458
<p>When the attribute is set, the content is treated as being from a unique <span>origin</span>,
2845828459
forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
@@ -28461,7 +28462,11 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2846128462
the content to be treated as being from its real origin instead of forcing it into a unique
2846228463
origin; the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code>
2846328464
keyword allows the content to <span>navigate</span> its <span>top-level browsing context</span>;
28464-
and the <code data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
28465+
the <code
28466+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
28467+
keyword behaves similarly but only allows such <span data-x="navigate">navigation</span> when
28468+
<span>triggered by user activation</span>; and the <code
28469+
data-x="attr-iframe-sandbox-allow-forms">allow-forms</code>, <code
2846528470
data-x="attr-iframe-sandbox-allow-modals">allow-modals</code>, <code
2846628471
data-x="attr-iframe-sandbox-allow-orientation-lock">allow-orientation-lock</code>, <code
2846728472
data-x="attr-iframe-sandbox-allow-pointer-lock">allow-pointer-lock</code>, <code
@@ -28474,6 +28479,13 @@ interface <dfn>HTMLIFrameElement</dfn> : <span>HTMLElement</span> {
2847428479
context">auxiliary browsing contexts</span> respectively. <ref spec=POINTERLOCK>
2847528480
<ref spec=SCREENORIENTATION> <ref spec=PRESENTATION></p>
2847628481

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

77268-
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77269-
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>, and
77270-
<var>A</var>'s <span>active document</span>'s <span>active sandboxing flag set</span> has its
77271-
<span>sandboxed top-level navigation browsing context flag</span> set, then abort these steps
77272-
negatively.</p></li>
77280+
<li>
77281+
<p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is one of the
77282+
<span data-x="ancestor browsing context">ancestor browsing contexts</span> of <var>A</var>,
77283+
then:</p>
77284+
77285+
<ol>
77286+
<li><p>If this algorithm is <span>triggered by user activation</span> and <var>A</var>'s
77287+
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
77288+
top-level navigation with user activation browsing context flag</span> set, then abort these
77289+
steps negatively.</p></li>
77290+
77291+
<li><p>If this algorithm is not <span>triggered by user activation</span> and <var>A</var>'s
77292+
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
77293+
top-level navigation without user activation browsing context flag</span> set, then abort these
77294+
steps negatively.</p></li>
77295+
</ol>
77296+
</li>
7727377297

7727477298
<li><p>Otherwise, if <var>B</var> is a <span>top-level browsing context</span>, and is
7727577299
neither <var>A</var> nor one of the <span data-x="ancestor browsing context">ancestor
@@ -79600,7 +79624,8 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7960079624
<span data-x="auxiliary browsing context">auxiliary browsing contexts</span> (which are protected
7960179625
by the <span>sandboxed auxiliary navigation browsing context flag</span> defined next), and the
7960279626
<span>top-level browsing context</span> (which is protected by the <span>sandboxed top-level
79603-
navigation browsing context flag</span> defined below).</p>
79627+
navigation without user activation browsing context flag</span> and <span>sandboxed top-level
79628+
navigation with user activation browsing context flag</span> defined below).</p>
7960479629

7960579630
<p>If the <span>sandboxed auxiliary navigation browsing context flag</span> is not set, then in
7960679631
certain cases the restrictions nonetheless allow popups (new <span data-x="top-level browsing
@@ -79624,19 +79649,39 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7962479649
</dd>
7962579650

7962679651

79627-
<dt>The <dfn data-export="">sandboxed top-level navigation browsing context flag</dfn></dt>
79652+
<dt>The <dfn data-export="">sandboxed top-level navigation without user activation browsing
79653+
context flag</dfn></dt>
79654+
79655+
<dd>
79656+
79657+
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
79658+
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79659+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that are
79660+
<em>not</em> <span>triggered by user activation</span>.</p>
79661+
79662+
<p>When the <span>sandboxed top-level navigation without user activation browsing context
79663+
flag</span> is <em>not</em> set, content can navigate its <span>top-level browsing
79664+
context</span>, but other <span data-x="browsing context">browsing contexts</span> are still
79665+
protected by the <span>sandboxed navigation browsing context flag</span> and possibly
79666+
the <span>sandboxed auxiliary navigation browsing context flag</span>.</p>
79667+
79668+
</dd>
79669+
79670+
79671+
<dt>The <dfn data-export="">sandboxed top-level navigation with user activation browsing context
79672+
flag</dfn></dt>
7962879673

7962979674
<dd>
7963079675

7963179676
<p>This flag <a href="#sandboxLinks">prevents content from navigating their <span>top-level
7963279677
browsing context</span></a> and <a href="#sandboxClose">prevents content from closing their
79633-
<span>top-level browsing context</span></a>.</p>
79678+
<span>top-level browsing context</span></a>. It is consulted only from algorithms that
79679+
<em>are</em> <span>triggered by user activation</span>.</p>
7963479680

79635-
<p>When the <span>sandboxed top-level navigation browsing context flag</span> is <em>not</em>
79636-
set, content can navigate its <span>top-level browsing context</span>, but other <span
79637-
data-x="browsing context">browsing contexts</span> are still protected by the <span>sandboxed
79638-
navigation browsing context flag</span> and possibly the <span>sandboxed auxiliary navigation
79639-
browsing context flag</span>.</p>
79681+
<p>As with the <span>sandboxed top-level navigation without user activation browsing context
79682+
flag</span>, this flag only affects the <span>top-level browsing context</span>; if it is not
79683+
set, other <span data-x="browsing context">browsing contexts</span> might still be protected by
79684+
other flags.</p>
7964079685

7964179686
</dd>
7964279687

@@ -79796,8 +79841,21 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
7979679841

7979779842
<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>
7979879843

79799-
<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>
79800-
keyword.</p></li>
79844+
<li><p>The <span>sandboxed top-level navigation without user activation browsing context flag</span>, unless
79845+
<var>tokens</var> contains the <dfn><code
79846+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code></dfn> keyword.</p></li>
79847+
79848+
<li>
79849+
<p>The <span>sandboxed top-level navigation with user activation browsing context flag</span>, unless
79850+
<var>tokens</var> contains either the <dfn><code
79851+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code></dfn>
79852+
keyword or the <code data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> keyword.</p>
79853+
79854+
<p class="note">This means that if the <code
79855+
data-x="attr-iframe-sandbox-allow-top-navigation">allow-top-navigation</code> is present, the <code
79856+
data-x="attr-iframe-sandbox-allow-top-navigation-by-user-activation">allow-top-navigation-by-user-activation</code>
79857+
keyword will have no effect. For this reason, specifying both is a document conformance error.</p>
79858+
</li>
7980179859

7980279860
<li><p>The <span>sandboxed plugins browsing context flag</span>.</p></li>
7980379861

0 commit comments

Comments
 (0)