[tbb-commits] [tor-browser] 67/76: Bug 1735899 - Make sure RemoteLazyInputStream::Close calls mInputStreamCallback OnInputStreamReady method. r=nika, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Mar 30 20:40:35 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.8.0esr-11.0-1
in repository tor-browser.

commit 612808528c94bfbcd9bce56b0ed56f55c9b43693
Author: Luca Greco <lgreco at mozilla.com>
AuthorDate: Wed Oct 27 16:36:34 2021 +0000

    Bug 1735899 - Make sure RemoteLazyInputStream::Close calls mInputStreamCallback OnInputStreamReady method. r=nika, a=RyanVM
    
    RemoteLazyInputStream::Close was not setting mInputStreamCallback to a nullptr without using it in the
    InputStreamCallbackRunnable::Execute, which would be calling OnInputStreamReady on the mInputStreamCallback.
    
    This does also match the details we gathered while investigating the bug (which was triggered exactly by a remote
    lazy stream getter that did never got to call OnInputStreamReady by the time we were closing the channel).
    
    Differential Revision: https://phabricator.services.mozilla.com/D129374
---
 dom/file/ipc/RemoteLazyInputStream.cpp | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dom/file/ipc/RemoteLazyInputStream.cpp b/dom/file/ipc/RemoteLazyInputStream.cpp
index 10e2e41633ad7..d49cee228e457 100644
--- a/dom/file/ipc/RemoteLazyInputStream.cpp
+++ b/dom/file/ipc/RemoteLazyInputStream.cpp
@@ -281,6 +281,10 @@ NS_IMETHODIMP
 RemoteLazyInputStream::Close() {
   nsCOMPtr<nsIAsyncInputStream> asyncRemoteStream;
   nsCOMPtr<nsIInputStream> remoteStream;
+
+  nsCOMPtr<nsIInputStreamCallback> inputStreamCallback;
+  nsCOMPtr<nsIEventTarget> inputStreamCallbackEventTarget;
+
   {
     MutexAutoLock lock(mMutex);
 
@@ -292,15 +296,22 @@ RemoteLazyInputStream::Close() {
     asyncRemoteStream.swap(mAsyncRemoteStream);
     remoteStream.swap(mRemoteStream);
 
-    mInputStreamCallback = nullptr;
-    mInputStreamCallbackEventTarget = nullptr;
-
+    // TODO(Bug 1737783): Notify to the mFileMetadataCallback that this
+    // lazy input stream has been closed.
     mFileMetadataCallback = nullptr;
     mFileMetadataCallbackEventTarget = nullptr;
 
+    inputStreamCallback = std::move(mInputStreamCallback);
+    inputStreamCallbackEventTarget = std::move(mInputStreamCallbackEventTarget);
+
     mState = eClosed;
   }
 
+  if (inputStreamCallback) {
+    InputStreamCallbackRunnable::Execute(inputStreamCallback,
+                                         inputStreamCallbackEventTarget, this);
+  }
+
   if (asyncRemoteStream) {
     asyncRemoteStream->CloseWithStatus(NS_BASE_STREAM_CLOSED);
   }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list