Bug 1583018 - Handle potential error should somehow the redirect got cancelled before we finished spawning the new process. r=mayhemer
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 25 Sep 2019 14:05:13 +0000
changeset 495018 f599d5c813c8b73c3a4f95f26909633e12022b01
parent 495017 370938d18387227018dc6e11868d9f7bc7625aaa
child 495019 febf4480bc0bce19a0c8883e0c9296c40013e01e
push id114131
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:47:34 +0000
treeherdermozilla-inbound@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1583018
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1583018 - Handle potential error should somehow the redirect got cancelled before we finished spawning the new process. r=mayhemer Differential Revision: https://phabricator.services.mozilla.com/D46720
netwerk/protocol/http/HttpChannelParent.cpp
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -2709,20 +2709,24 @@ nsresult HttpChannelParent::TriggerCross
                 [self](Tuple<nsresult, Maybe<LoadInfoArgs>>&& aResponse) {
                   // We need to continue on the new HttpChannelParent.
                   MOZ_ASSERT(self->mRedirectChannelId);
                   nsCOMPtr<nsIRedirectChannelRegistrar> redirectReg =
                       RedirectChannelRegistrar::GetOrCreate();
                   MOZ_ASSERT(redirectReg);
 
                   nsCOMPtr<nsIParentChannel> redirectParentChannel;
-                  redirectReg->GetParentChannel(
-                      self->mRedirectChannelId,
-                      getter_AddRefs(redirectParentChannel));
-                  MOZ_ASSERT(redirectParentChannel);
+                  if (NS_FAILED(redirectReg->GetParentChannel(
+                          self->mRedirectChannelId,
+                          getter_AddRefs(redirectParentChannel))) ||
+                      !redirectParentChannel) {
+                    // Redirect might got canceled.
+                    self->CrossProcessRedirectDone(NS_ERROR_FAILURE, Nothing());
+                    return;
+                  }
                   RefPtr<HttpChannelParent> newParent =
                       do_QueryObject(redirectParentChannel);
                   MOZ_ASSERT(newParent);
                   newParent->CrossProcessRedirectDone(Get<0>(aResponse),
                                                       Get<1>(aResponse));
                 },
                 [self](const mozilla::ipc::ResponseRejectReason) {
                   self->CrossProcessRedirectDone(NS_ERROR_FAILURE, Nothing());