Bug 1434768 - Part 4: Create a ParentSHistory in nsFrameLoader, r=bz

This commit is contained in:
Nika Layzell
2018-02-01 17:56:54 -05:00
parent 3d4a532d9d
commit 1ea33d38de
4 changed files with 26 additions and 2 deletions

View File

@@ -148,7 +148,8 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsFrameLoader,
mDocShell,
mMessageManager,
mChildMessageManager,
mOpener)
mOpener,
mParentSHistory)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
@@ -2103,12 +2104,16 @@ nsFrameLoader::MaybeCreateDocShell()
return NS_ERROR_FAILURE;
}
// If we are an in-process browser, we want to set up our session history. We
// do this by creating both the child SHistory (which is in the nsDocShell),
// and creating the corresponding in-process ParentSHistory.
if (mIsTopLevelContent &&
mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
// XXX(nika): Set this up more explicitly?
nsresult rv = mDocShell->InitSessionHistory();
NS_ENSURE_SUCCESS(rv, rv);
mParentSHistory = new ParentSHistory(this);
}
OriginAttributes attrs;
@@ -2672,6 +2677,14 @@ nsFrameLoader::TryRemoteBrowser()
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
}
// Set up a parent SHistory
if (XRE_IsParentProcess()) {
// XXX(nika): Once we get out of process iframes we won't want to
// unconditionally set this up. What do we do for iframes in a chrome loaded
// document for example?
mParentSHistory = new ParentSHistory(this);
}
// Send down the name of the browser through mRemoteBrowser if it is set.
// Only do this on xul:browsers for now.
if (mOwnerContent->IsXULElement()) {