зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1668940) for causing bc failures.
CLOSED TREE Backed out changeset c025fad53568 (bug 1668940) Backed out changeset 9d98bf7b930f (bug 1668940)
This commit is contained in:
Родитель
9a7d0929fc
Коммит
6ad7b7e9dd
|
@ -3987,6 +3987,13 @@ nsresult nsDocShell::LoadErrorPage(nsIURI* aErrorURI, nsIURI* aFailedURI,
|
|||
// identifier, the error page won't persist.
|
||||
mLSHE->AbandonBFCacheEntry();
|
||||
}
|
||||
if (mozilla::SessionHistoryInParent()) {
|
||||
// Commit the loading entry for the real load here, Embed will not commit
|
||||
// the loading entry for the error page. History will then contain an entry
|
||||
// for the real load, and the error page won't persist if we try loading
|
||||
// that entry again.
|
||||
MoveLoadingToActiveEntry(true);
|
||||
}
|
||||
|
||||
RefPtr<nsDocShellLoadState> loadState = new nsDocShellLoadState(aErrorURI);
|
||||
loadState->SetTriggeringPrincipal(nsContentUtils::GetSystemPrincipal());
|
||||
|
@ -3996,12 +4003,6 @@ nsresult nsDocShell::LoadErrorPage(nsIURI* aErrorURI, nsIURI* aFailedURI,
|
|||
loadState->SetLoadType(LOAD_ERROR_PAGE);
|
||||
loadState->SetFirstParty(true);
|
||||
loadState->SetSourceBrowsingContext(mBrowsingContext);
|
||||
if (mozilla::SessionHistoryInParent() && mLoadingEntry) {
|
||||
// We keep the loading entry for the load that failed here. If the user
|
||||
// reloads we want to try to reload the original load, not the error page.
|
||||
loadState->SetLoadingSessionHistoryInfo(
|
||||
MakeUnique<LoadingSessionHistoryInfo>(*mLoadingEntry));
|
||||
}
|
||||
return InternalLoad(loadState);
|
||||
}
|
||||
|
||||
|
@ -5704,7 +5705,7 @@ nsresult nsDocShell::Embed(nsIContentViewer* aContentViewer,
|
|||
|
||||
if (!aIsTransientAboutBlank && mozilla::SessionHistoryInParent()) {
|
||||
MOZ_LOG(gSHLog, LogLevel::Debug, ("document %p Embed", this));
|
||||
MoveLoadingToActiveEntry();
|
||||
MoveLoadingToActiveEntry(mLoadType != LOAD_ERROR_PAGE);
|
||||
}
|
||||
|
||||
bool updateHistory = true;
|
||||
|
@ -13241,7 +13242,7 @@ void nsDocShell::SetLoadingSessionHistoryInfo(
|
|||
mLoadingEntry = MakeUnique<LoadingSessionHistoryInfo>(aLoadingInfo);
|
||||
}
|
||||
|
||||
void nsDocShell::MoveLoadingToActiveEntry() {
|
||||
void nsDocShell::MoveLoadingToActiveEntry(bool aCommit) {
|
||||
MOZ_ASSERT(mozilla::SessionHistoryInParent());
|
||||
|
||||
MOZ_LOG(gSHLog, LogLevel::Debug,
|
||||
|
@ -13260,14 +13261,12 @@ void nsDocShell::MoveLoadingToActiveEntry() {
|
|||
mLoadingEntry.swap(loadingEntry);
|
||||
}
|
||||
|
||||
if (mActiveEntry) {
|
||||
if (mActiveEntry && aCommit) {
|
||||
MOZ_ASSERT(loadingEntry);
|
||||
nsID changeID = {};
|
||||
uint32_t loadType =
|
||||
mLoadType == LOAD_ERROR_PAGE ? mFailedLoadType : mLoadType;
|
||||
if (XRE_IsParentProcess()) {
|
||||
mBrowsingContext->Canonical()->SessionHistoryCommit(loadingEntry->mLoadId,
|
||||
changeID, loadType);
|
||||
changeID, mLoadType);
|
||||
} else {
|
||||
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
|
||||
if (rootSH) {
|
||||
|
@ -13283,7 +13282,7 @@ void nsDocShell::MoveLoadingToActiveEntry() {
|
|||
}
|
||||
ContentChild* cc = ContentChild::GetSingleton();
|
||||
mozilla::Unused << cc->SendHistoryCommit(
|
||||
mBrowsingContext, loadingEntry->mLoadId, changeID, loadType);
|
||||
mBrowsingContext, loadingEntry->mLoadId, changeID, mLoadType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1104,7 +1104,7 @@ class nsDocShell final : public nsDocLoader,
|
|||
// Sets the active entry to the current loading entry. If aCommit is true then
|
||||
// SessionHistoryCommit will be called on the CanonicalBrowsingContext
|
||||
// (directly or over IPC).
|
||||
void MoveLoadingToActiveEntry();
|
||||
void MoveLoadingToActiveEntry(bool aCommit);
|
||||
|
||||
private: // data members
|
||||
nsString mTitle;
|
||||
|
|
|
@ -177,6 +177,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
|
|||
mChildID(0),
|
||||
mRemoteType(NOT_REMOTE_TYPE),
|
||||
mDepthTooGreat(false),
|
||||
mIsTopLevelContent(false),
|
||||
mDestroyCalled(false),
|
||||
mNeedsAsyncDestroy(false),
|
||||
mInSwap(false),
|
||||
|
@ -868,7 +869,7 @@ void nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
|||
CheckDocShellType(mOwnerContent, aItem, TypeAttrName(mOwnerContent)),
|
||||
"Correct ItemType should be set when creating BrowsingContext");
|
||||
|
||||
if (mPendingBrowsingContext->IsTopContent()) {
|
||||
if (mIsTopLevelContent) {
|
||||
bool is_primary = mOwnerContent->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::primary, nsGkAtoms::_true, eIgnoreCase);
|
||||
if (aOwner) {
|
||||
|
@ -1237,11 +1238,13 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool ourHasHistory = mPendingBrowsingContext->IsTop() &&
|
||||
mPendingBrowsingContext->GetHasSessionHistory();
|
||||
bool ourHasHistory =
|
||||
mIsTopLevelContent && ourContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!ourContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory);
|
||||
bool otherHasHistory =
|
||||
aOther->mPendingBrowsingContext->IsTop() &&
|
||||
aOther->mPendingBrowsingContext->GetHasSessionHistory();
|
||||
aOther->mIsTopLevelContent &&
|
||||
otherContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!otherContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory);
|
||||
if (ourHasHistory != otherHasHistory) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1859,8 +1862,7 @@ void nsFrameLoader::StartDestroy(bool aForProcessSwitch) {
|
|||
bool dynamicSubframeRemoval = false;
|
||||
if (mOwnerContent) {
|
||||
doc = mOwnerContent->OwnerDoc();
|
||||
dynamicSubframeRemoval =
|
||||
mPendingBrowsingContext->IsFrame() && !doc->InUnlinkOrDeletion();
|
||||
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
|
||||
doc->SetSubDocumentFor(mOwnerContent, nullptr);
|
||||
MaybeUpdatePrimaryBrowserParent(eBrowserParentRemoved);
|
||||
SetOwnerContent(nullptr);
|
||||
|
@ -1885,7 +1887,7 @@ void nsFrameLoader::StartDestroy(bool aForProcessSwitch) {
|
|||
}
|
||||
|
||||
// Let the tree owner know we're gone.
|
||||
if (mPendingBrowsingContext->IsTopContent()) {
|
||||
if (mIsTopLevelContent) {
|
||||
if (GetDocShell()) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentItem;
|
||||
GetDocShell()->GetInProcessParent(getter_AddRefs(parentItem));
|
||||
|
@ -2126,7 +2128,9 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
|||
|
||||
InvokeBrowsingContextReadyCallback();
|
||||
|
||||
if (mPendingBrowsingContext->IsTopContent()) {
|
||||
mIsTopLevelContent = mPendingBrowsingContext->IsTopContent();
|
||||
|
||||
if (mIsTopLevelContent) {
|
||||
// Manually add ourselves to our parent's docshell, as BrowsingContext won't
|
||||
// have done this for us.
|
||||
//
|
||||
|
@ -2189,8 +2193,7 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
|||
NS_ENSURE_STATE(mOwnerContent);
|
||||
|
||||
// If we are an in-process browser, we want to set up our session history.
|
||||
if (mPendingBrowsingContext->IsTopContent() &&
|
||||
mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
if (mIsTopLevelContent && mOwnerContent->IsXULElement(nsGkAtoms::browser) &&
|
||||
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::disablehistory)) {
|
||||
// XXX(nika): Set this up more explicitly?
|
||||
mPendingBrowsingContext->InitSessionHistory();
|
||||
|
@ -2897,8 +2900,7 @@ nsresult nsFrameLoader::EnsureMessageManager() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mPendingBrowsingContext->IsTopContent() && !OwnerIsMozBrowserFrame() &&
|
||||
!IsRemoteFrame() &&
|
||||
if (!mIsTopLevelContent && !OwnerIsMozBrowserFrame() && !IsRemoteFrame() &&
|
||||
!(mOwnerContent->IsXULElement() &&
|
||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::forcemessagemanager,
|
||||
|
|
|
@ -530,6 +530,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
|||
nsCString mRemoteType;
|
||||
|
||||
bool mDepthTooGreat : 1;
|
||||
bool mIsTopLevelContent : 1;
|
||||
bool mDestroyCalled : 1;
|
||||
bool mNeedsAsyncDestroy : 1;
|
||||
bool mInSwap : 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче