[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 1311275 - use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer



commit 3c39c36f1f0ad11dbf332b538bc71cc89336cbae
Author: Liang-Heng Chen <xeonchen@xxxxxxxxxxx>
Date:   Wed Oct 19 20:34:00 2016 +0200

    Bug 1311275 - use protocol service directly instead of NS_GetFileFromURLSpec; r=mayhemer
    
    MozReview-Commit-ID: 26ElbTXr6fI
    
    --HG--
    extra : rebase_source : bad92dfad90b4cee8a850cdf29a85832f16f8149
    
    This is a backport we need due to an assertion failure caused by a
    previous patch (see: #20304). Fixes bug 20490.
---
 netwerk/socket/nsSOCKSIOLayer.cpp | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp
index d20fe7f..4151767 100644
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -19,9 +19,8 @@
 #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"
@@ -135,9 +134,21 @@ private:
         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;
         }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits