From 86844637bdc979b5c17b68bf61afdebbb990a0df Mon Sep 17 00:00:00 2001
From: Anne van Kesteren A browsing context has a session history, which lists the
Document
objects that the browsing context has presented, is presenting,
- or will present. At any time, one Document
in each browsing context is
- designated the active document.
- A Document
's browsing context is the browsing context
- whose session history contains the Document
, if any such browsing
- context exists and has not been discarded.WindowProxy
object's [[Window]]
+ internal slot value's associated
+ Document
. A Document
's browsing context is the
+ browsing context whose session history contains the
+ Document
, if any such browsing context exists and has not been discarded.
In general, there is a 1-to-1 mapping from the Window
object to the
Document
object, as long as the Document
object has a DragEventInit : MouseEventInit {
browsing context, since that browsing context was discarded.
To set the active document, given a browsing context
+ browsingContext, Document
object document, and optionally a
+ Window
object window, run these steps:
If window is not given, let window be document's relevant global object.
+ +Per this standard document can be created before + window, which does not make much sense. See issue #2688.
+Set browsingContext's WindowProxy
object's [[Window]] internal slot value to
+ window.
Set window's associated
+ Document
to document.
Set document's relevant settings object's execution ready flag.
A browsing context can have a creator browsing context, @@ -77183,16 +77209,8 @@ dictionary DragEventInit : MouseEventInit {
Ensure that document has a single child html
node, which itself
has two empty child nodes: a head
element, and a body
element.
Set window's associated
- Document
to document.
Set browsingContext's WindowProxy
object's
- [[Window]] internal slot
- value to window.
The internal slot value is updated when navigations occur.
-Set the active document with browsingContext and + document.
Set the origin of document:
@@ -77218,9 +77236,6 @@ dictionary DragEventInit : MouseEventInit {Set the allow* flags for document.
Set settingsObject's execution ready flag.
Add document to browsingContext's session history.
Let window be null.
Let settingsObject be null.
If browsingContext's only entry in its session history is the
about:blank
Document
that was added when browsingContext
was created, and navigation is occurring
with replacement enabled, and that Document
has the same
- origin as the new Document
, then set window to the
- Window
object of that Document
, and set settingsObject to
- window's relevant settings object.
Document
, then do nothing.
Otherwise,
+Otherwise:
For the global object, create a new Window
object and set
- window to it.
For the global object, create a new Window
object.
For the global this value, use browsingContext's
WindowProxy
object.
Set up a window environment settings object with realm execution - context and reservedEnvironment, if present, and set - settingsObject to the result.
Set window's associated
- Document
to the new Document
.
Set browsingContext's WindowProxy
object's
- [[Window]] internal slot
- value to window.
Set the Document
's HTTPS
state to the HTTPS state of the response used to generate the document.
Implement the sandboxing for the Document
.
Set the allow* flags for the Document
.
Set settingsObject's execution ready flag.
If settingsObject's active service worker is not null, - then:
- -If settingsObject is a secure context, - then:
- -If browsingContext has an opener browsing context and - request's client is a non-secure context, then disown browsingContext's opener.
Otherwise, set settingsObject's active service worker to - null.
Make entry's Document
object the
- active document of the browsing context.
Set the active document with the browsing
+ context and entry's Document
object.
Let realm execution context be the created JavaScript execution context.
Set window's associated
- Document
to document.
This is not universally implemented and can perhaps be + removed; see issue #1698.
+Set up a window environment settings object with realm execution context.
Set the active document with document's + browsing context, document, and window.
Replace document's singleton objects with new instances of those objects,
created in window's Realm. (This
includes in particular the History
, ApplicationCache
, and