Skip to content

Commit

Permalink
[e] (0) Factor out some steps from the top of the navigation algorith…
Browse files Browse the repository at this point in the history
…m to define 'allowed to navigate'.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=22319
Affected topics: HTML, Security

git-svn-id: http://svn.whatwg.org/webapps@8046 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 9, 2013
1 parent 16a7d0c commit 36aa8f5
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 77 deletions.
53 changes: 27 additions & 26 deletions complete.html
Expand Up @@ -65136,7 +65136,30 @@ <h4 id=security-nav><span class=secno>6.1.4 </span>Security</h4>
flag</a>) can further restrict the above in certain cases, but it does so indirectly via other
algorithms and doesn't affect whether a browsing context is considered to be <i><a href=#friends-with>friends with</a></i> another as defined above.</p>

<hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code><a href=#document>Document</a></code>'s
<hr><p>A <a href=#browsing-context>browsing context</a> <var title="">A</var> is <dfn id=allowed-to-navigate>allowed to navigate</dfn> a
second <a href=#browsing-context>browsing context</a> <var title="">B</var> if the following algorithm terminates
positively:</p>

<ol><li><p>If <var title="">A</var> is not the same <a href=#browsing-context>browsing context</a> as <var title="">B</var>, and <var title="">A</var> is not one of the <a href=#ancestor-browsing-context title="ancestor browsing
context">ancestor browsing contexts</a> of <var title="">B</var>, and <var title="">B</var>
is not a <a href=#top-level-browsing-context>top-level browsing context</a>, and <var title="">A</var>'s <a href=#active-document>active
document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation
browsing context flag</a> set, then abort these steps negatively.</li>

<li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
flag set</a> has its <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set,
then abort these steps negatively.</li>

<li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set, and <var title="">A</var> is not the <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a> of <var title="">B</var>, then abort these steps negatively.</li> <!-- we do not check the
/sandboxed auxiliary navigation browsing context flag/ here, that's only for actually opening
the new top-level browsing context. -->

<li><p>Otherwise, terminate positively!</li>

</ol><hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code><a href=#document>Document</a></code>'s
<a href=#browsing-context>browsing context</a> is a <a href=#top-level-browsing-context>top-level browsing context</a> or if all of its
<code><a href=#document>Document</a></code>'s <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a>
all have <a href=#active-document title="active document">active documents</a> whose <a href=#origin>origin</a> are the
Expand Down Expand Up @@ -67824,32 +67847,10 @@ <h4 id=navigating-across-documents><span class=secno>6.6.1 </span>Navigating acr

<li id=sandboxLinks>

<p>If the <a href=#source-browsing-context>source browsing context</a> is not the same as the <a href=#browsing-context>browsing
context</a> being navigated, and the <a href=#source-browsing-context>source browsing context</a> is not one of the
<a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of the <a href=#browsing-context>browsing
context</a> being navigated, and the <a href=#browsing-context>browsing context</a> being navigated is not a
<a href=#top-level-browsing-context>top-level browsing context</a>, and the <a href=#source-browsing-context>source browsing context</a>'s
<a href=#active-document>active document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed
navigation browsing context flag</a> set, then abort these steps.</p>

<p>Otherwise, if the <a href=#browsing-context>browsing context</a> being navigated is a <a href=#top-level-browsing-context>top-level browsing
context</a>, and is one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and the <a href=#source-browsing-context>source browsing
context</a>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its
<a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set, then abort these
steps.</p>
<p>If the <a href=#source-browsing-context>source browsing context</a> is not <a href=#allowed-to-navigate>allowed to navigate</a> the
<a href=#browsing-context>browsing context</a> being navigated, then abort these steps.</p>

<p>Otherwise, if the <a href=#browsing-context>browsing context</a> being navigated is a <a href=#top-level-browsing-context>top-level browsing
context</a>, and is not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and the <a href=#source-browsing-context>source browsing
context</a>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its
<a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set, and the <a href=#source-browsing-context>source browsing
context</a> is not the <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a> of the <a href=#browsing-context>browsing
context</a> being navigated, then abort these steps.</p> <!-- we do not check the /sandboxed
auxiliary navigation browsing context flag/ here, that's only for actually opening the new
top-level browsing context. -->

<p>In all of these cases, the user agent may additionally offer to open the new resource in a
<p>If these steps are aborted here, the user agent may instead offer to open the new resource in a
new <a href=#top-level-browsing-context>top-level browsing context</a> or in the <a href=#top-level-browsing-context>top-level browsing context</a> of
the <a href=#source-browsing-context>source browsing context</a>, at the user's option, in which case the user agent
must <a href=#navigate>navigate</a><!--DONAV sandbox manual load--> that designated <a href=#top-level-browsing-context>top-level
Expand Down
53 changes: 27 additions & 26 deletions index
Expand Up @@ -65136,7 +65136,30 @@ END:VCARD</pre>
flag</a>) can further restrict the above in certain cases, but it does so indirectly via other
algorithms and doesn't affect whether a browsing context is considered to be <i><a href=#friends-with>friends with</a></i> another as defined above.</p>

<hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code><a href=#document>Document</a></code>'s
<hr><p>A <a href=#browsing-context>browsing context</a> <var title="">A</var> is <dfn id=allowed-to-navigate>allowed to navigate</dfn> a
second <a href=#browsing-context>browsing context</a> <var title="">B</var> if the following algorithm terminates
positively:</p>

<ol><li><p>If <var title="">A</var> is not the same <a href=#browsing-context>browsing context</a> as <var title="">B</var>, and <var title="">A</var> is not one of the <a href=#ancestor-browsing-context title="ancestor browsing
context">ancestor browsing contexts</a> of <var title="">B</var>, and <var title="">B</var>
is not a <a href=#top-level-browsing-context>top-level browsing context</a>, and <var title="">A</var>'s <a href=#active-document>active
document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation
browsing context flag</a> set, then abort these steps negatively.</li>

<li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
flag set</a> has its <a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set,
then abort these steps negatively.</li>

<li><p>Otherwise, if <var title="">B</var> is a <a href=#top-level-browsing-context>top-level browsing context</a>, and is
not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of <var title="">A</var>, and <var title="">A</var>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing
flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set, and <var title="">A</var> is not the <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a> of <var title="">B</var>, then abort these steps negatively.</li> <!-- we do not check the
/sandboxed auxiliary navigation browsing context flag/ here, that's only for actually opening
the new top-level browsing context. -->

<li><p>Otherwise, terminate positively!</li>

</ol><hr><p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code><a href=#document>Document</a></code>'s
<a href=#browsing-context>browsing context</a> is a <a href=#top-level-browsing-context>top-level browsing context</a> or if all of its
<code><a href=#document>Document</a></code>'s <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a>
all have <a href=#active-document title="active document">active documents</a> whose <a href=#origin>origin</a> are the
Expand Down Expand Up @@ -67824,32 +67847,10 @@ State: &lt;OUTPUT NAME=I&gt;1&lt;/OUTPUT&gt; &lt;INPUT VALUE="Increment" TYPE=BU

<li id=sandboxLinks>

<p>If the <a href=#source-browsing-context>source browsing context</a> is not the same as the <a href=#browsing-context>browsing
context</a> being navigated, and the <a href=#source-browsing-context>source browsing context</a> is not one of the
<a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing contexts</a> of the <a href=#browsing-context>browsing
context</a> being navigated, and the <a href=#browsing-context>browsing context</a> being navigated is not a
<a href=#top-level-browsing-context>top-level browsing context</a>, and the <a href=#source-browsing-context>source browsing context</a>'s
<a href=#active-document>active document</a>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag>sandboxed
navigation browsing context flag</a> set, then abort these steps.</p>

<p>Otherwise, if the <a href=#browsing-context>browsing context</a> being navigated is a <a href=#top-level-browsing-context>top-level browsing
context</a>, and is one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and the <a href=#source-browsing-context>source browsing
context</a>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its
<a href=#sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set, then abort these
steps.</p>
<p>If the <a href=#source-browsing-context>source browsing context</a> is not <a href=#allowed-to-navigate>allowed to navigate</a> the
<a href=#browsing-context>browsing context</a> being navigated, then abort these steps.</p>

<p>Otherwise, if the <a href=#browsing-context>browsing context</a> being navigated is a <a href=#top-level-browsing-context>top-level browsing
context</a>, and is not one of the <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
contexts</a> of the <a href=#source-browsing-context>source browsing context</a>, and the <a href=#source-browsing-context>source browsing
context</a>'s <code><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set>active sandboxing flag set</a> has its
<a href=#sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set, and the <a href=#source-browsing-context>source browsing
context</a> is not the <a href=#one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a> of the <a href=#browsing-context>browsing
context</a> being navigated, then abort these steps.</p> <!-- we do not check the /sandboxed
auxiliary navigation browsing context flag/ here, that's only for actually opening the new
top-level browsing context. -->

<p>In all of these cases, the user agent may additionally offer to open the new resource in a
<p>If these steps are aborted here, the user agent may instead offer to open the new resource in a
new <a href=#top-level-browsing-context>top-level browsing context</a> or in the <a href=#top-level-browsing-context>top-level browsing context</a> of
the <a href=#source-browsing-context>source browsing context</a>, at the user's option, in which case the user agent
must <a href=#navigate>navigate</a><!--DONAV sandbox manual load--> that designated <a href=#top-level-browsing-context>top-level
Expand Down
62 changes: 37 additions & 25 deletions source
Expand Up @@ -72628,6 +72628,40 @@ END:VCARD</pre>

