Backout bug 1348464 for leaks
authorEhsan Akhgari <ehsan@mozilla.com>
Sat, 18 Mar 2017 13:13:06 -0400
changeset 348363 ed933de5aa163ee108fa894b6367cebbe1bbd0a6
parent 348362 a034f667da3bacd385326e7d86c76bd57e1234be
child 348364 145f874ee97afa9d1ee5ed1a47accda22adc5707
push id39126
push userarchaeopteryx@coole-files.de
push dateSun, 19 Mar 2017 15:37:50 +0000
treeherderautoland@53392221fe78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1348464
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout bug 1348464 for leaks
netwerk/base/nsNetUtil.cpp
--- a/netwerk/base/nsNetUtil.cpp
+++ b/netwerk/base/nsNetUtil.cpp
@@ -63,17 +63,16 @@
 #include "plstr.h"
 #include "nsINestedURI.h"
 #include "mozilla/dom/nsCSPUtils.h"
 #include "mozilla/net/HttpBaseChannel.h"
 #include "nsIScriptError.h"
 #include "nsISiteSecurityService.h"
 #include "nsHttpHandler.h"
 #include "nsNSSComponent.h"
-#include "nsIOService.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsINetworkManager.h"
 #include "nsThreadUtils.h" // for NS_IsMainThread
 #endif
 
 #include <limits>
 
@@ -1852,22 +1851,21 @@ NS_GetFinalChannelURI(nsIChannel *channe
     return channel->GetOriginalURI(uri);
 }
 
 nsresult
 NS_URIChainHasFlags(nsIURI   *uri,
                     uint32_t  flags,
                     bool     *result)
 {
-    // Avoid AddRef and Release'ing the IO service as this can show up in
-    // profiles...
-    auto ios = nsIOService::GetInstance();
-    NS_ENSURE_TRUE(ios, NS_ERROR_FAILURE);
+    nsresult rv;
+    nsCOMPtr<nsINetUtil> util = do_GetNetUtil(&rv);
+    NS_ENSURE_SUCCESS(rv, rv);
 
-    return ios->URIChainHasFlags(uri, flags, result);
+    return util->URIChainHasFlags(uri, flags, result);
 }
 
 uint32_t
 NS_SecurityHashURI(nsIURI *aURI)
 {
     nsCOMPtr<nsIURI> baseURI = NS_GetInnermostURI(aURI);
 
     nsAutoCString scheme;