Bug 1593560 - Release mListener and break the cycle if AsyncOpen fails in DocumentChannelParent, since OnStopRequest won't be delivered to mListener in this case, which is where we usually break the cycle. r=jya
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 06 Nov 2019 22:37:07 +0000
changeset 501139 f85931cd9c303e6975c138d6e80c80566406fd48
parent 501138 7fda1001834ac0443693ff9d0594d940248f96cb
child 501140 f370f4b602e0e73af7e62337950ef9c62a9626a4
push id114168
push userdluca@mozilla.com
push dateSun, 10 Nov 2019 03:08:55 +0000
treeherdermozilla-inbound@33f64c1ef3e4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1593560
milestone72.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 1593560 - Release mListener and break the cycle if AsyncOpen fails in DocumentChannelParent, since OnStopRequest won't be delivered to mListener in this case, which is where we usually break the cycle. r=jya Differential Revision: https://phabricator.services.mozilla.com/D51552
netwerk/ipc/DocumentChannelParent.cpp
--- a/netwerk/ipc/DocumentChannelParent.cpp
+++ b/netwerk/ipc/DocumentChannelParent.cpp
@@ -69,16 +69,17 @@ bool DocumentChannelParent::Init(const D
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   bool result = nsDocShell::CreateChannelForLoadState(
       loadState, loadInfo, mListener, nullptr,
       aArgs.initiatorType().ptrOr(nullptr), aArgs.loadFlags(), aArgs.loadType(),
       aArgs.cacheKey(), aArgs.isActive(), aArgs.isTopLevelDoc(),
       aArgs.hasNonEmptySandboxingFlags(), rv, getter_AddRefs(mChannel));
   if (!result) {
+    mListener = nullptr;
     return SendFailedAsyncOpen(rv);
   }
 
   nsDocShell::ConfigureChannel(
       mChannel, loadState, aArgs.initiatorType().ptrOr(nullptr),
       aArgs.loadType(), aArgs.cacheKey(), aArgs.hasNonEmptySandboxingFlags());
 
   // Computation of the top window uses the docshell tree, so only
@@ -130,16 +131,17 @@ bool DocumentChannelParent::Init(const D
   }
 
   // Setup a ClientChannelHelper to watch for redirects, and copy
   // across any serviceworker related data between channels as needed.
   AddClientChannelHelperInParent(mChannel, GetMainThreadSerialEventTarget());
 
   rv = mChannel->AsyncOpen(mListener);
   if (NS_FAILED(rv)) {
+    mListener = nullptr;
     return SendFailedAsyncOpen(rv);
   }
 
   mChannelCreationURI = loadState->URI();
 
   return true;
 }