<hr>

<p>A <span>browsing context</span> <var title="">A</var> is <dfn>allowed to navigate</dfn> a
second <span>browsing context</span> <var title="">B</var> if the following algorithm terminates
positively:</p>

<ol>

<li><p>If <var title="">A</var> is not the same <span>browsing context</span> as <var
title="">B</var>, and <var title="">A</var> is not one of the <span title="ancestor browsing
context">ancestor browsing contexts</span> of <var title="">B</var>, and <var title="">B</var>
is not a <span>top-level browsing context</span>, and <var title="">A</var>'s <span>active
document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed navigation
browsing context flag</span> set, then abort these steps negatively.</p></li>

<li><p>Otherwise, if <var title="">B</var> is a <span>top-level browsing context</span>, and is
one of the <span title="ancestor browsing context">ancestor browsing contexts</span> of <var
title="">A</var>, and <var title="">A</var>'s <code>Document</code>'s <span>active sandboxing
flag set</span> has its <span>sandboxed top-level navigation browsing context flag</span> set,
then abort these steps negatively.</p></li>

<li><p>Otherwise, if <var title="">B</var> is a <span>top-level browsing context</span>, and is
not one of the <span title="ancestor browsing context">ancestor browsing contexts</span> of <var
title="">A</var>, and <var title="">A</var>'s <code>Document</code>'s <span>active sandboxing
flag set</span> has its <span>sandboxed navigation browsing context flag</span> set, and <var
title="">A</var> is not the <span>one permitted sandboxed navigator</span> of <var
title="">B</var>, then abort these steps negatively.</p></li> <!-- we do not check the
/sandboxed auxiliary navigation browsing context flag/ here, that's only for actually opening
the new top-level browsing context. -->

<li><p>Otherwise, terminate positively!</p></li>

</ol>

<hr>

<p>An element has a <dfn>browsing context scope origin</dfn> if its <code>Document</code>'s
<span>browsing context</span> is a <span>top-level browsing context</span> or if all of its
<code>Document</code>'s <span title="ancestor browsing context">ancestor browsing contexts</span>
Expand Down Expand Up @@ -75705,32 +75739,10 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<li id="sandboxLinks">

<p>If the <span>source browsing context</span> is not the same as the <span>browsing
context</span> being navigated, and the <span>source browsing context</span> is not one of the
<span title="ancestor browsing context">ancestor browsing contexts</span> of the <span>browsing
context</span> being navigated, and the <span>browsing context</span> being navigated is not a
<span>top-level browsing context</span>, and the <span>source browsing context</span>'s
<span>active document</span>'s <span>active sandboxing flag set</span> has its <span>sandboxed
navigation browsing context flag</span> set, then abort these steps.</p>

<p>Otherwise, if the <span>browsing context</span> being navigated is a <span>top-level browsing
context</span>, and is one of the <span title="ancestor browsing context">ancestor browsing
contexts</span> of the <span>source browsing context</span>, and the <span>source browsing
context</span>'s <code>Document</code>'s <span>active sandboxing flag set</span> has its
<span>sandboxed top-level navigation browsing context flag</span> set, then abort these
steps.</p>
<p>If the <span>source browsing context</span> is not <span>allowed to navigate</span> the
<span>browsing context</span> being navigated, then abort these steps.</p>

<p>Otherwise, if the <span>browsing context</span> being navigated is a <span>top-level browsing
context</span>, and is not one of the <span title="ancestor browsing context">ancestor browsing
contexts</span> of the <span>source browsing context</span>, and the <span>source browsing
context</span>'s <code>Document</code>'s <span>active sandboxing flag set</span> has its
<span>sandboxed navigation browsing context flag</span> set, and the <span>source browsing
context</span> is not the <span>one permitted sandboxed navigator</span> of the <span>browsing
context</span> being navigated, then abort these steps.</p> <!-- we do not check the /sandboxed
auxiliary navigation browsing context flag/ here, that's only for actually opening the new
top-level browsing context. -->

<p>In all of these cases, the user agent may additionally offer to open the new resource in a
<p>If these steps are aborted here, the user agent may instead offer to open the new resource in a
new <span>top-level browsing context</span> or in the <span>top-level browsing context</span> of
the <span>source browsing context</span>, at the user's option, in which case the user agent
must <span>navigate</span><!--DONAV sandbox manual load--> that designated <span>top-level
Expand Down

0 comments on commit 36aa8f5

Please sign in to comment.