Fix leak bug 391978. r=biesi, sr=dmose, a=sayrer
authorbzbarsky@mit.edu
Thu, 08 Nov 2007 22:13:26 -0800
changeset 7714 d84738a8088661675cd6a6acd1bf47d343094ddd
parent 7713 41f63340e912f6d123131337fa9f000b58bd91c2
child 7715 ce3cf2f9cdc29e9d75db8989a97f5dad37749cde
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbiesi, dmose, sayrer
bugs391978
milestone1.9b2pre
Fix leak bug 391978. r=biesi, sr=dmose, a=sayrer
docshell/build/nsDocShellModule.cpp
netwerk/base/src/nsIOService.cpp
uriloader/exthandler/nsExternalProtocolHandler.cpp
uriloader/exthandler/nsExternalProtocolHandler.h
--- a/docshell/build/nsDocShellModule.cpp
+++ b/docshell/build/nsDocShellModule.cpp
@@ -98,17 +98,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWe
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDefaultURIFixup)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWebNavigationInfo, Init)
 
 // uriloader
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsURILoader)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDocLoader, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsOSHelperAppService, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalProtocolHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlockedExternalProtocolHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefetchService, Init)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsOfflineCacheUpdateService,
                                          nsOfflineCacheUpdateService::GetInstance)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineCacheUpdate)
 NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t)
 
 #if defined(XP_MAC) || defined(XP_MACOSX)
 #include "nsInternetConfigService.h"
@@ -204,18 +203,16 @@ static const nsModuleComponentInfo gDocS
   { "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, 
      nsOSHelperAppServiceConstructor, },
   { "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, 
      nsOSHelperAppServiceConstructor, },
   { "Netscape Mime Mapping Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_MIMESERVICE_CONTRACTID, 
      nsOSHelperAppServiceConstructor, },
   { "Netscape Default Protocol Handler", NS_EXTERNALPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default", 
      nsExternalProtocolHandlerConstructor, },
-  { "Netscape Default Blocked Protocol Handler", NS_BLOCKEDEXTERNALPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default-blocked", 
-     nsBlockedExternalProtocolHandlerConstructor, },
   {  NS_PREFETCHSERVICE_CLASSNAME, NS_PREFETCHSERVICE_CID, NS_PREFETCHSERVICE_CONTRACTID,
      nsPrefetchServiceConstructor, },
   { NS_OFFLINECACHEUPDATESERVICE_CLASSNAME, NS_OFFLINECACHEUPDATESERVICE_CID, NS_OFFLINECACHEUPDATESERVICE_CONTRACTID,
     nsOfflineCacheUpdateServiceConstructor, },
   { NS_OFFLINECACHEUPDATE_CLASSNAME, NS_OFFLINECACHEUPDATE_CID, NS_OFFLINECACHEUPDATE_CONTRACTID,
     nsOfflineCacheUpdateConstructor, },
   { "Local Application Handler App", NS_LOCALHANDLERAPP_CID, 
     NS_LOCALHANDLERAPP_CONTRACTID, PlatformLocalHandlerApp_tConstructor, },
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -394,52 +394,42 @@ nsIOService::GetProtocolHandler(const ch
         ToLowerCase(contractID);
 
         rv = CallGetService(contractID.get(), result);
         if (NS_SUCCEEDED(rv)) {
             CacheProtocolHandler(scheme, *result);
             return rv;
         }
 
-        // If the pref for this protocol was explicitly set to false, we want
-        // to use our special "blocked protocol" handler.  That will ensure we
-        // don't open any channels for this protocol.
-        if (listedProtocol) {
-            rv = CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default-blocked",
-                                result);
-            if (NS_FAILED(rv))
-                return NS_ERROR_UNKNOWN_PROTOCOL;
-        }
-    }
-    
 #ifdef MOZ_X11
-    // check to see whether GnomeVFS can handle this URI scheme.  if it can
-    // create a nsIURI for the "scheme:", then we assume it has support for
-    // the requested protocol.  otherwise, we failover to using the default
-    // protocol handler.
+        // check to see whether GnomeVFS can handle this URI scheme.  if it can
+        // create a nsIURI for the "scheme:", then we assume it has support for
+        // the requested protocol.  otherwise, we failover to using the default
+        // protocol handler.
+
+        // XXX should this be generalized into something that searches a
+        // category?  (see bug 234714)
 
-    // XXX should this be generalized into something that searches a
-    // category?  (see bug 234714)
-
-    rv = CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"moz-gnomevfs",
-                        result);
-    if (NS_SUCCEEDED(rv)) {
-        nsCAutoString spec(scheme);
-        spec.Append(':');
+        rv = CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"moz-gnomevfs",
+                            result);
+        if (NS_SUCCEEDED(rv)) {
+            nsCAutoString spec(scheme);
+            spec.Append(':');
 
-        nsIURI *uri;
-        rv = (*result)->NewURI(spec, nsnull, nsnull, &uri);
-        if (NS_SUCCEEDED(rv)) {
-            NS_RELEASE(uri);
-            return rv;
+            nsIURI *uri;
+            rv = (*result)->NewURI(spec, nsnull, nsnull, &uri);
+            if (NS_SUCCEEDED(rv)) {
+                NS_RELEASE(uri);
+                return rv;
+            }
+
+            NS_RELEASE(*result);
         }
-
-        NS_RELEASE(*result);
+#endif
     }
-#endif
 
     // Okay we don't have a protocol handler to handle this url type, so use
     // the default protocol handler.  This will cause urls to get dispatched
     // out to the OS ('cause we can't do anything with them) when we try to
     // read from a channel created by the default protocol handler.
 
     rv = CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default",
                         result);
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -427,21 +427,8 @@ NS_IMETHODIMP nsExternalProtocolHandler:
   if (gExtProtSvc)
     return gExtProtSvc->ExternalProtocolHandlerExists(
       PromiseFlatCString(aScheme).get(), _retval);
 
   // In case we don't have external protocol service.
   *_retval = PR_FALSE;
   return NS_OK;
 }
-
-nsBlockedExternalProtocolHandler::nsBlockedExternalProtocolHandler()
-{
-    m_schemeName = "default-blocked";
-}
-
-NS_IMETHODIMP
-nsBlockedExternalProtocolHandler::NewChannel(nsIURI *aURI,
-                                             nsIChannel **_retval)
-{
-    *_retval = nsnull;
-    return NS_ERROR_UNKNOWN_PROTOCOL;
-}
--- a/uriloader/exthandler/nsExternalProtocolHandler.h
+++ b/uriloader/exthandler/nsExternalProtocolHandler.h
@@ -62,17 +62,10 @@ public:
 
 protected:
   // helper function
   PRBool HaveExternalProtocolHandler(nsIURI * aURI);
 	nsCString	m_schemeName;
   nsCOMPtr<nsIExternalProtocolService> m_extProtService;
 };
 
-class nsBlockedExternalProtocolHandler: public nsExternalProtocolHandler
-{
-public:
-  nsBlockedExternalProtocolHandler();
-  NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel **_retval);
-};
-
 #endif // nsExternalProtocolHandler_h___