Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give browsing contexts an explicit container #5091

Merged
merged 4 commits into from
Nov 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 71 additions & 82 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -78581,31 +78581,40 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
context containers</dfn>.</p>

<p>Each <span>browsing context container</span> has a <dfn data-export="">nested browsing
context</dfn>, which is either a <span>browsing context</span> or null.</p>
context</dfn>, which is either a <span>browsing context</span> or null. It is initially null.</p>

<p>If a <span>browsing context</span> is the <span>nested browsing context</span> of a
<span>browsing context container</span>, then the browsing context is said to be <dfn
data-x="browsing context nested through" data-export="">nested through</dfn> the <span>browsing
context container</span>'s <span>node document</span>.</p>
<p>The <dfn data-x="bc-container">container</dfn> of a <span>browsing context</span> <var>bc</var>
is the <span>browsing context container</span> whose <span>nested browsing context</span> is
<var>bc</var>, or null if there is no such element.</p>

<p>A <span>browsing context</span> <var>child</var> is said to be a <dfn data-export="">child
browsing context</dfn> of another <span>browsing context</span> <var>parent</var>, if all of the
following conditions hold:</p>
<p>Each <span>browsing context</span> <var>bc</var> has a <dfn
data-x="bc-container-document">container document</dfn>, which is the result of running these
steps:</p>

<ul>
<li><p><var>child</var> is a <span>nested browsing context</span> of a <span>browsing context
container</span> <var>element</var></p></li>
<ol>
<li><p>If <var>bc</var>'s <span data-x="bc-container">container</span> is null, then return
null.</p></li>

<li><p><var>element</var> is <span>connected</span></p></li>
<li>
<p>Return <var>bc</var>'s <span data-x="bc-container">container</span>'s <span>node
document</span>.</p>

<li><p><var>element</var>'s <span>shadow-including root</span>'s <span
data-x="concept-document-bc">browsing context</span> is <var>parent</var></p></li>
</ul>
<p class="note">This is equal to <var>bc</var>'s <span data-x="bc-container">container</span>'s
<span>shadow-including root</span> as <var>bc</var>'s <span
data-x="bc-container">container</span> has to be <span>connected</span>.</p>
</li>
</ol>

annevk marked this conversation as resolved.
Show resolved Hide resolved
<p>A <span>browsing context</span> <var>child</var> is then a <dfn>document-tree child browsing
context</dfn> of <var>parent</var> if it is a <span>child browsing context</span> and its
<span>browsing context container</span> is not just <span>connected</span>, but also <span>in a
document tree</span>.</p>
<p>A <span>browsing context</span> <var>child</var> is said to be a <dfn data-export="">child
browsing context</dfn> of another <span>browsing context</span> <var>parent</var>, if
<var>child</var>'s <span data-x="bc-container-document">container document</span> is non-null and
<var>child</var>'s <span data-x="bc-container-document">container document</span>'s <span
data-x="concept-document-bc">browsing context</span> is <var>parent</var>.</p>

<p>A <span>browsing context</span> <var>child</var> is a <dfn>document-tree child browsing
context</dfn> of <var>parent</var> if <var>child</var> is a <span>child browsing context</span>
and <var>child</var>'s <span data-x="bc-container">container</span> is <span>in a document
tree</span>.</p>

<p>A <span>browsing context</span> <var>child</var> may have a <dfn data-export="">parent browsing
context</dfn>. This is the unique <span>browsing context</span> that has <var>child</var> as a
domenic marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -78627,10 +78636,10 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
group">group</dfn> (null or a <span>browsing context group</span>). It is initially null.</p>

<p>It is possible to create new browsing contexts that are related to a <span>top-level browsing
context</span> without being nested through an element. Such browsing contexts are called <dfn
data-x="auxiliary browsing context" data-lt="auxiliary browsing context" data-export="">auxiliary
browsing contexts</dfn>. Auxiliary browsing contexts are always <span data-x="top-level browsing
context">top-level browsing contexts</span>.</p>
context</span> while their <span data-x="bc-container">container</span> is null. Such browsing
contexts are called <dfn data-x="auxiliary browsing context" data-lt="auxiliary browsing context"
data-export="">auxiliary browsing contexts</dfn>. Auxiliary browsing contexts are always <span
data-x="top-level browsing context">top-level browsing contexts</span>.</p>

