6. Prerender in Chromium
• Minimizing resource contention.
• Handling dynamic media [video,
audio, plugins, canvas]
• Cancellation of pages on certain
corner cases.
• Minimizing server side effects.
• Mutations to shared local storage
[cookies, sessionStorage, etc.]
Main concerns:
credit: https://www.chromium.org/developers/design-documents/prerender
7. Prerender Cancellation in Chromium
• The top-level page is not an HTTP/HTTPS scheme, either on the initial link or during any server-side or client-
side redirects. For example, both ftp are canceled. Content scripts are allowed to run on prerendered pages.
• window.opener would be non-null when the page is navigated to.
• A download is triggered. The download is cancelled before it starts.
• A request is issued which is not a GET, HEAD, POST, OPTIONS, or TRACE.
• A authentication prompt would appear.
• An SSL Client Certificate is requested and requires the user to select a certificate.
• A script tries to open a new window.
• alert() is called.
• window.print() is called.
• Any of the resources on the page are flagged by Safe Browsing as malware or phishing.
• The fragment on the page does not match the navigated-to location.
21. 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
22. 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
23. 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
35. 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.
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
36. 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);
};
44. 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.
47. Nested Windows
var w = window.self;
browsing context
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
48. Nested Windows
var w = window.self;
var w = window.parent;
var w = window.top;
browsing context
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
59. Swapping DocShells vs. ContentViewers
• Swapping DocShells.
• The bfcache issue.
• Swapping ContentViewers.
• Almost impossible to prerender out-of-process.
60. Solutions?
• Connects multiple session histories.
• With pseudo history entries, or
• With mIndexOffset, mExtraLength
• How to update SessionStore?
• How to manage lifetime of grouped tabs?
• Other ways?
62. Process Models in Chromium
• Process-per-site-instance (*)
• Process-per-site
• Process-per-tab
• Single process
credit:
https://www.chromium.org/developers/design-documents/process-models
http://www.aosabook.org/en/posa/high-performance-networking-in-chrome.html
63. General Limitations
• Script-connected tabs (unit of related browsing contexts) are always in the
same process.
http://w3c.github.io/html/single-page.html#groupings-of-browsing-contexts
• Chromium only swaps renderer processes for browser-initiated cross-site
navigations, such as typing a URL in the location bar or following a
bookmark (unless using rel=noreferrer target=_blank).
• Subframes are currently rendered in the same process as their parent
page (OOPIF is ongoing).
• There is a limit to the number of renderer processes that Chromium will
create.
64. Out-of-Process iframes
(OOPIFs)
• Process-per-frame, or more
preciously unit of related similar-
origin browsing context.
http://w3c.github.io/html/single-page.html#units-of-
related-similar-origin-browsing-contexts
• Support more JS-IPC excluding
those need access to page
content.
• On the way to Site Isolation.
https://www.chromium.org/developers/design-
documents/site-isolation
credit: https://www.chromium.org/developers/design-documents/oop-iframes