garburator-blacklist-necko
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 80 07783adadb3b0f82cea9c4f71d2f410d3ccb5c17
permissions -rw-r--r--
State as of now

diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -1064,6 +1064,14 @@ NS_QueryNotificationCallbacks(nsIChannel
                                   getter_AddRefs(result));
 }
 
+template <class T> inline void
+NS_QueryNotificationCallbacks(nsIChannel  *channel,
+                              T **result)
+{
+    NS_QueryNotificationCallbacks(channel, NS_GET_TEMPLATE_IID(T),
+                                  reinterpret_cast<void**>(result));
+}
+
 /**
  * Alternate form of NS_QueryNotificationCallbacks designed for use by
  * nsIChannel implementations.
diff --git a/netwerk/base/src/nsBaseChannel.h b/netwerk/base/src/nsBaseChannel.h
--- a/netwerk/base/src/nsBaseChannel.h
+++ b/netwerk/base/src/nsBaseChannel.h
@@ -180,6 +180,10 @@ public:
   // Helper function for querying the channel's notification callbacks.
   template <class T> void GetCallback(nsCOMPtr<T> &result) {
     GetInterface(NS_GET_TEMPLATE_IID(T), getter_AddRefs(result));
+  }
+
+  template <class T> void GetCallback(T **result) {
+    GetInterface(NS_GET_TEMPLATE_IID(T), reinterpret_cast<void**>(result));
   }
 
   // Helper function for calling QueryInterface on this.
diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.cpp b/netwerk/protocol/ftp/src/nsFTPChannel.cpp
--- a/netwerk/protocol/ftp/src/nsFTPChannel.cpp
+++ b/netwerk/protocol/ftp/src/nsFTPChannel.cpp
@@ -184,8 +184,8 @@ nsFtpChannel::GetFTPEventSink(nsCOMPtr<n
 nsFtpChannel::GetFTPEventSink(nsCOMPtr<nsIFTPEventSink> &aResult)
 {
     if (!mFTPEventSink) {
-        nsCOMPtr<nsIFTPEventSink> ftpSink;
-        GetCallback(ftpSink);
+        nsIFTPEventSink* ftpSink = nsnull;
+        GetCallback(&ftpSink);
         if (ftpSink) {
             NS_GetProxyForObject(NS_PROXY_TO_CURRENT_THREAD,
                                  NS_GET_IID(nsIFTPEventSink),
diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
--- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
@@ -894,8 +894,8 @@ nsFtpState::R_syst() {
                 return FTP_ERROR;
 
             // TODO(darin): this code should not be dictating UI like this!
-            nsCOMPtr<nsIPrompt> prompter;
-            mChannel->GetCallback(prompter);
+            nsIPrompt* prompter = nsnull;
+            mChannel->GetCallback(&prompter);
             if (prompter)
                 prompter->Alert(nsnull, formattedString.get());
             
@@ -1734,8 +1734,8 @@ nsFtpState::StopProcessing()
         // web shell wont throw an alert.  we better:
 
         // XXX(darin): this code should not be dictating UI like this!
-        nsCOMPtr<nsIPrompt> prompter;
-        mChannel->GetCallback(prompter);
+        nsIPrompt* prompter = nsnull;
+        mChannel->GetCallback(&prompter);
         if (prompter)
             prompter->Alert(nsnull, NS_ConvertASCIItoUTF16(mResponseMsg).get());
     }
diff --git a/netwerk/protocol/gopher/src/nsGopherChannel.cpp b/netwerk/protocol/gopher/src/nsGopherChannel.cpp
--- a/netwerk/protocol/gopher/src/nsGopherChannel.cpp
+++ b/netwerk/protocol/gopher/src/nsGopherChannel.cpp
@@ -294,8 +294,8 @@ nsresult
 nsresult
 nsGopherContentStream::PromptForQueryString(nsCString &result)
 {
-    nsCOMPtr<nsIPrompt> prompter;
-    mChannel->GetCallback(prompter);
+    nsIPrompt* prompter = nsnull;
+    mChannel->GetCallback(&prompter);
     if (!prompter) {
         NS_ERROR("We need a prompter!");
         return NS_ERROR_FAILURE;
diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/src/nsHttpChannel.cpp
--- a/netwerk/protocol/http/src/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/src/nsHttpChannel.cpp
@@ -982,8 +982,8 @@ nsHttpChannel::PromptTempRedirect()
     if (NS_SUCCEEDED(rv) && messageString) {
         PRBool repost = PR_FALSE;
 
-        nsCOMPtr<nsIPrompt> prompt;
-        GetCallback(prompt);
+        nsIPrompt* prompt = nsnull;
+        GetCallback(&prompt);
         if (!prompt)
             return NS_ERROR_NO_INTERFACE;
 
@@ -2403,8 +2403,8 @@ nsHttpChannel::ProcessRedirection(PRUint
         return rv;
 
     // And now, the deprecated way
-    nsCOMPtr<nsIHttpEventSink> httpEventSink;
-    GetCallback(httpEventSink);
+    nsIHttpEventSink* httpEventSink = nsnull;
+    GetCallback(&httpEventSink);
     if (httpEventSink) {
         // NOTE: nsIHttpEventSink is only used for compatibility with pre-1.8
         // versions.
@@ -3149,8 +3149,8 @@ nsHttpChannel::ConfirmAuth(const nsStrin
     if (!msg)
         return PR_TRUE;
     
-    nsCOMPtr<nsIPrompt> prompt;
-    GetCallback(prompt);
+    nsIPrompt* prompt = nsnull;
+    GetCallback(&prompt);
     if (!prompt)
         return PR_TRUE;
 
@@ -4185,8 +4185,8 @@ nsHttpChannel::SetCookie(const char *aCo
     nsICookieService *cs = gHttpHandler->GetCookieService();
     NS_ENSURE_TRUE(cs, NS_ERROR_FAILURE);
 
-    nsCOMPtr<nsIPrompt> prompt;
-    GetCallback(prompt);
+    nsIPrompt* prompt = nsnull;
+    GetCallback(&prompt);
 
     return cs->SetCookieStringFromHttp(mURI,
                                        mDocumentURI ? mDocumentURI : mOriginalURI,
diff --git a/netwerk/protocol/http/src/nsHttpChannel.h b/netwerk/protocol/http/src/nsHttpChannel.h
--- a/netwerk/protocol/http/src/nsHttpChannel.h
+++ b/netwerk/protocol/http/src/nsHttpChannel.h
@@ -143,6 +143,14 @@ private:
                                       getter_AddRefs(aResult));
     }
 
+    template <class T>
+    void GetCallback(T **aResult)
+    {
+        NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
+                                      NS_GET_TEMPLATE_IID(T),
+                                      reinterpret_cast<void**>(aResult));
+    }
+
     // AsyncCall may be used to call a member function asynchronously.
     nsresult AsyncCall(nsAsyncCallback funcPtr);
 
diff --git a/netwerk/protocol/http/src/nsHttpHandler.cpp b/netwerk/protocol/http/src/nsHttpHandler.cpp
--- a/netwerk/protocol/http/src/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/src/nsHttpHandler.cpp
@@ -496,8 +496,8 @@ nsHttpHandler::OnChannelRedirect(nsIChan
         return rv;
 
     // Now, the per-channel observers
-    nsCOMPtr<nsIChannelEventSink> sink;
-    NS_QueryNotificationCallbacks(oldChan, sink);
+    nsIChannelEventSink* sink = nsnull;
+    NS_QueryNotificationCallbacks(oldChan, &sink);
     if (sink)
         rv = sink->OnChannelRedirect(oldChan, newChan, flags);