mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 1553267 - Cancel the redirect load if docshell is being destroyed r=mayhemer
When the docshell is being destroyed, HttpChannelChild::CompleteRedirectSetup is not called and HttpChannelChild::mListener is not also assigned. In this case, I think we should cancel the channel and propagate the error to the http channel parent. Differential Revision: https://phabricator.services.mozilla.com/D41515 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c0a595d089
commit
fb1430c0de
@ -13218,6 +13218,10 @@ nsDocShell::ResumeRedirectedLoad(uint64_t aIdentifier, int32_t aHistoryIndex) {
|
||||
cpcl->RegisterCallback(
|
||||
aIdentifier, [self, aHistoryIndex](nsIChildChannel* aChannel) {
|
||||
if (NS_WARN_IF(self->mIsBeingDestroyed)) {
|
||||
nsCOMPtr<nsIRequest> request = do_QueryInterface(aChannel);
|
||||
if (request) {
|
||||
request->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4058,6 +4058,10 @@ nsresult HttpChannelChild::CrossProcessRedirectFinished(nsresult aStatus) {
|
||||
return NS_BINDING_FAILED;
|
||||
}
|
||||
|
||||
if (!mCanceled && NS_SUCCEEDED(mStatus)) {
|
||||
mStatus = aStatus;
|
||||
}
|
||||
|
||||
// The loadInfo is updated in nsDocShell::OpenInitializedChannel to have the
|
||||
// correct attributes (such as browsingContextID).
|
||||
// We need to send it to the parent channel so the two match, which is done
|
||||
@ -4066,7 +4070,7 @@ nsresult HttpChannelChild::CrossProcessRedirectFinished(nsresult aStatus) {
|
||||
Maybe<LoadInfoArgs> loadInfoArgs;
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
|
||||
Unused << SendCrossProcessRedirectDone(aStatus, loadInfoArgs);
|
||||
Unused << SendCrossProcessRedirectDone(mStatus, loadInfoArgs);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1258,10 +1258,14 @@ mozilla::ipc::IPCResult HttpChannelParent::RecvCrossProcessRedirectDone(
|
||||
const nsresult& aResult,
|
||||
const mozilla::Maybe<LoadInfoArgs>& aLoadInfoArgs) {
|
||||
RefPtr<nsHttpChannel> chan = do_QueryObject(mChannel);
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv = aResult;
|
||||
auto sendReply =
|
||||
MakeScopeExit([&]() { FinishCrossProcessRedirect(chan, rv); });
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> newLoadInfo;
|
||||
rv = LoadInfoArgsToLoadInfo(aLoadInfoArgs, getter_AddRefs(newLoadInfo));
|
||||
if (NS_FAILED(rv)) {
|
||||
|
Loading…
Reference in New Issue
Block a user