aboutsummaryrefslogblamecommitdiff
path: root/www/waterfox/files/patch-bug1430508
blob: 25d3f962d0e431c6e6dc7a4c5167ea6e454d30fd (plain) (tree)























































                                                                                                  
commit 47e68af6bce1
Author: Kris Maglione <maglione.k@gmail.com>
Date:   Sun Jan 14 17:40:09 2018 -0800

    Bug 1430508 - Return 0 for ProcessId() when channel IPC is closed. r=dragana, a=jcristau
    
    There are some corner cases where we try to attach StreamFilter endpoints to a
    channel after its IPC has been closed from from the other side, but request
    listeners haven't been notified. This causes crashes in any of several places.
    
    This patch changes nsHttpChannel::ProcessId to return 0 when IPC is closed, so
    callers can detect that it's no longer possible to attach endpoints to it.
    
    MozReview-Commit-ID: BZTOqezih0P
    
    --HG--
    extra : source : 06f766e7640a3cd180f7da7c092823e500a3d674
---
 netwerk/protocol/http/HttpChannelParent.cpp                     | 9 +++++++++
 netwerk/protocol/http/HttpChannelParent.h                       | 2 ++
 toolkit/components/extensions/webrequest/StreamFilterParent.cpp | 5 ++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git netwerk/protocol/http/HttpChannelParent.cpp netwerk/protocol/http/HttpChannelParent.cpp
index db5f441e53c1..ab332ca1a587 100644
--- netwerk/protocol/http/HttpChannelParent.cpp
+++ netwerk/protocol/http/HttpChannelParent.cpp
@@ -265,6 +265,15 @@ HttpChannelParent::CleanupBackgroundChannel()
   }
 }
 
+base::ProcessId
+HttpChannelParent::OtherPid() const
+{
+  if (mIPCClosed) {
+    return 0;
+  }
+  return Manager()->OtherPid();
+}
+
 //-----------------------------------------------------------------------------
 // HttpChannelParent::nsISupports
 //-----------------------------------------------------------------------------
diff --git netwerk/protocol/http/HttpChannelParent.h netwerk/protocol/http/HttpChannelParent.h
index 19e6fca40bff..fbbad6c2f994 100644
--- netwerk/protocol/http/HttpChannelParent.h
+++ netwerk/protocol/http/HttpChannelParent.h
@@ -120,6 +120,8 @@ public:
   // Callback while background channel is destroyed.
   void OnBackgroundParentDestroyed();
 
+  base::ProcessId OtherPid() const override;
+
 protected:
   // used to connect redirected-to channel in parent with just created
   // ChildChannel.  Used during redirects.