From fd90e91050467eed2c2ab6196368993d449891ee Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 2 Aug 2010 11:29:10 -0400 Subject: [PATCH] Backint out bug 580450, changeset 4d2c9a0c5e1c --- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 12 ++++++------ netwerk/cookie/CookieServiceParent.cpp | 8 ++++---- netwerk/ipc/NeckoMessageUtils.h | 13 ++++++------- netwerk/protocol/http/HttpChannelParent.cpp | 10 +++++----- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 6f17a16f7088..72aa9b0a51da 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -351,7 +351,7 @@ ContentChild::RecvNotifyRemotePrefObserver(const nsCString& aPref) bool ContentChild::RecvNotifyVisited(const IPC::URI& aURI) { - nsCOMPtr newURI(aURI); + nsCOMPtr newURI = aURI; History::GetService()->NotifyVisited(newURI); return true; } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a49918ba92a3..f94531bf7015 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -277,7 +277,7 @@ ContentParent::RecvTestPermission(const IPC::URI& aUri, { EnsurePermissionService(); - nsCOMPtr uri(aUri); + nsCOMPtr uri = aUri; if (aExact) { mPermissionService->TestExactPermission(uri, aType.get(), retValue); } else { @@ -435,7 +435,7 @@ ContentParent::RequestRunToCompletion() bool ContentParent::RecvStartVisitedQuery(const IPC::URI& aURI) { - nsCOMPtr newURI(aURI); + nsCOMPtr newURI = aURI; IHistory *history = nsContentUtils::GetHistory(); history->RegisterVisitedCallback(newURI, nsnull); return true; @@ -444,11 +444,11 @@ ContentParent::RecvStartVisitedQuery(const IPC::URI& aURI) bool ContentParent::RecvVisitURI(const IPC::URI& uri, - const IPC::URI& referrer, - const PRUint32& flags) + const IPC::URI& referrer, + const PRUint32& flags) { - nsCOMPtr ourURI(uri); - nsCOMPtr ourReferrer(referrer); + nsCOMPtr ourURI = uri; + nsCOMPtr ourReferrer = referrer; IHistory *history = nsContentUtils::GetHistory(); history->VisitURI(ourURI, ourReferrer, flags); return true; diff --git a/netwerk/cookie/CookieServiceParent.cpp b/netwerk/cookie/CookieServiceParent.cpp index 0c2a55de228f..aab9e3751ca0 100644 --- a/netwerk/cookie/CookieServiceParent.cpp +++ b/netwerk/cookie/CookieServiceParent.cpp @@ -70,8 +70,8 @@ CookieServiceParent::RecvGetCookieString(const IPC::URI& aHost, // Deserialize URIs. Having a host URI is mandatory and should always be // provided by the child; thus we consider failure fatal. - nsCOMPtr hostURI(aHost); - nsCOMPtr originatingURI(aOriginating); + nsCOMPtr hostURI = aHost; + nsCOMPtr originatingURI = aOriginating; if (!hostURI) return false; @@ -92,8 +92,8 @@ CookieServiceParent::RecvSetCookieString(const IPC::URI& aHost, // Deserialize URIs. Having a host URI is mandatory and should always be // provided by the child; thus we consider failure fatal. - nsCOMPtr hostURI(aHost); - nsCOMPtr originatingURI(aOriginating); + nsCOMPtr hostURI = aHost; + nsCOMPtr originatingURI = aOriginating; if (!hostURI) return false; diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h index 0d1d533db65a..e1eca945dfc6 100644 --- a/netwerk/ipc/NeckoMessageUtils.h +++ b/netwerk/ipc/NeckoMessageUtils.h @@ -57,16 +57,15 @@ class URI { public: URI() : mURI(nsnull) {} URI(nsIURI* aURI) : mURI(aURI) {} - operator nsIURI*() const { return mURI.get(); } + // The contained URI is already addrefed on creation. We don't want another + // addref when passing it off to its actual owner. + operator nsCOMPtr() const { return already_AddRefed(mURI); } friend struct ParamTraits; private: - // Unimplemented - URI(URI&); URI& operator=(URI&); - - nsCOMPtr mURI; + nsIURI* mURI; }; template<> @@ -137,7 +136,7 @@ struct ParamTraits if (NS_FAILED(rv)) return false; - uri.swap(aResult->mURI); + uri.forget(&aResult->mURI); return true; } @@ -154,7 +153,7 @@ struct ParamTraits if (!serializable || !serializable->Read(aMsg, aIter)) return false; - uri.swap(aResult->mURI); + uri.forget(&aResult->mURI); return true; } diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index 57a9f16d1c1b..ddc1571f1095 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -107,11 +107,11 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI, const PRBool& allowPipelining, const PRBool& forceAllowThirdPartyCookie) { - nsCOMPtr uri(aURI); - nsCOMPtr originalUri(aOriginalURI); - nsCOMPtr docUri(aDocURI); - nsCOMPtr referrerUri(aReferrerURI); - + nsCOMPtr uri = aURI; + nsCOMPtr originalUri = aOriginalURI; + nsCOMPtr docUri = aDocURI; + nsCOMPtr referrerUri = aReferrerURI; + nsCString uriSpec; uri->GetSpec(uriSpec); LOG(("HttpChannelParent RecvAsyncOpen [this=%x uri=%s]\n",