119
◦ Otherwise, theoriginp767
ofdocumentis a uniqueopaque originp767
assigned when the newbrowsing contextp748
is created.
5. If the newbrowsing contextp748
has acreator browsing contextp748
, then setdocument'sreferrerp103
to thecreator URLp748
.
6. If the newbrowsing contextp748
has acreator browsing contextp748
, then setdocument'sreferrer policyp104
to thecreator referrer
policyp748
.
7. Ensure thatdocumenthas a single childhtmlp134
node, which itself has two empty child nodes: aheadp135
element, and abodyp156
element.
8. Implement the sandboxingp773
fordocument.
9. Adddocumentto the newbrowsing contextp748
'ssession historyp773
.
10. Setwindow'sassociatedDocumentp748
todocument.
11. Set up a browsing context environment settings objectp754
withrealm execution context.
Certain elements (for example,iframep308
elements) can instantiate furtherbrowsing contextsp748
. These are callednested browsing contexts. If
a browsing contextPhas aDocumentp103
Dwith an elementEthat nests another browsing contextCinside it, thenCis said to benested through
D, andEis said to be thebrowsing context containerofC. If thebrowsing context containerp749
elementEisin
theDocumentp103
D, thenPis
said to be theparent browsing contextofCandCis said to be achild browsing contextofP. Otherwise, thenested browsing contextp749
Chas
noparent browsing contextp749
.
A browsing contextAis said to be anancestorof a browsing contextBif there exists a browsing contextA'that is achild browsing contextp749
ofA
and that is itself anancestorp749
ofB, or if the browsing contextAis theparent browsing contextp749
ofB.
A browsing context that is not anested browsing contextp749
has noparent browsing contextp749
, and is thetop-level browsing contextof all the
browsing contexts for which it is anancestor browsing contextp749
.
The transitive closure ofparent browsing contextsp749
for anested browsing contextp749
gives the list ofancestor browsing contextsp749
.
Thelist of the descendant browsing contextsof aDocumentp103
dis the (ordered) list returned by the following algorithm:
1. Letlistbe an empty list.
2. For eachchild browsing contextp749
ofdthat isnested throughp749
an element that isin theDocument
d, in thetree order
of the
elements nesting thosebrowsing contextsp748
, run these substeps:
1. Append thatchild browsing contextp749
to the listlist.
2. Append thelist of the descendant browsing contextsp749
of theactive documentp748
of thatchild browsing contextp749
to the
listlist.
3. Return the constructedlist.
ADocumentp103
is said to befully activewhen it has abrowsing contextp748
and it is theactive documentp748
of thatbrowsing contextp748
, and
either its browsing context is atop-level browsing contextp749
, or it has aparent browsing contextp749
and theDocumentp103
through whichp749
it is
nestedp749
is itselffully activep749
.
Because they are nested through an element,child browsing contextsp749
are always tied to a specificDocumentp103
in theirparent browsing
contextp749
. User agents must not allow the user to interact withchild browsing contextsp749
of elements that are inDocumentp103
s that are not
themselvesfully activep749
.
Anested browsing contextp749
can be put into adelayingloadevents mode. This is used when it isnavigatedp788
, todelay the load eventp1042
of
thebrowsing context containerp749
before the newDocumentp103
is created.
Thedocument familyof abrowsing contextp748
consists of the union of all theDocumentp103
objects in thatbrowsing contextp748
'ssession
historyp773
and thedocument familiesp749
of all thoseDocumentp103
objects. Thedocument familyp749
of aDocumentp103
object consists of the
union of all thedocument familiesp749
of thebrowsing contextsp748
that arenested throughp749
theDocumentp103
object.
7.1.1 Nested browsing contexts
749