<p>The transitive closure of <span data-x="parent browsing context">parent browsing contexts</span>
for a <span>browsing context</span> that is a <span>nested browsing context</span> gives the list
Expand Down Expand Up @@ -78663,13 +78672,14 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p>Return <var>list</var>.</p></li>
</ol>

<p>A <code>Document</code> is said to be <dfn data-export="" data-dfn-for="Document">fully
active</dfn> when its <span data-x="concept-document-bc">browsing context</span> is non-null and
it is the <span>active document</span> of that <span>browsing context</span>, and either its <span
<p>A <code>Document</code> <var>d</var> is said to be <dfn data-export=""
data-dfn-for="Document">fully active</dfn> when <var>d</var>'s <span
data-x="concept-document-bc">browsing context</span> is non-null, <var>d</var>'s <span
data-x="concept-document-bc">browsing context</span>'s <span>active document</span> is
<var>d</var>, and either <var>d</var>'s <span
data-x="concept-document-bc">browsing context</span> is a <span>top-level browsing context</span>,
or it has a <span>parent browsing context</span> and the <code>Document</code> <span
data-x="browsing context nested through">through which</span> it is <span data-x="nested browsing
context">nested</span> is itself <span>fully active</span>.</p>
or <var>d</var>'s <span data-x="bc-container-document">container document</span> is <span>fully
active</span>.</p>

<p>Because they are associated with an element, <span data-x="child browsing context">child
browsing contexts</span> are always tied to a specific <code>Document</code> in their <span>parent
Expand Down Expand Up @@ -78719,43 +78729,30 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
document</span> of browsing context B, and is also <span>fully active</span>.</p></li>

<li><p>The <code data-x="">c.html</code> <code>Document</code> is still the <span>active
document</span> of browsing context C. However, since it is <span data-x="browsing context
nested through">nested through</span> the <code data-x="">b-1.html</code> <code>Document</code>,
which is itself not <span>fully active</span>, this means the <code data-x="">c.html</code>
<code>Document</code> is now not <span>fully active</span> (even though it is <span
data-x="active document">active</span>).</p></li>
document</span> of browsing context C. However, since C's <span
data-x="bc-container-document">container document</span> is the <code data-x="">b-1.html</code>
<code>Document</code>, which is itself not <span>fully active</span>, this means the <code
data-x="">c.html</code> <code>Document</code> is now not <span>fully active</span> (even though
it is <span data-x="active document">active</span>).</p></li>
</ul>

<p>For more explorations of the complexities involved here, especially as it impacts <a
href="#history">the session history</a>, see <cite>A Model of Navigation History</cite>. <ref
spec=NAVMODEL></p>
</div>

<p>A <span>browsing context</span> that is a <span>nested browsing context</span> can be put into
a <dfn>delaying <code data-x="event-load">load</code> events mode</dfn>. This is used when it is
<span data-x="navigate">navigated</span>, to <span>delay the load event</span> of its
<span>browsing context container</span> before the new <code>Document</code> is created.</p>

