There are 3 major types of navigations, each of which can cause different objects to be replaced. The general rules look something like this:
objects replaced or preserved across navigationsClass/Id | in-process navigations <in-process navigations> |
cross-process navigations <cross-process navigations> |
cross-group navigations <cross-group navigations> |
---|---|---|---|
BrowserId1 | ✔️ preserved | ✔️ preserved | ✔️ preserved |
BrowsingContextWebProgress | ✔️ preserved | ✔️ preserved | ✔️ preserved |
BrowsingContextGroup | ✔️ preserved | ✔️ preserved | ❌ replaced |
BrowsingContext | ✔️ preserved | ✔️ preserved | ❌ replaced |
nsFrameLoader | ✔️ preserved | ❌ replaced | ❌ replaced |
RemoteBrowser | ✔️ preserved | ❌ replaced | ❌ replaced |
Browser{Parent,Child} | ✔️ preserved | ❌ replaced | ❌ replaced |
nsDocShell | ✔️ preserved | ❌ replaced | ❌ replaced |
nsGlobalWindowOuter | ✔️ preserved | ❌ replaced | ❌ replaced |
nsGlobalWindowInner | ❌ replaced2 | ❌ replaced | ❌ replaced |
WindowContext | ❌ replaced3 | ❌ replaced | ❌ replaced |
WindowGlobal{Parent,Child} | ❌ replaced4 | ❌ replaced | ❌ replaced |
Document | ❌ replaced | ❌ replaced | ❌ replaced |
An in-process navigation is the traditional type of navigation, and the most common type of navigation when Fission
is not enabled.
These navigations are used when no process switching or BrowsingContext replacement is required, which includes most navigations with Fission disabled, and most same site-origin navigations when Fission is enabled.
A cross-process navigation is used when a navigation requires a process switch to occur, and no BrowsingContext replacement is required. This is a common type of load when Fission
is enabled, though it is also used for navigations to and from special URLs like file://
URIs when Fission is disabled.
These process changes are triggered by DocumentLoadListener
when it determines that a process switch is required. See that class's documentation for more details.
A cross-group navigation is used when the navigation's response requires a browsing context group switch.
These types of switches may or may not cause the process to change, but will finish within a different BrowsingContextGroup
than they started with. Like cross-process navigations
, these navigations are triggered using the process switching logic in DocumentLoadListener
.
As the parent of a content browsing context cannot change due to a navigation, only toplevel content browsing contexts can cross-group navigate. Navigations in chrome browsing contexts5 or content subframes only experience either in-process or cross-process navigations.
As of the time of this writing, we currently trigger a cross-group navigation in the following circumstances, though this may change in the future:
- If the Cross-Origin-Opener-Policy header is specified, and a mismatch is detected.
- When switching processes between the parent process, and a content process.
- When loading an extension document in a toplevel browsing context.
- When navigating away from a preloaded
about:newtab
document. - When putting a
BrowsingContext
into BFCache for the session history in-parent BFCache implementation. This will happen on most toplevel navigations without opener relationships when thefission.bfcacheInParent
pref is enabled.
State which needs to be saved over cross-group navigations on BrowsingContext
instances is copied in the CanonicalBrowsingContext::ReplacedBy
method.
The BrowserId is a unique ID on each
BrowsingContext
object, obtained usingGetBrowserId
, not a class. This ID will persist even when aBrowsingContext
is replaced (e.g. due toCross-Origin-Opener-Policy
).↩When navigating from the initial
about:blank
document to a same-origin document, the samensGlobalWindowInner
,WindowContext
andWindowGlobal{Parent,Child}
may be used. This initialabout:blank
document is the one created when synchronously accessing a newly-created pop-up window fromwindow.open
, or a newly-created document in an<iframe>
.↩When navigating from the initial
about:blank
document to a same-origin document, the samensGlobalWindowInner
,WindowContext
andWindowGlobal{Parent,Child}
may be used. This initialabout:blank
document is the one created when synchronously accessing a newly-created pop-up window fromwindow.open
, or a newly-created document in an<iframe>
.↩When navigating from the initial
about:blank
document to a same-origin document, the samensGlobalWindowInner
,WindowContext
andWindowGlobal{Parent,Child}
may be used. This initialabout:blank
document is the one created when synchronously accessing a newly-created pop-up window fromwindow.open
, or a newly-created document in an<iframe>
.↩A chrome browsing context does not refer to pages with the system principal loaded in the content area such as
about:preferences
. Chrome browsing contexts are generally used as the root context in a chrome window, such wherebrowser.xhtml
is loaded for a browser window.All chrome browsing contexts exclusively load in the parent process and cannot process switch when navigating.↩