Bug 1331171 - Part 2: Remove Windows shell integration checks for Windows Vista. r=jimm
authorChris Peterson <cpeterson@mozilla.com>
Sat, 14 Jan 2017 01:19:22 -0800
changeset 378196 00edf253517f6c0dd3ec47bcf085e2466d5677d5
parent 378195 db3691e4c328fb19597dd1559de23b27c842ccb6
child 378197 be835d18c74f3dc3298705525944f64bc6e7ee31
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1331171
milestone54.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 1331171 - Part 2: Remove Windows shell integration checks for Windows Vista. r=jimm MozReview-Commit-ID: 8B6HnnpVP4L
browser/components/shell/nsWindowsShellService.cpp
xpcom/io/SpecialSystemDirectory.cpp
xpcom/io/nsLocalFileWin.cpp
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -641,21 +641,16 @@ nsWindowsShellService::LaunchControlPane
     pAARUI->Release();
   }
   return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult
 nsWindowsShellService::LaunchControlPanelDefaultPrograms()
 {
-  // This Default Programs feature is Win7+ only.
-  if (!IsWin7OrLater()) {
-    return NS_ERROR_FAILURE;
-  }
-
   // Build the path control.exe path safely
   WCHAR controlEXEPath[MAX_PATH + 1] = { '\0' };
   if (!GetSystemDirectoryW(controlEXEPath, MAX_PATH)) {
     return NS_ERROR_FAILURE;
   }
   LPCWSTR controlEXE = L"control.exe";
   if (wcslen(controlEXEPath) + wcslen(controlEXE) >= MAX_PATH) {
     return NS_ERROR_FAILURE;
--- a/xpcom/io/SpecialSystemDirectory.cpp
+++ b/xpcom/io/SpecialSystemDirectory.cpp
@@ -14,19 +14,16 @@
 #include <windows.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <direct.h>
 #include <shlobj.h>
 #include <knownfolders.h>
 #include <guiddef.h>
-#include "mozilla/WindowsVersion.h"
-
-using mozilla::IsWin7OrLater;
 
 #elif defined(XP_UNIX)
 
 #include <limits.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/param.h>
 #include "prenv.h"
@@ -109,29 +106,23 @@ SHLoadLibraryFromKnownFolder(REFKNOWNFOL
     }
     plib->Release();
   }
   return hr;
 }
 #endif
 
 /*
- * Check to see if we're on Win7 and up, and if so, returns the default
- * save-to location for the Windows Library passed in through aFolderId.
- * Otherwise falls back on pre-win7 GetWindowsFolder.
+ * Return the default save-to location for the Windows Library passed in
+ * through aFolderId.
  */
 static nsresult
 GetLibrarySaveToPath(int aFallbackFolderId, REFKNOWNFOLDERID aFolderId,
                      nsIFile** aFile)
 {
-  // Skip off checking for library support if the os is Vista or lower.
-  if (!IsWin7OrLater()) {
-    return GetWindowsFolder(aFallbackFolderId, aFile);
-  }
-
   RefPtr<IShellLibrary> shellLib;
   RefPtr<IShellItem> savePath;
   HRESULT hr =
     SHLoadLibraryFromKnownFolder(aFolderId, STGM_READ,
                                  IID_IShellLibrary, getter_AddRefs(shellLib));
 
   if (shellLib &&
       SUCCEEDED(shellLib->GetDefaultSaveFolder(DSFT_DETECT, IID_IShellItem,
@@ -710,18 +701,16 @@ GetSpecialSystemDirectory(SystemDirector
       nsresult rv = GetWindowsFolder(CSIDL_LOCAL_APPDATA, aFile);
       if (NS_FAILED(rv)) {
         rv = GetRegWindowsAppDataFolder(true, aFile);
       }
       return rv;
     }
 #if defined(MOZ_CONTENT_SANDBOX)
     case Win_LocalAppdataLow: {
-      // This should only really fail on versions pre-Vista, in which case this
-      // shouldn't have been used in the first place.
       GUID localAppDataLowGuid = FOLDERID_LocalAppDataLow;
       return GetKnownFolder(&localAppDataLowGuid, aFile);
     }
 #endif
     case Win_Documents: {
       return GetLibrarySaveToPath(CSIDL_MYDOCUMENTS,
                                   FOLDERID_DocumentsLibrary,
                                   aFile);
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -2,17 +2,16 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/UniquePtrExtensions.h"
-#include "mozilla/WindowsVersion.h"
 
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsMemory.h"
 #include "GeckoProfiler.h"
 
 #include "nsLocalFile.h"
 #include "nsIDirectoryEnumerator.h"
@@ -1965,23 +1964,21 @@ nsLocalFile::CopySingleFile(nsIFile* aSo
   // file writes can cause the resultant file to become corrupt. We only need to do
   // this if the major version of Windows is > 5(Only Windows Vista and above
   // can support SMBV2).  With a 7200RPM hard drive:
   // Copying a 1KB file with COPY_FILE_NO_BUFFERING takes about 30-60ms.
   // Copying a 1KB file without COPY_FILE_NO_BUFFERING takes < 1ms.
   // So we only use COPY_FILE_NO_BUFFERING when we have a remote drive.
   int copyOK;
   DWORD dwCopyFlags = COPY_FILE_ALLOW_DECRYPTED_DESTINATION;
-  if (IsVistaOrLater()) {
-    bool path1Remote, path2Remote;
-    if (!IsRemoteFilePath(filePath.get(), path1Remote) ||
-        !IsRemoteFilePath(destPath.get(), path2Remote) ||
-        path1Remote || path2Remote) {
-      dwCopyFlags |= COPY_FILE_NO_BUFFERING;
-    }
+  bool path1Remote, path2Remote;
+  if (!IsRemoteFilePath(filePath.get(), path1Remote) ||
+      !IsRemoteFilePath(destPath.get(), path2Remote) ||
+      path1Remote || path2Remote) {
+    dwCopyFlags |= COPY_FILE_NO_BUFFERING;
   }
 
   if (!move) {
     copyOK = ::CopyFileExW(filePath.get(), destPath.get(), nullptr,
                            nullptr, nullptr, dwCopyFlags);
   } else {
     copyOK = ::MoveFileExW(filePath.get(), destPath.get(),
                            MOVEFILE_REPLACE_EXISTING);