Skip to content

Commit

Permalink
Backed out changeset 88337b6e4e3e (bug 1666881) for causing failures …
Browse files Browse the repository at this point in the history
…regarding the fission.autostart pref.

CLOSED TREE
  • Loading branch information
Mihai Alexandru Michis committed Sep 24, 2020
1 parent b2867ee commit a93e42c
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 103 deletions.
10 changes: 4 additions & 6 deletions docshell/base/BrowsingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ void BrowsingContext::CreateFromIPC(BrowsingContext::IPCInitializer&& aInit,
context->mCreatedDynamically = aInit.mCreatedDynamically;
if (context->GetHasSessionHistory()) {
context->CreateChildSHistory();
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
context->GetChildSessionHistory()->SetIndexAndLength(
aInit.mSessionHistoryIndex, aInit.mSessionHistoryCount, nsID());
}
Expand Down Expand Up @@ -2084,8 +2084,7 @@ BrowsingContext::IPCInitializer BrowsingContext::GetIPCInitializer() {
init.mUseRemoteSubframes = mUseRemoteSubframes;
init.mCreatedDynamically = mCreatedDynamically;
init.mOriginAttributes = mOriginAttributes;
if (mChildSessionHistory &&
StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (mChildSessionHistory && StaticPrefs::fission_sessionHistoryInParent()) {
init.mSessionHistoryIndex = mChildSessionHistory->Index();
init.mSessionHistoryCount = mChildSessionHistory->Count();
}
Expand Down Expand Up @@ -2583,7 +2582,7 @@ void BrowsingContext::InitSessionHistory() {
}

ChildSHistory* BrowsingContext::GetChildSessionHistory() {
if (!StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (!StaticPrefs::fission_sessionHistoryInParent()) {
// For now we're checking that the session history object for the child
// process is available before returning the ChildSHistory object, because
// it is the actual implementation that ChildSHistory forwards to. This can
Expand Down Expand Up @@ -2641,8 +2640,7 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_PendingInitialization>,

void BrowsingContext::SessionHistoryChanged(int32_t aIndexDelta,
int32_t aLengthDelta) {
if (XRE_IsParentProcess() ||
StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (XRE_IsParentProcess() || StaticPrefs::fission_sessionHistoryInParent()) {
// This method is used to test index and length for the session history
// in child process only.
return;
Expand Down
119 changes: 58 additions & 61 deletions docshell/base/nsDocShell.cpp

Large diffs are not rendered by default.

24 changes: 11 additions & 13 deletions docshell/shistory/ChildSHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,22 @@ void ChildSHistory::SetIsInProcess(bool aIsInProcess) {
return;
}

if (mHistory || StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (mHistory || StaticPrefs::fission_sessionHistoryInParent()) {
return;
}

mHistory = new nsSHistory(mBrowsingContext);
}

int32_t ChildSHistory::Count() {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup() ||
mAsyncHistoryLength) {
if (StaticPrefs::fission_sessionHistoryInParent() || mAsyncHistoryLength) {
uint32_t length = mLength;
for (uint32_t i = 0; i < mPendingSHistoryChanges.Length(); ++i) {
length += mPendingSHistoryChanges[i].mLengthDelta;
}

if (mAsyncHistoryLength) {
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent_AtStartup());
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent());
// XXX The assertion may be too strong here, but it fires only
// when the pref is enabled.
MOZ_ASSERT(mHistory->GetCount() == int32_t(length));
Expand All @@ -60,15 +59,14 @@ int32_t ChildSHistory::Count() {
}

int32_t ChildSHistory::Index() {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup() ||
mAsyncHistoryLength) {
if (StaticPrefs::fission_sessionHistoryInParent() || mAsyncHistoryLength) {
uint32_t index = mIndex;
for (uint32_t i = 0; i < mPendingSHistoryChanges.Length(); ++i) {
index += mPendingSHistoryChanges[i].mIndexDelta;
}

if (mAsyncHistoryLength) {
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent_AtStartup());
MOZ_ASSERT(!StaticPrefs::fission_sessionHistoryInParent());
int32_t realIndex;
mHistory->GetIndex(&realIndex);
// XXX The assertion may be too strong here, but it fires only
Expand Down Expand Up @@ -108,7 +106,7 @@ void ChildSHistory::SetIndexAndLength(uint32_t aIndex, uint32_t aLength,
}

void ChildSHistory::Reload(uint32_t aReloadFlags, ErrorResult& aRv) {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
if (XRE_IsParentProcess()) {
nsISHistory* shistory =
mBrowsingContext->Canonical()->GetSessionHistory();
Expand Down Expand Up @@ -152,7 +150,7 @@ void ChildSHistory::Go(int32_t aOffset, bool aRequireUserInteraction,
}

// See Bug 1650095.
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
break;
}

Expand Down Expand Up @@ -190,7 +188,7 @@ void ChildSHistory::AsyncGo(int32_t aOffset, bool aRequireUserInteraction,
}

void ChildSHistory::GotoIndex(int32_t aIndex, ErrorResult& aRv) {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
nsCOMPtr<nsISHistory> shistory = mHistory;
mBrowsingContext->HistoryGo(aIndex, [shistory](int32_t&& aRequestedIndex) {
// FIXME Should probably only do this for non-fission.
Expand All @@ -208,13 +206,13 @@ void ChildSHistory::RemovePendingHistoryNavigations() {
}

void ChildSHistory::EvictLocalContentViewers() {
if (!StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (!StaticPrefs::fission_sessionHistoryInParent()) {
mHistory->EvictAllContentViewers();
}
}

nsISHistory* ChildSHistory::GetLegacySHistory(ErrorResult& aError) {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
aError.ThrowTypeError(
"legacySHistory is not available with session history in the parent.");
return nullptr;
Expand Down Expand Up @@ -251,7 +249,7 @@ nsISupports* ChildSHistory::GetParentObject() const {
}

void ChildSHistory::SetAsyncHistoryLength(bool aEnable, ErrorResult& aRv) {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup() || !mHistory) {
if (StaticPrefs::fission_sessionHistoryInParent() || !mHistory) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
Expand Down
13 changes: 6 additions & 7 deletions docshell/shistory/nsSHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ uint32_t nsSHistory::CalcMaxTotalViewers() {
// static
void nsSHistory::UpdatePrefs() {
Preferences::GetInt(PREF_SHISTORY_SIZE, &gHistoryMaxSize);
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
sHistoryMaxTotalViewers = 0;
return;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ nsresult nsSHistory::WalkHistoryEntries(nsISHEntry* aRootEntry,
// If the SH pref is on and we are in the parent process, update
// canonical BC directly
bool foundChild = false;
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup() &&
if (StaticPrefs::fission_sessionHistoryInParent() &&
XRE_IsParentProcess()) {
if (child->Canonical()->HasHistoryEntry(childEntry)) {
childBC = child;
Expand Down Expand Up @@ -681,7 +681,7 @@ nsresult nsSHistory::SetChildHistoryEntry(nsISHEntry* aEntry,
void nsSHistory::HandleEntriesToSwapInDocShell(
mozilla::dom::BrowsingContext* aBC, nsISHEntry* aOldEntry,
nsISHEntry* aNewEntry) {
bool shPref = StaticPrefs::fission_sessionHistoryInParent_AtStartup();
bool shPref = StaticPrefs::fission_sessionHistoryInParent();
if (aBC->IsInProcess() || !shPref) {
nsDocShell* docshell = static_cast<nsDocShell*>(aBC->GetDocShell());
if (docshell) {
Expand Down Expand Up @@ -1825,7 +1825,7 @@ void nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
// a same-document navigation (see nsDocShell::IsSameDocumentNavigation), so
// record that here in the LoadingSessionHistoryEntry.
bool loadingFromActiveEntry;
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
loadingFromActiveEntry =
aFrameBC->Canonical()->GetActiveSessionHistoryEntry() == aFrameEntry;
} else {
Expand All @@ -1836,7 +1836,7 @@ void nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
loadState->SetLoadIsFromSessionHistory(mRequestedIndex, Length(),
loadingFromActiveEntry);

if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
nsCOMPtr<SessionHistoryEntry> she = do_QueryInterface(aFrameEntry);
aFrameBC->Canonical()->AddLoadingSessionHistoryEntry(
loadState->GetLoadingSessionHistoryInfo()->mLoadId, she);
Expand All @@ -1861,8 +1861,7 @@ void nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
NS_IMETHODIMP
nsSHistory::CreateEntry(nsISHEntry** aEntry) {
nsCOMPtr<nsISHEntry> entry;
if (XRE_IsParentProcess() &&
StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (XRE_IsParentProcess() && StaticPrefs::fission_sessionHistoryInParent()) {
entry = new SessionHistoryEntry();
} else {
entry = new nsSHEntry();
Expand Down
3 changes: 1 addition & 2 deletions dom/base/nsCCUncollectableMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ void MarkDocShell(nsIDocShellTreeItem* aNode, bool aCleanupJS) {
nsISHistory* legacyHistory =
history ? history->GetLegacySHistory(ignore) : nullptr;
if (legacyHistory) {
MOZ_DIAGNOSTIC_ASSERT(
!StaticPrefs::fission_sessionHistoryInParent_AtStartup());
MOZ_DIAGNOSTIC_ASSERT(!StaticPrefs::fission_sessionHistoryInParent());
int32_t historyCount = history->Count();
for (int32_t i = 0; i < historyCount; ++i) {
nsCOMPtr<nsISHEntry> shEntry;
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ void nsFrameLoader::StartDestroy(bool aForProcessSwitch) {
RefPtr<ChildSHistory> childSHistory =
browsingContext->Top()->GetChildSessionHistory();
if (childSHistory) {
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
browsingContext->RemoveFromSessionHistory();
} else {
AutoTArray<nsID, 16> ids({browsingContext->GetHistoryID()});
Expand Down
2 changes: 1 addition & 1 deletion dom/base/nsGlobalWindowOuter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6348,7 +6348,7 @@ bool nsGlobalWindowOuter::IsOnlyTopLevelDocumentInSHistory() {
// Disabled since IsFrame() is buggy in Fission
// MOZ_ASSERT(mBrowsingContext->IsTop());

if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
return mBrowsingContext->GetIsSingleToplevelInHistory();
}

Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/BrowserChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3450,7 +3450,7 @@ nsresult BrowserChild::CanCancelContentJS(

// If we have session history in the parent we've already performed
// the checks following, so we can return early.
if (StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (StaticPrefs::fission_sessionHistoryInParent()) {
*aCanCancel = true;
return NS_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/BrowserParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3519,7 +3519,7 @@ bool BrowserParent::CanCancelContentJS(
nsIURI* aNavigationURI) const {
// Pre-checking if we can cancel content js in the parent is only
// supported when session history in the parent is enabled.
if (!StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (!StaticPrefs::fission_sessionHistoryInParent()) {
// If session history in the parent isn't enabled, this check will
// be fully done in BrowserChild::CanCancelContentJS
return true;
Expand Down
2 changes: 1 addition & 1 deletion layout/base/nsDocumentViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ nsDocumentViewer::Show(void) {
treeItem->GetInProcessSameTypeRootTreeItem(getter_AddRefs(root));
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(root);
RefPtr<ChildSHistory> history = webNav->GetSessionHistory();
if (!StaticPrefs::fission_sessionHistoryInParent_AtStartup() && history) {
if (!StaticPrefs::fission_sessionHistoryInParent() && history) {
int32_t prevIndex, loadedIndex;
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(treeItem);
docShell->GetPreviousEntryIndex(&prevIndex);
Expand Down
2 changes: 1 addition & 1 deletion modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,7 @@
- name: fission.sessionHistoryInParent
type: bool
value: false
mirror: once
mirror: always

# Allow renaming of process names to the origin on nightly
# Setting this pref creates a privacy leak, but helps greatly with
Expand Down
3 changes: 1 addition & 2 deletions netwerk/ipc/DocumentLoadListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
mSrcdocData = aLoadState->SrcdocData();
mBaseURI = aLoadState->BaseURI();
mOriginalUriString = aLoadState->GetOriginalURIString();
if (documentContext &&
StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
if (documentContext && StaticPrefs::fission_sessionHistoryInParent()) {
// It's hard to know at this point whether session history will be enabled
// in the browsing context, so we always create an entry for a load here.
mLoadingSessionHistoryInfo =
Expand Down
3 changes: 1 addition & 2 deletions netwerk/ipc/ParentProcessDocumentChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ ParentProcessDocumentChannel::RedirectToRealChannel(
mStreamFilterEndpoints = std::move(aStreamFilterEndpoints);

if (mDocumentLoadListener->IsDocumentLoad() &&
StaticPrefs::fission_sessionHistoryInParent_AtStartup() &&
GetDocShell()) {
StaticPrefs::fission_sessionHistoryInParent() && GetDocShell()) {
GetDocShell()->SetLoadingSessionHistoryInfo(
*mDocumentLoadListener->GetLoadingSessionHistoryInfo());
}
Expand Down
6 changes: 2 additions & 4 deletions toolkit/components/sessionstore/SessionStoreListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ ContentSessionStore::ContentSessionStore(nsIDocShell* aDocShell)
mFormDataChanged(NO_CHANGE),
mStorageStatus(NO_STORAGE),
mDocCapChanged(false),
mSHistoryInParent(
StaticPrefs::fission_sessionHistoryInParent_AtStartup()),
mSHistoryInParent(StaticPrefs::fission_sessionHistoryInParent()),
mSHistoryChanged(false),
mSHistoryChangedFromParent(false) {
MOZ_ASSERT(mDocShell);
Expand Down Expand Up @@ -170,8 +169,7 @@ TabListener::TabListener(nsIDocShell* aDocShell, Element* aElement)
mTimeoutDisabled(false),
mUpdateInterval(15000),
mEpoch(0),
mSHistoryInParent(
StaticPrefs::fission_sessionHistoryInParent_AtStartup()) {
mSHistoryInParent(StaticPrefs::fission_sessionHistoryInParent()) {
MOZ_ASSERT(mDocShell);
}

Expand Down

0 comments on commit a93e42c

Please sign in to comment.