Backed out changeset 41aca5073e9d (bug 1288308) for m-oth failures
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 02 Nov 2016 15:35:51 +0100
changeset 320696 ca33d22a82418e7ba388839f09042801e1671b6e
parent 320695 3c50f3db37d0cf40b5c90fbfd9bc9538691f3d64
child 320697 5738d9db61023acb4a0fdb09af2001606f57b650
push id30902
push userphilringnalda@gmail.com
push dateThu, 03 Nov 2016 02:30:31 +0000
treeherdermozilla-central@ade8d4a63e57 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1288308
milestone52.0a1
backs out41aca5073e9da5d2f27ad20e4a791a08b3820293
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
Backed out changeset 41aca5073e9d (bug 1288308) for m-oth failures
netwerk/base/moz.build
netwerk/base/nsProtocolProxyService.cpp
netwerk/base/nsProtocolProxyService.h
netwerk/dns/DNS.cpp
netwerk/dns/DNS.h
netwerk/socket/nsSOCKSIOLayer.cpp
netwerk/socket/nsSOCKSIOLayer.h
nsprpub/pr/include/prio.h
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -296,17 +296,16 @@ EXTRA_JS_MODULES += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/docshell/base',
     '/dom/base',
     '/netwerk/protocol/http',
-    '/netwerk/socket',
     '/security/pkix/include'
 ]
 
 if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
     LOCAL_INCLUDES += [
         '/netwerk/protocol/rtsp/controller',
         '/netwerk/protocol/rtsp/rtsp',
     ]
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -17,17 +17,16 @@
 #include "nsIChannel.h"
 #include "nsICancelable.h"
 #include "nsIDNSService.h"
 #include "nsPIDNSService.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsThreadUtils.h"
-#include "nsSOCKSIOLayer.h"
 #include "nsString.h"
 #include "nsNetUtil.h"
 #include "nsNetCID.h"
 #include "plstr.h"
 #include "prnetdb.h"
 #include "nsPACMan.h"
 #include "nsProxyRelease.h"
 #include "mozilla/Mutex.h"
@@ -383,16 +382,26 @@ proxy_GetBoolPref(nsIPrefBranch *aPrefBr
     bool temp;
     nsresult rv = aPrefBranch->GetBoolPref(aPref, &temp);
     if (NS_FAILED(rv))
         aResult = false;
     else
         aResult = temp;
 }
 
