Skip to content

Commit

Permalink
Use the Window's associated Document for allow-modals sandbox checks
Browse files Browse the repository at this point in the history
This fixes whatwg#1206. As noted there, the previous indirections were wacky
and unnecessary.

Chrome and Firefox nightly implement a slightly different behavior,
choosing the Window's browsing context's active Document, instead of the
Window's associated Document. This can be different in edge cases as
discussed in whatwg#1473 (comment).
However, in Firefox they are not distinguishable, due to another
security check that prevents these edge cases from being triggered.
whatwg#1548 proposes to add a security check like Firefox's to the spec, which
would obviate the difference in all cases. In the meantime, the choice
of associated Document is more straightforward.
  • Loading branch information
domenic authored and Alice Boxhall committed Jan 7, 2019
1 parent 32adcc2 commit aaa5cd1
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -90436,10 +90436,9 @@ scheduleWork(); // queues a task to do lots of work</pre>
<li><p>If the <span>event loop</span>'s <span>termination nesting level</span> is non-zero,
optionally abort these steps.</p></li>

<li><p>If the <span>active sandboxing flag set</span> of the <span>active document</span> of
the <span>responsible browsing context</span> specified by the <span>incumbent settings
object</span> has the <span>sandboxed modals flag</span> set, then abort these
steps.</p></li>
<li><p>If the <span>active sandboxing flag set</span> of this <code>Window</code> object's <span
data-x="concept-document-window">associated <code>Document</code></span> has the <span>sandboxed
modals flag</span> set, then abort these steps.</p></li>

<li><p>Optionally, abort these steps. (For example, the user agent might give the user the option
to ignore all alerts, and would thus abort at this step whenever the method was
Expand Down Expand Up @@ -90467,10 +90466,9 @@ scheduleWork(); // queues a task to do lots of work</pre>
<li><p>If the <span>event loop</span>'s <span>termination nesting level</span> is non-zero,
optionally abort these steps, returning false.</p></li>

<li><p>If the <span>active sandboxing flag set</span> of the <span>active document</span> of
the <span>responsible browsing context</span> specified by the <span>incumbent settings
object</span> has the <span>sandboxed modals flag</span> set, then return false and abort these
steps.</p></li>
<li><p>If the <span>active sandboxing flag set</span> of this <code>Window</code> object's <span
data-x="concept-document-window">associated <code>Document</code></span> has the <span>sandboxed
modals flag</span> set, then abort these steps.</p></li>

<li><p>Optionally, return false and abort these steps. (For example, the user agent might give
the user the option to ignore all prompts, and would thus abort at this step whenever the method
Expand All @@ -90497,10 +90495,9 @@ scheduleWork(); // queues a task to do lots of work</pre>
<li><p>If the <span>event loop</span>'s <span>termination nesting level</span> is non-zero,
optionally abort these steps, returning null.</p></li>

<li><p>If the <span>active sandboxing flag set</span> of the <span>active document</span> of
the <span>responsible browsing context</span> specified by the <span>incumbent settings
object</span> has the <span>sandboxed modals flag</span> set, then return null and abort these
steps.</p></li>
<li><p>If the <span>active sandboxing flag set</span> of this <code>Window</code> object's <span
data-x="concept-document-window">associated <code>Document</code></span> has the <span>sandboxed
modals flag</span> set, then abort these steps.</p></li>

<li><p>Optionally, return null and abort these steps. (For example, the user agent might give the
user the option to ignore all prompts, and would thus abort at this step whenever the method was
Expand Down Expand Up @@ -90571,14 +90568,13 @@ scheduleWork(); // queues a task to do lots of work</pre>

<li>

<p>If the <span>active sandboxing flag set</span> of the <span>active document</span> of
the <span>responsible browsing context</span> specified by the <span>incumbent settings
object</span> has the <span>sandboxed modals flag</span> set, then abort these
steps.</p>
<p>If the <span>active sandboxing flag set</span> of this <code>Window</code> object's <span
data-x="concept-document-window">associated <code>Document</code></span> has the <span>sandboxed
modals flag</span> set, then abort these steps.</p>

<p class="note">If the printing dialog is blocked by a <code>Document</code>'s sandbox,
then neither the <code data-x="event-beforeprint">beforeprint</code> nor <code
data-x="event-afterprint">afterprint</code> events will be fired.</p>
<p class="note">If the printing dialog is blocked by a <code>Document</code>'s sandbox,
then neither the <code data-x="event-beforeprint">beforeprint</code> nor <code
data-x="event-afterprint">afterprint</code> events will be fired.</p>

</li>

Expand Down

0 comments on commit aaa5cd1

Please sign in to comment.