Skip to content
Permalink
Browse files

Bug 1149987 - Part 6: Release the FetchPut object on the right threa…

…d in FetchObserver::OnResponseEnd();
  • Loading branch information...
rmottola committed Jun 29, 2019
1 parent 60845a3 commit bf9172b17c383a2dc556a59879216b8a83b9d6d6
Showing with 10 additions and 1 deletion.
  1. +9 −1 dom/cache/FetchPut.cpp
  2. +1 −0 dom/cache/FetchPut.h
@@ -77,7 +77,15 @@ class FetchPut::FetchObserver final : public FetchDriverObserver
virtual void OnResponseEnd() override
{
mFetchPut->FetchComplete(this, mInternalResponse);
mFetchPut = nullptr;
if (mFetchPut->mInitiatingThread == NS_GetCurrentThread()) {
mFetchPut = nullptr;
} else {
nsCOMPtr<nsIThread> initiatingThread(mFetchPut->mInitiatingThread);
nsCOMPtr<nsIRunnable> runnable =
NS_NewNonOwningRunnableMethod(mFetchPut.forget().take(), &FetchPut::Release);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
initiatingThread->Dispatch(runnable, nsIThread::DISPATCH_NORMAL)));
}
}

protected:
@@ -55,6 +55,7 @@ class FetchPut final : public Manager::Listener
private:
class Runnable;
class FetchObserver;
friend class FetchObserver;
struct State
{
PCacheRequest mPCacheRequest;

0 comments on commit bf9172b

Please sign in to comment.
You can’t perform that action at this time.