Commit 6c8ad68e authored by Kyle Machulis's avatar Kyle Machulis
Browse files

Bug 1540839 - Add pref for preserving browsing contexts; r=nika

Still having lots of issues with tests failing, but need to get this
landed for various reasons. Followup to pref on at Bug 1550571.

Differential Revision: https://phabricator.services.mozilla.com/D30563
parent 6b960a04
......@@ -813,6 +813,21 @@ void BrowsingContext::Transaction::Apply(BrowsingContext* aBrowsingContext,
#include "mozilla/dom/BrowsingContextFieldList.h"
}
BrowsingContext::IPCInitializer BrowsingContext::GetIPCInitializer() {
MOZ_ASSERT(
!mozilla::Preferences::GetBool("fission.preserve_browsing_contexts", false) ||
IsContent());
IPCInitializer init;
init.mId = Id();
init.mParentId = mParent ? mParent->Id() : 0;
init.mCached = IsCached();
#define MOZ_BC_FIELD(name, type) init.m##name = m##name;
#include "mozilla/dom/BrowsingContextFieldList.h"
return init;
}
already_AddRefed<BrowsingContext> BrowsingContext::IPCInitializer::GetParent() {
RefPtr<BrowsingContext> parent;
if (mParentId != 0) {
......
......@@ -347,17 +347,7 @@ class BrowsingContext : public nsWrapperCache,
};
// Create an IPCInitializer object for this BrowsingContext.
IPCInitializer GetIPCInitializer() {
MOZ_ASSERT(IsContent());
IPCInitializer init;
init.mId = Id();
init.mParentId = mParent ? mParent->Id() : 0;
init.mCached = IsCached();
#define MOZ_BC_FIELD(name, type) init.m##name = m##name;
#include "mozilla/dom/BrowsingContextFieldList.h"
return init;
}
IPCInitializer GetIPCInitializer();
// Create a BrowsingContext object from over IPC.
static already_AddRefed<BrowsingContext> CreateFromIPC(
......
......@@ -46,8 +46,8 @@ void nsFrameLoaderOwner::ChangeRemoteness(
// If this is a process switch due to a difference in Cross Origin Opener
// Policy, do not preserve the browsing context. Otherwise, save off the
// browsing context and use it when creating our new FrameLoader.
if (!aOptions.mReplaceBrowsingContext &&
!isChromeRemoteToLocal) {
if (!aOptions.mReplaceBrowsingContext && !isChromeRemoteToLocal &&
mozilla::Preferences::GetBool("fission.preserve_browsing_contexts", false)) {
bc = mFrameLoader->GetBrowsingContext();
mFrameLoader->SkipBrowsingContextDetach();
}
......
......@@ -6043,6 +6043,10 @@ pref("dom.sidebar.enabled", true);
// Turn on fission frameloader swapping
pref("fission.rebuild_frameloaders_on_remoteness_change", true);
// If true, preserve browsing contexts between process swaps. Should be set to
// true in bug 1550571.
pref("fission.preserve_browsing_contexts", false);
// Support for legacy customizations that rely on checking the
// user profile directory for these stylesheets:
// * userContent.css
......
......@@ -45,7 +45,10 @@ add_task(async function oopProcessSwap() {
});
is(browser.browsingContext.getChildren().length, 1);
is(frameId, oopinfo.browsingContextId, `BrowsingContext should not have changed (${frameId} != ${oopinfo.browsingContextId})`);
if (Services.prefs.getBoolPref("fission.preserve_browsing_contexts")) {
is(frameId, oopinfo.browsingContextId, `BrowsingContext should not have changed (${frameId} != ${oopinfo.browsingContextId})`);
}
is(oopinfo.location, WEB, "correct location");
});
......@@ -99,7 +102,9 @@ add_task(async function oopOriginProcessSwap() {
});
is(browser.browsingContext.getChildren().length, 1);
is(frameId, oopinfo.browsingContextId, `BrowsingContext should not have changed (${frameId} != ${oopinfo.browsingContextId})`);
if (Services.prefs.getBoolPref("fission.preserve_browsing_contexts")) {
is(frameId, oopinfo.browsingContextId, `BrowsingContext should not have changed (${frameId} != ${oopinfo.browsingContextId})`);
}
is(oopinfo.location, ORG_POSTMSG, "correct location");
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment