Bug 1522637 - Part 3: Send history index when resuming redirected loads, r=qdot
Depends on D18603 Differential Revision: https://phabricator.services.mozilla.com/D18604
This commit is contained in:
@@ -12993,21 +12993,39 @@ nsDocShell::SetOriginAttributesBeforeLoading(
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier) {
|
||||
nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
|
||||
RefPtr<nsDocShell> self = this;
|
||||
RefPtr<ChildProcessChannelListener> cpcl =
|
||||
ChildProcessChannelListener::GetSingleton();
|
||||
|
||||
// Call into InternalLoad with the pending channel when it is received.
|
||||
cpcl->RegisterCallback(aIdentifier, [self](nsIChildChannel* aChannel) {
|
||||
RefPtr<nsDocShellLoadState> loadState;
|
||||
nsresult rv = nsDocShellLoadState::CreateFromPendingChannel(
|
||||
aChannel, getter_AddRefs(loadState));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
self->InternalLoad(loadState, nullptr, nullptr);
|
||||
});
|
||||
cpcl->RegisterCallback(
|
||||
aIdentifier, [self, aHistoryIndex](nsIChildChannel* aChannel) {
|
||||
RefPtr<nsDocShellLoadState> loadState;
|
||||
nsresult rv = nsDocShellLoadState::CreateFromPendingChannel(
|
||||
aChannel, getter_AddRefs(loadState));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're performing a history load, locate the correct history entry,
|
||||
// and set the relevant bits on our loadState.
|
||||
if (aHistoryIndex >= 0) {
|
||||
nsCOMPtr<nsISHistory> legacySHistory =
|
||||
self->mSessionHistory->LegacySHistory();
|
||||
|
||||
nsCOMPtr<nsISHEntry> entry;
|
||||
rv = legacySHistory->GetEntryAtIndex(aHistoryIndex,
|
||||
getter_AddRefs(entry));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
legacySHistory->InternalSetRequestedIndex(aHistoryIndex);
|
||||
loadState->SetLoadType(LOAD_HISTORY);
|
||||
loadState->SetSHEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
self->InternalLoad(loadState, nullptr, nullptr);
|
||||
});
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user