Bug 1614847 - Construct nsDocShellLoadState in ContentChild to avoid needing to pass excess parameters into nsDocShell. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D63267
This commit is contained in:
Matt Woodrow
2020-02-24 02:16:24 +00:00
parent 26a682d797
commit d873efea87
4 changed files with 34 additions and 36 deletions

View File

@@ -12741,28 +12741,22 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
// Call into InternalLoad with the pending channel when it is received.
cpcl->RegisterCallback(
aIdentifier,
[self, aHistoryIndex](nsIChannel* aChannel,
[self, aHistoryIndex](nsDocShellLoadState* aLoadState,
nsTArray<net::DocumentChannelRedirect>&& aRedirects,
uint32_t aLoadStateLoadFlags,
nsDOMNavigationTiming* aTiming) {
MOZ_ASSERT(aLoadState->GetPendingRedirectedChannel());
if (NS_WARN_IF(self->mIsBeingDestroyed)) {
aChannel->Cancel(NS_BINDING_ABORTED);
aLoadState->GetPendingRedirectedChannel()->Cancel(NS_BINDING_ABORTED);
return;
}
RefPtr<nsDocShellLoadState> loadState;
nsresult rv = nsDocShellLoadState::CreateFromPendingChannel(
aChannel, getter_AddRefs(loadState));
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
loadState->SetLoadFlags(aLoadStateLoadFlags);
nsCOMPtr<nsIURI> previousURI;
uint32_t previousFlags = 0;
ExtractLastVisit(aChannel, getter_AddRefs(previousURI), &previousFlags);
self->SavePreviousRedirectsAndLastVisit(aChannel, previousURI,
previousFlags, aRedirects);
ExtractLastVisit(aLoadState->GetPendingRedirectedChannel(),
getter_AddRefs(previousURI), &previousFlags);
self->SavePreviousRedirectsAndLastVisit(
aLoadState->GetPendingRedirectedChannel(), previousURI,
previousFlags, aRedirects);
MOZ_ASSERT(
(self->mCurrentURI && NS_IsAboutBlank(self->mCurrentURI)) ||
@@ -12777,16 +12771,16 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
self->mSessionHistory->LegacySHistory();
nsCOMPtr<nsISHEntry> entry;
rv = legacySHistory->GetEntryAtIndex(aHistoryIndex,
getter_AddRefs(entry));
nsresult rv = legacySHistory->GetEntryAtIndex(aHistoryIndex,
getter_AddRefs(entry));
if (NS_SUCCEEDED(rv)) {
legacySHistory->InternalSetRequestedIndex(aHistoryIndex);
loadState->SetLoadType(LOAD_HISTORY);
loadState->SetSHEntry(entry);
aLoadState->SetLoadType(LOAD_HISTORY);
aLoadState->SetSHEntry(entry);
}
}
self->InternalLoad(loadState, nullptr, nullptr);
self->InternalLoad(aLoadState, nullptr, nullptr);
});
return NS_OK;
}