16. Browsing context
A browsing context is an
environment in which Document
objects are presented to the user.
The docshell is the toplevel object
responsible for managing a single
browsing context.
17. Session History
The sequence of Documents in a
browsing context is its session
history.
Session history consists of a flat list
of session history entries.
Session history entry =
URL + state + title + Document +
form data + scroll position + …, etc.
interface History {
readonly attribute long length;
readonly attribute any state;
void go(optional long delta);
void back();
void forward();
void pushState(any data, DOMString title,
optional DOMString? url = null);
void replaceState(any data, DOMString title,
optional DOMString? url = null);
};
20. Split Window
In SpiderMonkey, a split object is made up of two JSObjects: an inner
object and an outer object.
The inner window object is different for each page a browser window
visits. It serves as the "globals" object and provides the JSPrincipals for
scripts on that page.
The outer window object is the object returned by window.open. It
represents the window or tab itself and survives as the user navigates
in that window or tab.
The inner window => HTML5 Window object.
The outer window => HTML5 WindowProxy object.
30. DocLoader & DocShell Trees
• DocShells are organized as a tree, so as DocLoaders.
• nsDocShell inherits nsDocLoader.
• Multiple docshell trees with different item types can belong to the same
docloader tree.
• When looking for root docshell, it usually finds same-type root of a
subtree.
• DocShellTreeOwner points to a root docshell of a subtree.
31. nsIDocumentLoader / nsDocLoader
/**
* An nsIDocumentLoader is an interface responsible for tracking groups of
* loads that belong together (images, external scripts, etc) and subdocuments
* (<iframe>, <frame>, etc). It is also responsible for sending
* nsIWebProgressListener notifications.
* XXXbz this interface should go away, we think...
*/
[scriptable, uuid(bbe961ee-59e9-42bb-be50-0331979bb79f)]
interface nsIDocumentLoader : nsISupports
{
// Stop all loads in the loadgroup of this docloader
void stop();
// XXXbz is this needed? For embedding? What this does is does is not
// defined by this interface!
readonly attribute nsISupports container;
// The loadgroup associated with this docloader
readonly attribute nsILoadGroup loadGroup;
// The defaultLoadRequest of the loadgroup associated with this docloader
readonly attribute nsIChannel documentChannel;
};
32. chrome / non-e10s process
Chrome or non-e10s Tree
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
do_GetService(“@mozilla.org/docloaderservice;1”)
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
chrome tree owner
content tree owner
33. chrome / non-e10s process
Chrome or non-e10s Tree
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
do_GetService(“@mozilla.org/docloaderservice;1”)
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
chrome tree owner
content tree owner
35. e10s content process
Content Tree in e10s
nsDocLoader
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
do_GetService(“@mozilla.org/docloaderservice;1”)
tab A tree owner
tab B tree owner
37. DocShell Item Type & Frame Type
interface nsIDocShellTreeItem : nsISupports
{
/*
Definitions for the item types.
*/
const long typeChrome=0;
const long typeContent=1;
const long typeContentWrapper=2;
const long typeChromeWrapper=3;
const long typeAll=0x7FFFFFFF;
/*
The type this item is.
*/
attribute long itemType;
…
}
class DocShell
{
protected:
enum FrameType
{
eFrameTypeRegular,
eFrameTypeBrowser,
eFrameTypeApp
};
…
}
Tree traversals are often based on:
app or browser boundaries.
content / chrome item boundaries.
tree owner equality.
47. Session History
• Only root docshell holds nsISHistory, which represents the session history.
• All nsISHEntry of subframes are managed by nsISHistory of the root.
• An entry can have children entries, indicate subframes.
• When a subframe adds a history entry, the root entry along with all its
children are cloned to create a new root entry to the session history.
53. “Browser” may refer to
browser.xul,
<tabbrowser/>, <browser/>, gBrowser
nsWebBrowser
TabParent (nsFrameLoader::mRemoteBrowser)
“Window” may refer to
The browser window / nsXULWindow / nsWebShellWindow
nsIBaseWindow and its parentNativeWindow
nsIDOMWindow / mozIDOMWindow / mozIDOMWindowProxy
nsPIDOMWindow / nsPIDOMWindowInner / nsPIDOMWindowOuter
nsGlobalWindow
54. The lifetime of inner window associates to the document.
The lifetime of outer window associates to the browsing context.
nsFrameLoader is responsible to
Create correct type of nsDocShell or e10s TabParent.
Hold the message manager for e10s communication.
nsIDocShellTreeOwner is used to
Find items.
Get notification interface for the nsDocShell tree.