Bug 1231213 - IPCStreamSource should not attempt to read from its stream if already closed. r=asuth
☠☠ backed out by 3cf55b7f12f2 ☠ ☠
authorPerry Jiang <perry@mozilla.com>
Wed, 14 Aug 2019 16:19:36 +0000
changeset 487967 581653ef33ddb0bf5b054ba455d5108dbb2cfa1a
parent 487966 2d5628a0e52dc9aff4a67fa05da6d238793f9af6
child 487968 ee456510421792f47aae2880e8680e5636e46dfd
push id36434
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:44:30 +0000
treeherdermozilla-central@144fbfb409b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1231213
milestone70.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 1231213 - IPCStreamSource should not attempt to read from its stream if already closed. r=asuth Differential Revision: https://phabricator.services.mozilla.com/D26161
ipc/glue/IPCStreamSource.cpp
--- a/ipc/glue/IPCStreamSource.cpp
+++ b/ipc/glue/IPCStreamSource.cpp
@@ -238,16 +238,23 @@ void IPCStreamSource::Wait() {
 }
 
 void IPCStreamSource::OnStreamReady(Callback* aCallback) {
   NS_ASSERT_OWNINGTHREAD(IPCStreamSource);
   MOZ_ASSERT(mCallback);
   MOZ_ASSERT(aCallback == mCallback);
   mCallback->ClearSource();
   mCallback = nullptr;
+
+  // Possibly closed if this callback is (indirectly) called by
+  // IPCStreamSourceParent::RecvRequestClose().
+  if (mState == eClosed) {
+    return;
+  }
+
   DoRead();
 }
 
 void IPCStreamSource::OnEnd(nsresult aRv) {
   NS_ASSERT_OWNINGTHREAD(IPCStreamSource);
   MOZ_ASSERT(aRv != NS_BASE_STREAM_WOULD_BLOCK);
 
   if (mState == eClosed) {