From 21de752dfd613477ee1d3a4e7949a685f1ffa452 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Tue, 13 Aug 2013 15:36:56 -0400 Subject: [PATCH] bug 897503 - part 1 - HttpChannelParent reference count bug of nsHttpHandler r=sworkman --- netwerk/protocol/http/HttpChannelParent.cpp | 9 +++++---- netwerk/protocol/http/HttpChannelParent.h | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 8810f92f461..e2c10736012 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -48,16 +48,17 @@ HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding, , mLoadContext(aLoadContext) { // Ensure gHttpHandler is initialized: we need the atom table up and running. - nsIHttpProtocolHandler* handler; - CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &handler); - MOZ_ASSERT(handler); + nsCOMPtr dummyInitializer = + do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http"); + + MOZ_ASSERT(gHttpHandler); + mHttpHandler = gHttpHandler; mTabParent = static_cast(iframeEmbedding); } HttpChannelParent::~HttpChannelParent() { - gHttpHandler->Release(); } void diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h index 63b9835d4e0..8ac8196cefc 100644 --- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -19,6 +19,7 @@ class nsICacheEntryDescriptor; class nsIAssociatedContentSecurity; +class nsHttpHandler; namespace mozilla { @@ -120,6 +121,7 @@ private: PBOverrideStatus mPBOverride; nsCOMPtr mLoadContext; + nsRefPtr mHttpHandler; }; } // namespace net