mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1668215 - Bail out loading if the SessionHistoryEntry for LoadingSessionHistoryInfo isn't available anymore, r=peterv
I haven't managed to reproduce the crash Differential Revision: https://phabricator.services.mozilla.com/D92150
This commit is contained in:
parent
19eb2d240b
commit
5cb8d35726
@ -359,6 +359,9 @@ CanonicalBrowsingContext::CreateLoadingSessionHistoryEntryForLoad(
|
||||
MOZ_LOG(gSHLog, LogLevel::Verbose,
|
||||
("SHEntry::GetByLoadId(%" PRIu64 ") -> %p",
|
||||
existingLoadingInfo->mLoadId, entry.get()));
|
||||
if (!entry) {
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
entry = new SessionHistoryEntry(aLoadState, aChannel);
|
||||
if (IsTop()) {
|
||||
|
@ -477,6 +477,21 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* documentContext = GetDocumentBrowsingContext();
|
||||
if (documentContext && mozilla::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 =
|
||||
documentContext->CreateLoadingSessionHistoryEntryForLoad(aLoadState,
|
||||
mChannel);
|
||||
if (!mLoadingSessionHistoryInfo) {
|
||||
*aRv = NS_BINDING_ABORTED;
|
||||
mParentChannelListener = nullptr;
|
||||
mChannel = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uriBeingLoaded;
|
||||
Unused << NS_WARN_IF(
|
||||
NS_FAILED(mChannel->GetURI(getter_AddRefs(uriBeingLoaded))));
|
||||
@ -539,7 +554,6 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
|
||||
// across any serviceworker related data between channels as needed.
|
||||
AddClientChannelHelperInParent(mChannel, std::move(aInfo));
|
||||
|
||||
auto* documentContext = GetDocumentBrowsingContext();
|
||||
if (documentContext && !documentContext->StartDocumentLoad(this)) {
|
||||
LOG(("DocumentLoadListener::Open failed StartDocumentLoad [this=%p]",
|
||||
this));
|
||||
@ -627,13 +641,6 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState,
|
||||
mSrcdocData = aLoadState->SrcdocData();
|
||||
mBaseURI = aLoadState->BaseURI();
|
||||
mOriginalUriString = aLoadState->GetOriginalURIString();
|
||||
if (documentContext && mozilla::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 =
|
||||
documentContext->CreateLoadingSessionHistoryEntryForLoad(aLoadState,
|
||||
mChannel);
|
||||
}
|
||||
if (documentContext) {
|
||||
mParentWindowContext = documentContext->GetParentWindowContext();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user