Bug 1329916 - Part 1: Remove netwerk checks for Windows XP. r?mcmanus draft
authorChris Peterson <cpeterson@mozilla.com>
Sat, 17 Dec 2016 00:05:34 -0800
changeset 458404 1360226a3cf2627dd562dd89bead8074c44a6300
parent 457899 8f3b24109e3412b36f97277e31ad66856dc609d6
child 458405 edf54c28068fcafd078e521fd8cd975909ea8a89
push id40946
push usercpeterson@mozilla.com
push dateTue, 10 Jan 2017 08:14:44 +0000
reviewersmcmanus
bugs1329916
milestone53.0a1
Bug 1329916 - Part 1: Remove netwerk checks for Windows XP. r?mcmanus MozReview-Commit-ID: FBB3xll6wUx
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsSocketTransportService2.cpp
netwerk/test/TestUDPSocket.cpp
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -35,17 +35,16 @@
 #include "nsIDNSRecord.h"
 #include "nsICancelable.h"
 #include <algorithm>
 
 #include "nsPrintfCString.h"
 #include "xpcpublic.h"
 
 #if defined(XP_WIN)
-#include "mozilla/WindowsVersion.h"
 #include "ShutdownLayer.h"
 #endif
 
 /* Following inclusions required for keepalive config not supported by NSPR. */
 #include "private/pprio.h"
 #if defined(XP_WIN)
 #include <winsock2.h>
 #include <mstcpip.h>
@@ -1711,31 +1710,16 @@ nsSocketTransport::OnSocketConnected()
     // assign mFD (must do this within the transport lock), but take care not
     // to trample over mFDref if mFD is already set.
     {
         MutexAutoLock lock(mLock);
         NS_ASSERTION(mFD.IsInitialized(), "no socket");
         NS_ASSERTION(mFDref == 1, "wrong socket ref count");
         SetSocketName(mFD);
         mFDconnected = true;
-
-#ifdef XP_WIN
-        if (!IsWin2003OrLater()) { // windows xp
-            PRSocketOptionData opt;
-            opt.option = PR_SockOpt_RecvBufferSize;
-            if (PR_GetSocketOption(mFD, &opt) == PR_SUCCESS) {
-                SOCKET_LOG(("%p checking rwin on xp originally=%u\n",
-                            this, opt.value.recv_buffer_size));
-                if (opt.value.recv_buffer_size < 65535) {
-                    opt.value.recv_buffer_size = 65535;
-                    PR_SetSocketOption(mFD, &opt);
-                }
-            }
-        }
-#endif
     }
 
     // Ensure keepalive is configured correctly if previously enabled.
     if (mKeepaliveEnabled) {
         nsresult rv = SetKeepaliveEnabledInternal(true);
         if (NS_WARN_IF(NS_FAILED(rv))) {
             SOCKET_LOG(("  SetKeepaliveEnabledInternal failed rv[0x%x]", rv));
         }
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -23,20 +23,16 @@
 #include "mozilla/ChaosMode.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/Telemetry.h"
 #include "nsThreadUtils.h"
 #include "nsIFile.h"
 #include "nsIWidget.h"
 #include "mozilla/dom/FlyWebService.h"
 
-#if defined(XP_WIN)
-#include "mozilla/WindowsVersion.h"
-#endif
-
 #ifdef MOZ_TASK_TRACER
 #include "GeckoTaskTracer.h"
 #endif
 
 namespace mozilla {
 namespace net {
 
 LazyLogModule gSocketTransportLog("nsSocketTransport");
@@ -1215,22 +1211,17 @@ nsSocketTransportService::UpdateSendBuff
     // If the pref is set, honor it. 0 means use OS defaults.
     nsresult rv = pref->GetIntPref(SEND_BUFFER_PREF, &bufferSize);
     if (NS_SUCCEEDED(rv)) {
         mSendBufferSize = bufferSize;
         return;
     }
 
 #if defined(XP_WIN)
-    // If the pref is not set but this is windows set it depending on windows version
-    if (!IsWin2003OrLater()) { // windows xp
-        mSendBufferSize = 131072;
-    } else { // vista or later
-        mSendBufferSize = 131072 * 4;
-    }
+    mSendBufferSize = 131072 * 4;
 #endif
 }
 
 nsresult
 nsSocketTransportService::UpdatePrefs()
 {
     mSendBufferSize = 0;
 
--- a/netwerk/test/TestUDPSocket.cpp
+++ b/netwerk/test/TestUDPSocket.cpp
@@ -8,19 +8,16 @@
 #include "nsISocketTransportService.h"
 #include "nsISocketTransport.h"
 #include "nsIOutputStream.h"
 #include "nsIInputStream.h"
 #include "nsINetAddr.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsITimer.h"
 #include "mozilla/net/DNS.h"
-#ifdef XP_WIN
-#include "mozilla/WindowsVersion.h"
-#endif
 #include "prerror.h"
 
 #define REQUEST  0x68656c6f
 #define RESPONSE 0x6f6c6568
 #define MULTICAST_TIMEOUT 2000
 
 enum TestPhase {
   TEST_OUTPUT_STREAM,
@@ -316,26 +313,16 @@ TEST(TestUDPSocket, TestUDPSocketMain)
   // Read response from server
   ASSERT_TRUE(NS_SUCCEEDED(clientListener->mResult));
 
   // Setup timer to detect multicast failure
   nsCOMPtr<nsITimer> timer = do_CreateInstance("@mozilla.org/timer;1");
   ASSERT_TRUE(timer);
   RefPtr<MulticastTimerCallback> timerCb = new MulticastTimerCallback(waiter);
 
-  // The following multicast tests using multiple sockets require a firewall
-  // exception on Windows XP (the earliest version of Windows we now support)
-  // before they pass. For now, we'll skip them here. Later versions of Windows
-  // (Win2003 and onward) don't seem to have this issue.
-#ifdef XP_WIN
-  if (!mozilla::IsWin2003OrLater()) {   // i.e. if it is WinXP
-    goto close;
-  }
-#endif
-
   // Join multicast group
   printf("Joining multicast group\n");
   phase = TEST_MULTICAST;
   mozilla::net::NetAddr multicastAddr;
   multicastAddr.inet.family = AF_INET;
   multicastAddr.inet.ip = PR_htonl(224 << 24 | 255);
   multicastAddr.inet.port = PR_htons(serverPort);
   rv = server->JoinMulticastAddr(multicastAddr, nullptr);