Skip to content

Commit

Permalink
Bug 1073282 - Proxy release of mLoadInfo in cannel dtors (r=jduell)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Kerschbaumer committed Sep 29, 2014
1 parent 9316615 commit 0d52343
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 3 deletions.
12 changes: 11 additions & 1 deletion image/decoders/icon/mac/nsIconChannelCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "nsIFileURL.h"
#include "nsTArray.h"
#include "nsObjCExceptions.h"
#include "nsProxyRelease.h"

#include <Cocoa/Cocoa.h>

Expand All @@ -31,7 +32,16 @@
}

nsIconChannel::~nsIconChannel()
{}
{
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}
}

NS_IMPL_ISUPPORTS(nsIconChannel,
nsIChannel,
Expand Down
12 changes: 11 additions & 1 deletion image/decoders/icon/win/nsIconChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsProxyRelease.h"

#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
Expand Down Expand Up @@ -67,7 +68,16 @@ nsIconChannel::nsIconChannel()
}

nsIconChannel::~nsIconChannel()
{}
{
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}
}

NS_IMPL_ISUPPORTS(nsIconChannel,
nsIChannel,
Expand Down
10 changes: 10 additions & 0 deletions modules/libjar/nsJARChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "nsIViewSourceChannel.h"
#include "nsChannelProperties.h"
#include "nsContentUtils.h"
#include "nsProxyRelease.h"

#include "nsIScriptSecurityManager.h"
#include "nsIPrincipal.h"
Expand Down Expand Up @@ -214,6 +215,15 @@ nsJARChannel::nsJARChannel()

nsJARChannel::~nsJARChannel()
{
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}

// release owning reference to the jar handler
nsJARProtocolHandler *handler = gJarHandler;
NS_RELEASE(handler); // nullptr parameter
Expand Down
13 changes: 13 additions & 0 deletions netwerk/base/src/nsBaseChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "nsIStreamConverterService.h"
#include "nsChannelClassifier.h"
#include "nsAsyncRedirectVerifyHelper.h"
#include "nsProxyRelease.h"

static PLDHashOperator
CopyProperties(const nsAString &key, nsIVariant *data, void *closure)
Expand Down Expand Up @@ -64,6 +65,18 @@ nsBaseChannel::nsBaseChannel()
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
}

nsBaseChannel::~nsBaseChannel()
{
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}
}

nsresult
nsBaseChannel::Redirect(nsIChannel *newChannel, uint32_t redirectFlags,
bool openNewChannel)
Expand Down
2 changes: 1 addition & 1 deletion netwerk/base/src/nsBaseChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class nsBaseChannel : public nsHashPropertyBag
// -----------------------------------------------
// Methods to be implemented by the derived class:

virtual ~nsBaseChannel() {}
virtual ~nsBaseChannel();

private:
// Implemented by subclass to supply data stream. The parameter, async, is
Expand Down
10 changes: 10 additions & 0 deletions netwerk/protocol/http/HttpBaseChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsIObserverService.h"
#include "nsProxyRelease.h"

#include <algorithm>

Expand Down Expand Up @@ -84,6 +85,15 @@ HttpBaseChannel::~HttpBaseChannel()
{
LOG(("Destroying HttpBaseChannel @%x\n", this));

if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}

// Make sure we don't leak
CleanRedirectCacheChainIfNecessary();
}
Expand Down
9 changes: 9 additions & 0 deletions netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "mozilla/ipc/URIUtils.h"
#include "SerializedLoadContext.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "nsProxyRelease.h"

using namespace mozilla::ipc;

Expand Down Expand Up @@ -50,6 +51,14 @@ WyciwygChannelChild::WyciwygChannelChild()
WyciwygChannelChild::~WyciwygChannelChild()
{
LOG(("Destroying WyciwygChannelChild @%x\n", this));
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}
}

void
Expand Down
9 changes: 9 additions & 0 deletions netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "nsIURI.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/unused.h"
#include "nsProxyRelease.h"

typedef mozilla::net::LoadContextInfo LoadContextInfo;

Expand Down Expand Up @@ -105,6 +106,14 @@ nsWyciwygChannel::nsWyciwygChannel()

nsWyciwygChannel::~nsWyciwygChannel()
{
if (mLoadInfo) {
nsCOMPtr<nsIThread> mainThread;
NS_GetMainThread(getter_AddRefs(mainThread));

nsILoadInfo *forgetableLoadInfo;
mLoadInfo.forget(&forgetableLoadInfo);
NS_ProxyRelease(mainThread, forgetableLoadInfo, false);
}
}

NS_IMPL_ISUPPORTS(nsWyciwygChannel,
Expand Down

0 comments on commit 0d52343

Please sign in to comment.