BrowsingContext and WindowContext
The BrowsingContext
is the Gecko representation of the spec-defined
Browsing Context object.
The Browsing Context Tree
BrowsingContext
and WindowContext
objects form a tree, corresponding
to the tree of frame elements which was used to construct them.
Example
Loading the HTML documents listed here, would end up creating a set of BrowsingContexts and WindowContexts forming the tree.
<!-- http://example.com/top.html -->
<iframe src="frame1.html"></iframe>
<iframe src="http://mozilla.org/"></iframe>
<!-- http://example.com/frame1.html -->
<iframe src="http://example.com/frame2.html"></iframe>
<!-- http://mozilla.org -->
<iframe></iframe>
<iframe></iframe>
Synced Fields
WIP - In-progress documentation at https://wiki.mozilla.org/Project_Fission/BrowsingContext.
API Documentation
-
class BrowsingContext
This is a synced-context type. Instances of it will exist in every “relevant” content process for the navigation.
Instances of
BrowsingContext
created in the parent processes will beCanonicalBrowsingContext
.-
WindowContext *GetParentWindowContext()
Get the parent
WindowContext
embedding this context, ornullptr
, if this is the toplevel context.
-
WindowContext *GetTopWindowContext()
Get the toplevel
WindowContext
embedding this context, ornullptr
if this is the toplevel context.This is equivalent to repeatedly calling
GetParentWindowContext()
until it returns nullptr.
-
BrowsingContext *GetParent()
-
BrowsingContext *Top()
-
static already_AddRefed<BrowsingContext> Get(uint64_t aId)
Look up a specific
BrowsingContext
by it’s unique ID. Callers should check if the returned context has already been discarded usingIsDiscarded
before using it.
-
WindowContext *GetParentWindowContext()
-
class CanonicalBrowsingContext : public BrowsingContext
When a
BrowsingContext
is constructed in the parent process, it is actually an instance ofCanonicalBrowsingContext
.Due to being in the parent process, more information about the context is available from a
CanonicalBrowsingContext
.
-
class WindowContext
-
class WindowGlobalParent : public WindowContext, public WindowGlobalActor, public PWindowGlobalParent
-
class WindowGlobalChild : public WindowGlobalActor, public PWindowGlobalChild