<!--(There's no current way for this to happen, since removing an iframe from a document discards its browsing context)
<p class="note">A <span>nested browsing context</span> can in some cases be taken out of its
<span>parent browsing context</span> (e.g. if an <code>iframe</code> element is removed from its
<code>Document</code>). In such a situation, the <span>nested browsing context</span> has no
<span>parent browsing context</span>, but it still has the same <span>browsing context
container</span> and is still <span data-x="browsing context nested through">nested through</span>
that element's <span>node document</span>. Such a <span>nested browsing context</span> is <em>not</em>
a <span>top-level browsing context</span>, and cannot contain <code>Document</code>s that are
<span>fully active</span>. Furthermore, if a <span>browsing context container</span> (such as an
<code>iframe</code>) is moved to another <code>Document</code>, then the <span>parent browsing
context</span> of its <span>nested browsing context</span> will change.</p>
-->
<p>A <span>child browsing context</span> can be put into a <dfn>delaying <code
data-x="event-load">load</code> events mode</dfn>. This is used when it is <span
data-x="navigate">navigated</span>, to <span>delay the load event</span> of its
<span data-x="bc-container">container</span> before the new <code>Document</code> is created.</p>

<p>The <dfn>document family</dfn> of a <span>browsing context</span> consists of the union of all
the <code>Document</code> objects in that <span>browsing context</span>'s <span>session
history</span> and the <span data-x="document family">document families</span> of all those
<code>Document</code> objects. The <span>document family</span> of a <code>Document</code> object
consists of the union of all the <span data-x="document family">document families</span> of the
<span data-x="browsing context">browsing contexts</span> that are <span data-x="browsing context
nested through">nested through</span> the <code>Document</code> object.</p>
<span data-x="browsing context">browsing contexts</span> in the <span>list of the descendant
domenic marked this conversation as resolved.
Show resolved Hide resolved
browsing contexts</span> of the <code>Document</code> object.</p>

<p>The <dfn data-x="concept-bcc-content-document">content document</dfn> of a <span>browsing
context container</span> <var>container</var> is the result of the following algorithm:</p>
Expand Down Expand Up @@ -91580,18 +91577,18 @@ dictionary <dfn>PromiseRejectionEventInit</dfn> : <span>EventInit</span> {
must be met:</p>

<ul>
<li><p>Any <code>Document</code> <var>B</var> that is <span data-x="browsing context nested
through">nested through</span> a <code>Document</code> <var>A</var> must be listed after
<li><p>Any <code>Document</code> <var>B</var> whose <span
data-x="concept-document-bc">browsing context</span>'s <span
data-x="bc-container-document">container document</span> is <var>A</var> must be listed after
<var>A</var> in the list.</p></li>

<li><p>If there are two documents <var>A</var> and <var>B</var> whose <span
data-x="concept-document-bc">browsing contexts</span> are both <span data-x="nested browsing
context">nested browsing contexts</span> and their <span data-x="browsing context
container">browsing context containers</span> are both elements in the same
<code>Document</code> <var>C</var>, then the order of <var>A</var> and <var>B</var> in the
list must match the relative <span>tree order</span> of their respective <span
data-x="browsing context container">browsing context containers</span> in
<var>C</var>.</p></li>
data-x="concept-document-bc">browsing contexts</span> are both <span data-x="child browsing
context">child browsing contexts</span> whose <span data-x="bc-container-document">container
documents</span> are another <code>Document</code> <var>C</var>, then the order of
<var>A</var> and <var>B</var> in the list must match the <span>shadow-including tree
order</span> of their respective <span data-x="browsing context container">browsing context
containers</span> in <var>C</var>'s <span>node tree</span>.</p></li>
</ul>

<p>In the steps below that iterate over <var>docs</var>, each <code>Document</code> must be
Expand Down Expand Up @@ -103929,30 +103926,22 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
</li>

<li>

<p>If the <span>HTML parser</span> for which this algorithm is being run is associated with a
<code>Document</code> that is itself in a <span>nested browsing context</span>, run these
substeps:</p>
<code>Document</code> <var>d</var> whose <span data-x="concept-document-bc">browsing
context</span> is non-null and a <span>child browsing context</span>, then:</p>

<ol>

<li><p>Let <var>new document</var> be the <code>Document</code> with which the
<span>HTML parser</span> is associated.</p></li>

<li><p>Let <var>parent document</var> be the <code>Document</code> <span
data-x="browsing context nested through">through which <var>new document</var> is
nested</span> (the <span>active document</span> of the <span>parent browsing context</span> of
<var>new document</var>).</p></li>

<li><p>If <var>parent document</var>'s <span>origin</span> is <span>same origin</span> with
<var>new document</var>'s <span>origin</span>, and <var>parent document</var>'s <span
data-x="document's character encoding">character encoding</span> is an <span>ASCII-compatible
encoding</span>, then return <var>parent document</var>'s <span data-x="document's character
encoding">character encoding</span>, with the <span
data-x="concept-encoding-confidence">confidence</span> <i>tentative</i>.</p></li>

<li><p>Let <var>parentDocument</var> be <var>d</var>'s <span
data-x="concept-document-bc">browsing context</span>'s <span
data-x="bc-container-document">container document</span>.</p></li>

<li><p>If <var>parentDocument</var>'s <span>origin</span> is <span>same origin</span> with
<var>d</var>'s <span>origin</span> and <var>parentDocument</var>'s <span data-x="document's
character encoding">character encoding</span> is an <span>ASCII-compatible encoding</span>,
then return <var>parentDocument</var>'s <span data-x="document's character encoding">character
encoding</span>, with the <span data-x="concept-encoding-confidence">confidence</span>
<i>tentative</i>.</p></li>
</ol>

</li>

<li><p>Otherwise, if the user agent has information on the likely encoding for this page, e.g.
Expand Down