Bug 1311275 - use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer
authorLiang-Heng Chen <xeonchen@mozilla.com>
Wed, 19 Oct 2016 20:34:00 +0200
changeset 319683 ee15d36745a84ba995d4e349eca3a10690c571ec
parent 319682 ea39ecf49414c920b402938cd1ddef62dbb18c01
child 319684 042d532e3d9e553c89062ba169940602558755ff
push id83221
push usercbook@mozilla.com
push dateThu, 27 Oct 2016 13:40:36 +0000
treeherdermozilla-inbound@042d532e3d9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1311275
milestone52.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
Bug 1311275 - use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer MozReview-Commit-ID: 26ElbTXr6fI
netwerk/socket/nsSOCKSIOLayer.cpp
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -14,19 +14,18 @@
 #include "nsIDNSRecord.h"
 #include "nsISOCKSSocketInfo.h"
 #include "nsISocketProvider.h"
 #include "nsSOCKSIOLayer.h"
 #include "nsNetCID.h"
 #include "nsIDNSListener.h"
 #include "nsICancelable.h"
 #include "nsThreadUtils.h"
-#include "nsIURL.h"
 #include "nsIFile.h"
-#include "nsNetUtil.h"
+#include "nsIFileProtocolHandler.h"
 #include "mozilla/Logging.h"
 #include "mozilla/net/DNS.h"
 #include "mozilla/Unused.h"
 
 using mozilla::LogLevel;
 using namespace mozilla::net;
 
 static PRDescIdentity nsSOCKSIOLayerIdentity;
@@ -128,19 +127,31 @@ private:
 
     nsresult SetDomainSocketPath(const nsACString& aDomainSocketPath,
                              NetAddr* aProxyAddr)
     {
 #ifdef XP_UNIX
         nsresult rv;
         MOZ_ASSERT(aProxyAddr);
 
+        nsCOMPtr<nsIProtocolHandler> protocolHandler(
+            do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file", &rv));
+        if (NS_WARN_IF(NS_FAILED(rv))) {
+            return rv;
+        }
+
+        nsCOMPtr<nsIFileProtocolHandler> fileHandler(
+            do_QueryInterface(protocolHandler, &rv));
+        if (NS_WARN_IF(NS_FAILED(rv))) {
+            return rv;
+        }
+
         nsCOMPtr<nsIFile> socketFile;
-        rv = NS_GetFileFromURLSpec(aDomainSocketPath,
-                                   getter_AddRefs(socketFile));
+        rv = fileHandler->GetFileFromURLSpec(aDomainSocketPath,
+                                             getter_AddRefs(socketFile));
         if (NS_WARN_IF(NS_FAILED(rv))) {
             return rv;
         }
 
         nsAutoCString path;
         if (NS_WARN_IF(NS_FAILED(rv = socketFile->GetNativePath(path)))) {
             return rv;
         }