Bug 1380255 - FetchDriver should have threadsafe refcounting. r=baku
authorCatalin Badea <catalin.badea392@gmail.com>
Tue, 26 Sep 2017 11:53:00 +0100
changeset 386043 0db1445c1db99548fa5a03ab1158e527d9f3ba6d
parent 386042 20296803e9e37fa5e33eb36876e5b2416d6078f8
child 386044 839e4b1245ca8a6eb64b52188e56bfd1e4895584
push id32673
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:13:17 +0000
treeherdermozilla-central@196dadb2fe50 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1380255
milestone58.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 1380255 - FetchDriver should have threadsafe refcounting. r=baku
dom/fetch/FetchDriver.cpp
dom/fetch/FetchDriver.h
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -70,23 +70,27 @@ FetchDriver::FetchDriver(InternalRequest
   , mRequest(aRequest)
   , mMainThreadEventTarget(aMainThreadEventTarget)
   , mIsTrackingFetch(aIsTrackingFetch)
 #ifdef DEBUG
   , mResponseAvailableCalled(false)
   , mFetchCalled(false)
 #endif
 {
+  AssertIsOnMainThread();
+
   MOZ_ASSERT(aRequest);
   MOZ_ASSERT(aPrincipal);
   MOZ_ASSERT(aMainThreadEventTarget);
 }
 
 FetchDriver::~FetchDriver()
 {
+  AssertIsOnMainThread();
+
   // We assert this since even on failures, we should call
   // FailWithNetworkError().
   MOZ_ASSERT(mResponseAvailableCalled);
 }
 
 nsresult
 FetchDriver::Fetch(AbortSignal* aSignal, FetchDriverObserver* aObserver)
 {
@@ -919,17 +923,17 @@ FetchDriver::AsyncOnChannelRedirect(nsIC
 
   aCallback->OnRedirectVerifyCallback(NS_OK);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 FetchDriver::CheckListenerChain()
 {
-  return NS_ERROR_NO_INTERFACE;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
 {
   if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
     *aResult = static_cast<nsIChannelEventSink*>(this);
     NS_ADDREF_THIS();
--- a/dom/fetch/FetchDriver.h
+++ b/dom/fetch/FetchDriver.h
@@ -83,17 +83,17 @@ private:
 
 class FetchDriver final : public nsIStreamListener,
                           public nsIChannelEventSink,
                           public nsIInterfaceRequestor,
                           public nsIThreadRetargetableStreamListener,
                           public AbortFollower
 {
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSICHANNELEVENTSINK
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
 
   FetchDriver(InternalRequest* aRequest,
               nsIPrincipal* aPrincipal,