+static inline bool
+IsHostDomainSocket(const nsACString& aHost)
+{
+#ifdef XP_UNIX
+    return Substring(aHost, 0, 5) == "file:";
+#else
+    return false;
+#endif // XP_UNIX
+}
+
 //----------------------------------------------------------------------------
 
 static const int32_t PROXYCONFIG_DIRECT4X = 3;
 static const int32_t PROXYCONFIG_COUNT = 6;
 
 NS_IMPL_ADDREF(nsProtocolProxyService)
 NS_IMPL_RELEASE(nsProtocolProxyService)
 NS_IMPL_CLASSINFO(nsProtocolProxyService, nullptr, nsIClassInfo::SINGLETON,
@@ -1848,17 +1857,17 @@ nsProtocolProxyService::Resolve_Internal
     const char *type = nullptr;
     const nsACString *host = nullptr;
     int32_t port = -1;
 
     uint32_t proxyFlags = 0;
 
     if ((flags & RESOLVE_PREFER_SOCKS_PROXY) &&
         !mSOCKSProxyTarget.IsEmpty() &&
-        (IsHostLocalTarget(mSOCKSProxyTarget) || mSOCKSProxyPort > 0)) {
+        (IsHostDomainSocket(mSOCKSProxyTarget) || mSOCKSProxyPort > 0)) {
       host = &mSOCKSProxyTarget;
       if (mSOCKSProxyVersion == 4)
           type = kProxyType_SOCKS4;
       else
           type = kProxyType_SOCKS;
       port = mSOCKSProxyPort;
       if (mSOCKSProxyRemoteDNS)
           proxyFlags |= nsIProxyInfo::TRANSPARENT_PROXY_RESOLVES_HOST;
@@ -1886,17 +1895,17 @@ nsProtocolProxyService::Resolve_Internal
     else if (!mFTPProxyHost.IsEmpty() && mFTPProxyPort > 0 &&
              !(flags & RESOLVE_IGNORE_URI_SCHEME) &&
              info.scheme.EqualsLiteral("ftp")) {
         host = &mFTPProxyHost;
         type = kProxyType_HTTP;
         port = mFTPProxyPort;
     }
     else if (!mSOCKSProxyTarget.IsEmpty() &&
-        (IsHostLocalTarget(mSOCKSProxyTarget) || mSOCKSProxyPort > 0)) {
+        (IsHostDomainSocket(mSOCKSProxyTarget) || mSOCKSProxyPort > 0)) {
         host = &mSOCKSProxyTarget;
         if (mSOCKSProxyVersion == 4)
             type = kProxyType_SOCKS4;
         else
             type = kProxyType_SOCKS;
         port = mSOCKSProxyPort;
         if (mSOCKSProxyRemoteDNS)
             proxyFlags |= nsIProxyInfo::TRANSPARENT_PROXY_RESOLVES_HOST;
--- a/netwerk/base/nsProtocolProxyService.h
+++ b/netwerk/base/nsProtocolProxyService.h
@@ -377,18 +377,17 @@ protected:
     int32_t                      mHTTPProxyPort;
 
     nsCString                    mFTPProxyHost;
     int32_t                      mFTPProxyPort;
 
     nsCString                    mHTTPSProxyHost;
     int32_t                      mHTTPSProxyPort;
 
-    // mSOCKSProxyTarget could be a host, a domain socket path,
-    // or a named-pipe name.
+    // mSOCKSProxyTarget could be a host or a domain socket path.
     nsCString                    mSOCKSProxyTarget;
     int32_t                      mSOCKSProxyPort;
     int32_t                      mSOCKSProxyVersion;
     bool                         mSOCKSProxyRemoteDNS;
     bool                         mProxyOverTLS;
 
     RefPtr<nsPACMan>           mPACMan;  // non-null if we are using PAC
     nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
--- a/netwerk/dns/DNS.cpp
+++ b/netwerk/dns/DNS.cpp
@@ -87,21 +87,16 @@ void NetAddrToPRNetAddr(const NetAddr *a
     memcpy(&prAddr->ipv6.ip, &addr->inet6.ip, sizeof(addr->inet6.ip.u8));
     prAddr->ipv6.scope_id = addr->inet6.scope_id;
   }
 #if defined(XP_UNIX)
   else if (addr->raw.family == AF_LOCAL) {
     prAddr->local.family = PR_AF_LOCAL;
     memcpy(prAddr->local.path, addr->local.path, sizeof(addr->local.path));
   }
-#elif defined(XP_WIN)
-  else if (addr->raw.family == AF_LOCAL) {
-    prAddr->local.family = PR_AF_LOCAL;
-    memcpy(prAddr->local.path, addr->local.path, sizeof(addr->local.path));
-  }
 #endif
 }
 
 bool NetAddrToString(const NetAddr *addr, char *buf, uint32_t bufSize)
 {
   if (addr->raw.family == AF_INET) {
     if (bufSize < INET_ADDRSTRLEN) {
       return false;
--- a/netwerk/dns/DNS.h
+++ b/netwerk/dns/DNS.h
@@ -17,20 +17,16 @@
 #if !defined(XP_WIN)
 #include <arpa/inet.h>
 #endif
 
 #ifdef XP_WIN
 #include "winsock2.h"
 #endif
 
-#ifndef AF_LOCAL
-#define AF_LOCAL 1  // used for named pipe
-#endif
-
 #define IPv6ADDR_IS_LOOPBACK(a) \
   (((a)->u32[0] == 0)     &&    \
    ((a)->u32[1] == 0)     &&    \
    ((a)->u32[2] == 0)     &&    \
    ((a)->u8[12] == 0)     &&    \
    ((a)->u8[13] == 0)     &&    \
    ((a)->u8[14] == 0)     &&    \
    ((a)->u8[15] == 0x1U))
@@ -102,19 +98,18 @@ union NetAddr {
   } inet;
   struct {
     uint16_t family;                /* address family (AF_INET6) */
     uint16_t port;                  /* port number */
     uint32_t flowinfo;              /* routing information */
     IPv6Addr ip;                    /* the actual 128 bits of address */
     uint32_t scope_id;              /* set of interfaces for a scope */
   } inet6;
-#if defined(XP_UNIX) || defined(XP_WIN)
-  struct {                          /* Unix domain socket or
-                                       Windows Named Pipes address */
+#if defined(XP_UNIX)
+  struct {                          /* Unix domain socket address */
     uint16_t family;                /* address family (AF_UNIX) */
     char path[104];                 /* null-terminated pathname */
   } local;
 #endif
   // introduced to support nsTArray<NetAddr> comparisons and sorting
   bool operator == (const NetAddr& other) const;
   bool operator < (const NetAddr &other) const;
 };
--- a/netwerk/socket/nsSOCKSIOLayer.cpp
+++ b/netwerk/socket/nsSOCKSIOLayer.cpp
@@ -109,25 +109,29 @@ private:
     uint32_t ReadUint32();
     void ReadNetAddr(NetAddr *addr, uint16_t fam);
     void ReadNetPort(NetAddr *addr);
 
     void WantRead(uint32_t sz);
     PRStatus ReadFromSocket(PRFileDesc *fd);
     PRStatus WriteToSocket(PRFileDesc *fd);
 
-    bool IsLocalProxy()
+    bool IsHostDomainSocket()
     {
+#ifdef XP_UNIX
         nsAutoCString proxyHost;
         mProxy->GetHost(proxyHost);
-        return IsHostLocalTarget(proxyHost);
+        return Substring(proxyHost, 0, 5) == "file:";
+#else
+        return false;
+#endif // XP_UNIX
     }
 
-    nsresult SetLocalProxyPath(const nsACString& aLocalProxyPath,
-                               NetAddr* aProxyAddr)
+    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))) {
@@ -136,17 +140,17 @@ private:
 
         nsCOMPtr<nsIFileProtocolHandler> fileHandler(
             do_QueryInterface(protocolHandler, &rv));
         if (NS_WARN_IF(NS_FAILED(rv))) {
             return rv;
         }
 
         nsCOMPtr<nsIFile> socketFile;
-        rv = fileHandler->GetFileFromURLSpec(aLocalProxyPath,
+        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;
@@ -156,30 +160,19 @@ private:
             NS_WARNING("domain socket path too long.");
             return NS_ERROR_FAILURE;
         }
 
         aProxyAddr->raw.family = AF_UNIX;
         strcpy(aProxyAddr->local.path, path.get());
 
         return NS_OK;
-#elif defined(XP_WIN)
-        MOZ_ASSERT(aProxyAddr);
-
-        if (sizeof(aProxyAddr->local.path) <= aLocalProxyPath.Length()) {
-            NS_WARNING("pipe path too long.");
-            return NS_ERROR_FAILURE;
-        }
-
-        aProxyAddr->raw.family = AF_LOCAL;
-        strcpy(aProxyAddr->local.path, PromiseFlatCString(aLocalProxyPath).get());
-        return NS_OK;
 #else
-        mozilla::Unused << aLocalProxyPath;
         mozilla::Unused << aProxyAddr;
+        mozilla::Unused << aDomainSocketPath;
         return NS_ERROR_NOT_IMPLEMENTED;
 #endif
     }
 
 private:
     State     mState;
     uint8_t * mData;
     uint8_t * mDataIoPtr;
@@ -491,22 +484,22 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFile
     nsAutoCString proxyHost;
     mProxy->GetHost(proxyHost);
 
     int32_t proxyPort;
     mProxy->GetPort(&proxyPort);
 
     int32_t addresses = 0;
     do {
-        if (IsLocalProxy()) {
-            rv = SetLocalProxyPath(proxyHost, &mInternalProxyAddr);
+        if (IsHostDomainSocket()) {
+            rv = SetDomainSocketPath(proxyHost, &mInternalProxyAddr);
             if (NS_FAILED(rv)) {
                 LOGERROR(("socks: unable to connect to SOCKS proxy, %s",
                          proxyHost.get()));
-                return PR_FAILURE;
+              return PR_FAILURE;
             }
         } else {
             if (addresses++) {
                 mDnsRec->ReportUnusable(proxyPort);
             }
 
             rv = mDnsRec->GetNextAddr(proxyPort, &mInternalProxyAddr);
             // No more addresses to try? If so, we'll need to bail
@@ -531,17 +524,17 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFile
         status = fd->lower->methods->connect(fd->lower, &prProxy, mTimeout);
         if (status != PR_SUCCESS) {
             PRErrorCode c = PR_GetError();
 
             // If EINPROGRESS, return now and check back later after polling
             if (c == PR_WOULD_BLOCK_ERROR || c == PR_IN_PROGRESS_ERROR) {
                 mState = SOCKS_CONNECTING_TO_PROXY;
                 return status;
-            } else if (IsLocalProxy()) {
+            } else if (IsHostDomainSocket()) {
                 LOGERROR(("socks: connect to domain socket failed (%d)", c));
                 PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
                 mState = SOCKS_FAILED;
                 return status;
             }
         }
     } while (status != PR_SUCCESS);
 
@@ -1051,17 +1044,17 @@ nsSOCKSSocketInfo::SetConnectTimeout(PRI
 
 PRStatus
 nsSOCKSSocketInfo::DoHandshake(PRFileDesc *fd, int16_t oflags)
 {
     LOGDEBUG(("socks: DoHandshake(), state = %d", mState));
 
     switch (mState) {
         case SOCKS_INITIAL:
-            if (IsLocalProxy()) {
+            if (IsHostDomainSocket()) {
                 mState = SOCKS_DNS_COMPLETE;
                 mLookupStatus = NS_OK;
                 return ConnectToProxy(fd);
             }
 
             return StartDNS(fd);
         case SOCKS_DNS_IN_PROGRESS:
             PR_SetError(PR_IN_PROGRESS_ERROR, 0);
@@ -1537,20 +1530,8 @@ nsSOCKSIOLayerAddToSocket(int32_t family
         PR_DELETE(layer);
         return NS_ERROR_FAILURE;
     }
 
     *info = static_cast<nsISOCKSSocketInfo*>(infoObject);
     NS_ADDREF(*info);
     return NS_OK;
 }
-
-bool
-IsHostLocalTarget(const nsACString& aHost)
-{
-#if defined(XP_UNIX)
-    return StringBeginsWith(aHost, NS_LITERAL_CSTRING("file:"));
-#elif defined(XP_WIN)
-    return StringBeginsWith(aHost, NS_LITERAL_CSTRING("\\\\.\\pipe\\"));
-#else
-    return false;
-#endif // XP_UNIX
-}
--- a/netwerk/socket/nsSOCKSIOLayer.h
+++ b/netwerk/socket/nsSOCKSIOLayer.h
@@ -15,11 +15,9 @@ nsresult nsSOCKSIOLayerAddToSocket(int32
                                    const char   *host, 
                                    int32_t       port,
                                    nsIProxyInfo *proxyInfo,
                                    int32_t       socksVersion,
                                    uint32_t      flags,
                                    PRFileDesc   *fd, 
                                    nsISupports **info);
 
-bool IsHostLocalTarget(const nsACString& aHost);
-
 #endif /* nsSOCKSIOLayer_h__ */
--- a/nsprpub/pr/include/prio.h
+++ b/nsprpub/pr/include/prio.h
@@ -163,17 +163,17 @@ union PRNetAddr {
     } inet;
     struct {
         PRUint16 family;                /* address family (AF_INET6) */
         PRUint16 port;                  /* port number */
         PRUint32 flowinfo;              /* routing information */
         PRIPv6Addr ip;                  /* the actual 128 bits of address */
         PRUint32 scope_id;              /* set of interfaces for a scope */
     } ipv6;
-#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_WIN)
+#if defined(XP_UNIX) || defined(XP_OS2)
     struct {                            /* Unix domain socket address */
         PRUint16 family;                /* address family (AF_UNIX) */
 #ifdef XP_OS2
         char path[108];                 /* null-terminated pathname */
                                         /* bind fails if size is not 108. */
 #else
         char path[104];                 /* null-terminated pathname */
 #endif