Skip to content

Commit 7b4964a

Browse files
authored
Give browsing context an explicit container
This generally sets out the infrastructure for a more secure model for working with browsing contexts, as outlined in #5020. * Adds browsing context's container * Adds browsing context's container document * Makes "update the rendering" account for browsing contexts in shadow trees * Removes nested through; closes #4409.
1 parent 3e1874e commit 7b4964a

File tree

1 file changed

+71
-82
lines changed

1 file changed

+71
-82
lines changed

source

Lines changed: 71 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -78581,31 +78581,40 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
7858178581
context containers</dfn>.</p>
7858278582

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

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

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

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

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

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

78605-
<p>A <span>browsing context</span> <var>child</var> is then a <dfn>document-tree child browsing
78606-
context</dfn> of <var>parent</var> if it is a <span>child browsing context</span> and its
78607-
<span>browsing context container</span> is not just <span>connected</span>, but also <span>in a
78608-
document tree</span>.</p>
78608+
<p>A <span>browsing context</span> <var>child</var> is said to be a <dfn data-export="">child
78609+
browsing context</dfn> of another <span>browsing context</span> <var>parent</var>, if
78610+
<var>child</var>'s <span data-x="bc-container-document">container document</span> is non-null and
78611+
<var>child</var>'s <span data-x="bc-container-document">container document</span>'s <span
78612+
data-x="concept-document-bc">browsing context</span> is <var>parent</var>.</p>
78613+
78614+
<p>A <span>browsing context</span> <var>child</var> is a <dfn>document-tree child browsing
78615+
context</dfn> of <var>parent</var> if <var>child</var> is a <span>child browsing context</span>
78616+
and <var>child</var>'s <span data-x="bc-container">container</span> is <span>in a document
78617+
tree</span>.</p>
7860978618

7861078619
<p>A <span>browsing context</span> <var>child</var> may have a <dfn data-export="">parent browsing
7861178620
context</dfn>. This is the unique <span>browsing context</span> that has <var>child</var> as a
@@ -78627,10 +78636,10 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
7862778636
group">group</dfn> (null or a <span>browsing context group</span>). It is initially null.</p>
7862878637

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

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

78666-
<p>A <code>Document</code> is said to be <dfn data-export="" data-dfn-for="Document">fully
78667-
active</dfn> when its <span data-x="concept-document-bc">browsing context</span> is non-null and
78668-
it is the <span>active document</span> of that <span>browsing context</span>, and either its <span
78675+
<p>A <code>Document</code> <var>d</var> is said to be <dfn data-export=""
78676+
data-dfn-for="Document">fully active</dfn> when <var>d</var>'s <span
78677+
data-x="concept-document-bc">browsing context</span> is non-null, <var>d</var>'s <span
78678+
data-x="concept-document-bc">browsing context</span>'s <span>active document</span> is
78679+
<var>d</var>, and either <var>d</var>'s <span
7866978680
data-x="concept-document-bc">browsing context</span> is a <span>top-level browsing context</span>,
78670-
or it has a <span>parent browsing context</span> and the <code>Document</code> <span
78671-
data-x="browsing context nested through">through which</span> it is <span data-x="nested browsing
78672-
context">nested</span> is itself <span>fully active</span>.</p>
78681+
or <var>d</var>'s <span data-x="bc-container-document">container document</span> is <span>fully
78682+
active</span>.</p>
7867378683

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

7872178731
<li><p>The <code data-x="">c.html</code> <code>Document</code> is still the <span>active
78722-
document</span> of browsing context C. However, since it is <span data-x="browsing context
78723-
nested through">nested through</span> the <code data-x="">b-1.html</code> <code>Document</code>,
78724-
which is itself not <span>fully active</span>, this means the <code data-x="">c.html</code>
78725-
<code>Document</code> is now not <span>fully active</span> (even though it is <span
78726-
data-x="active document">active</span>).</p></li>
78732+
document</span> of browsing context C. However, since C's <span
78733+
data-x="bc-container-document">container document</span> is the <code data-x="">b-1.html</code>
78734+
<code>Document</code>, which is itself not <span>fully active</span>, this means the <code
78735+
data-x="">c.html</code> <code>Document</code> is now not <span>fully active</span> (even though
78736+
it is <span data-x="active document">active</span>).</p></li>
7872778737
</ul>
7872878738

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

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

7875278749
<p>The <dfn>document family</dfn> of a <span>browsing context</span> consists of the union of all
7875378750
the <code>Document</code> objects in that <span>browsing context</span>'s <span>session
7875478751
history</span> and the <span data-x="document family">document families</span> of all those
7875578752
<code>Document</code> objects. The <span>document family</span> of a <code>Document</code> object
7875678753
consists of the union of all the <span data-x="document family">document families</span> of the
78757-
<span data-x="browsing context">browsing contexts</span> that are <span data-x="browsing context
78758-
nested through">nested through</span> the <code>Document</code> object.</p>
78754+
<span data-x="browsing context">browsing contexts</span> in the <span>list of the descendant
78755+
browsing contexts</span> of the <code>Document</code> object.</p>
7875978756

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

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

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

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

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

103937103933
<ol>
103938-
103939-
<li><p>Let <var>new document</var> be the <code>Document</code> with which the
103940-
<span>HTML parser</span> is associated.</p></li>
103941-
103942-
<li><p>Let <var>parent document</var> be the <code>Document</code> <span
103943-
data-x="browsing context nested through">through which <var>new document</var> is
103944-
nested</span> (the <span>active document</span> of the <span>parent browsing context</span> of
103945-
<var>new document</var>).</p></li>
103946-
103947-
<li><p>If <var>parent document</var>'s <span>origin</span> is <span>same origin</span> with
103948-
<var>new document</var>'s <span>origin</span>, and <var>parent document</var>'s <span
103949-
data-x="document's character encoding">character encoding</span> is an <span>ASCII-compatible
103950-
encoding</span>, then return <var>parent document</var>'s <span data-x="document's character
103951-
encoding">character encoding</span>, with the <span
103952-
data-x="concept-encoding-confidence">confidence</span> <i>tentative</i>.</p></li>
103953-
103934+
<li><p>Let <var>parentDocument</var> be <var>d</var>'s <span
103935+
data-x="concept-document-bc">browsing context</span>'s <span
103936+
data-x="bc-container-document">container document</span>.</p></li>
103937+
103938+
<li><p>If <var>parentDocument</var>'s <span>origin</span> is <span>same origin</span> with
103939+
<var>d</var>'s <span>origin</span> and <var>parentDocument</var>'s <span data-x="document's
103940+
character encoding">character encoding</span> is an <span>ASCII-compatible encoding</span>,
103941+
then return <var>parentDocument</var>'s <span data-x="document's character encoding">character
103942+
encoding</span>, with the <span data-x="concept-encoding-confidence">confidence</span>
103943+
<i>tentative</i>.</p></li>
103954103944
</ol>
103955-
103956103945
</li>
103957103946

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

0 commit comments

Comments
 (0)