Bug 1361675 - Cookie import test fails on Win 10. r=gijs draft
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 12 May 2017 10:19:02 +0200
changeset 576991 e7d854664d9747cef7059ebc5b5de6cf9a1f745b
parent 576975 8a73de724f644192973e88b7685689b048023676
child 628387 27f3c364f7e62238e322f4afb035a8c79c20a43b
push id58563
push usermak77@bonardo.net
push dateFri, 12 May 2017 16:20:59 +0000
reviewersgijs
bugs1361675
milestone55.0a1
Bug 1361675 - Cookie import test fails on Win 10. r=gijs MozReview-Commit-ID: 70iJjYaW1ya
browser/components/migration/MSMigrationUtils.jsm
--- a/browser/components/migration/MSMigrationUtils.jsm
+++ b/browser/components/migration/MSMigrationUtils.jsm
@@ -462,18 +462,19 @@ Cookies.prototype = {
     // If UAC is enabled, the most common destination is CookD/Low.  Though,
     // if the user runs the application in administrator mode or disables UAC,
     // cookies are stored in the original CookD destination.  Cause running the
     // browser in administrator mode is unsafe and discouraged, we just care
     // about the UAC state.
     if (!this.__cookiesFolder) {
       let cookiesFolder = Services.dirsvc.get("CookD", Ci.nsIFile);
       if (cookiesFolder.exists() && cookiesFolder.isReadable()) {
-        // Check if UAC is enabled.
-        if (Services.appinfo.QueryInterface(Ci.nsIWinAppHelper).userCanElevate) {
+        // In versions up to Windows 7, check if UAC is enabled.
+        if (AppConstants.isPlatformAndVersionAtMost("win", "6.1") &&
+            Services.appinfo.QueryInterface(Ci.nsIWinAppHelper).userCanElevate) {
           cookiesFolder.append("Low");
         }
         this.__cookiesFolder = cookiesFolder;
       }
     }
     return this.__cookiesFolder;
   },
 
@@ -507,17 +508,17 @@ Cookies.prototype = {
       let success = false;
       let folders = this._migrationType == MSMigrationUtils.MIGRATION_TYPE_EDGE ?
                       this.__cookiesFolders : [this.__cookiesFolder];
       for (let folder of folders) {
         let entries = folder.directoryEntries;
         while (entries.hasMoreElements()) {
           let entry = entries.getNext().QueryInterface(Ci.nsIFile);
           // Skip eventual bogus entries.
-          if (!entry.isFile() || !/\.txt$/.test(entry.leafName))
+          if (!entry.isFile() || !/\.(cookie|txt)$/.test(entry.leafName))
             continue;
 
           this._readCookieFile(entry, function(aSuccess) {
             // Importing even a single cookie file is considered a success.
             if (aSuccess)
               success = true;
             try {
               cookiesGenerator.next();