Backout ea0539bb2118 (bug 685155) due to test failures on OSX
authorBlair McBride <bmcbride@mozilla.com>
Thu, 29 Dec 2011 05:10:58 +1300
changeset 84722 ceef67c17cfadf939ddb1fe78cca90c0d2ab4235
parent 84721 780d0952d0283863f25a82b7400214f2bfdc880d
child 84723 8ae5766168c826a8b44b7752ed54ed834f16d068
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs685155
milestone12.0a1
backs outea0539bb211875f17b4583c3821d5a3609b37fe1
Backout ea0539bb2118 (bug 685155) due to test failures on OSX
toolkit/mozapps/extensions/XPIProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -289,17 +289,17 @@ SafeInstallOperation.prototype = {
 
     // Note we put the directory move in after all the file moves so the
     // directory is recreated before all the files are moved back
     this._installedFiles.push({ oldFile: aDirectory, newFile: newDir });
   },
 
   _installDirEntry: function(aDirEntry, aTargetDirectory, aCopy) {
     try {
-      if (aDirEntry.isDirectory() && !aDirEntry.isSymlink())
+      if (aDirEntry.isDirectory())
         this._installDirectory(aDirEntry, aTargetDirectory, aCopy);
       else
         this._installFile(aDirEntry, aTargetDirectory, aCopy);
     }
     catch (e) {
       ERROR("Failure " + (aCopy ? "copying" : "moving") + " " + aDirEntry.path +
             " to " + aTargetDirectory.path);
       throw e;
@@ -349,17 +349,17 @@ SafeInstallOperation.prototype = {
   /**
    * Rolls back all the moves that this operation performed. If an exception
    * occurs here then both old and new directories are left in an indeterminate
    * state
    */
   rollback: function() {
     while (this._installedFiles.length > 0) {
       let move = this._installedFiles.pop();
-      if (move.newFile.isDirectory() && !move.newFile.isSymlink()) {
+      if (move.newFile.isDirectory()) {
         let oldDir = move.oldFile.parent.clone();
         oldDir.append(move.oldFile.leafName);
         oldDir.create(Ci.nsILocalFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
       }
       else if (!move.oldFile) {
         // No old file means this was a copied file
         move.newFile.remove(true);
       }
@@ -1271,17 +1271,17 @@ function recursiveRemove(aFile) {
   aFile.permissions = aFile.isDirectory() ? FileUtils.PERMS_DIRECTORY
                                           : FileUtils.PERMS_FILE;
 
   try {
     aFile.remove(true);
     return;
   }
   catch (e) {
-    if (!aFile.isDirectory() || aFile.isSymlink()) {
+    if (!aFile.isDirectory()) {
       ERROR("Failed to remove file " + aFile.path, e);
       throw e;
     }
   }
 
   let entry;
   let dirEntries = aFile.directoryEntries.QueryInterface(Ci.nsIDirectoryEnumerator);
   try {
@@ -7850,43 +7850,34 @@ DirectoryInstallLocation.prototype = {
   /**
    * Reads a directory linked to in a file.
    *
    * @param   file
    *          The file containing the directory path
    * @return  a nsILocalFile object representing the linked directory.
    */
   _readDirectoryFromFile: function DirInstallLocation__readDirectoryFromFile(aFile) {
-    if (aFile.isSymlink()) {
-      var linkedDirectory = aFile.clone();
-      linkedDirectory.normalize();
-    }
-    else {
-      let fis = Cc["@mozilla.org/network/file-input-stream;1"].
-                createInstance(Ci.nsIFileInputStream);
-      fis.init(aFile, -1, -1, false);
-      let line = { value: "" };
-      if (fis instanceof Ci.nsILineInputStream)
-        fis.readLine(line);
-      fis.close();
-
-      if (line.value) {
-        linkedDirectory = Cc["@mozilla.org/file/local;1"].
-                          createInstance(Ci.nsILocalFile);
-
-        try {
-          linkedDirectory.initWithPath(line.value);
-        }
-        catch (e) {
-          linkedDirectory.setRelativeDescriptor(aFile.parent, line.value);
-        }
-      }
-    }
-
-    if (linkedDirectory) {
+    let fis = Cc["@mozilla.org/network/file-input-stream;1"].
+              createInstance(Ci.nsIFileInputStream);
+    fis.init(aFile, -1, -1, false);
+    let line = { value: "" };
+    if (fis instanceof Ci.nsILineInputStream)
+      fis.readLine(line);
+    fis.close();
+    if (line.value) {
+      let linkedDirectory = Cc["@mozilla.org/file/local;1"].
+                            createInstance(Ci.nsILocalFile);
+
+      try {
+        linkedDirectory.initWithPath(line.value);
+      }
+      catch (e) {
+        linkedDirectory.setRelativeDescriptor(aFile.parent, line.value);
+      }
+
       if (!linkedDirectory.exists()) {
         WARN("File pointer " + aFile.path + " points to " + linkedDirectory.path +
              " which does not exist");
         return null;
       }
 
       if (!linkedDirectory.isDirectory()) {
         WARN("File pointer " + aFile.path + " points to " + linkedDirectory.path +
@@ -7926,17 +7917,17 @@ DirectoryInstallLocation.prototype = {
       }
 
       if (!gIDTest.test(id)) {
         LOG("Ignoring file entry whose name is not a valid add-on ID: " +
              entry.path);
         continue;
       }
 
-      if (!directLoad && (entry.isFile() || entry.isSymlink())) {
+      if (entry.isFile() && !directLoad) {
         let newEntry = this._readDirectoryFromFile(entry);
         if (!newEntry) {
           LOG("Deleting stale pointer file " + entry.path);
           entry.remove(true);
           continue;
         }
 
         entry = newEntry;
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -513,17 +513,17 @@ function writeLocaleStrings(aData) {
 
 function createInstallRDF(aData) {
   var rdf = '<?xml version="1.0"?>\n';
   rdf += '<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n' +
          '     xmlns:em="http://www.mozilla.org/2004/em-rdf#">\n';
   rdf += '<Description about="urn:mozilla:install-manifest">\n';
 
   ["id", "version", "type", "internalName", "updateURL", "updateKey",
-   "optionsURL", "optionsType", "aboutURL", "iconURL", "icon64URL", "unpack",
+   "optionsURL", "optionsType", "aboutURL", "iconURL", "icon64URL",
    "skinnable", "bootstrap", "strictCompatibility"].forEach(function(aProp) {
     if (aProp in aData)
       rdf += "<em:" + aProp + ">" + escapeXML(aData[aProp]) + "</em:" + aProp + ">\n";
   });
 
   rdf += writeLocaleStrings(aData);
 
   if ("targetPlatforms" in aData) {
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests the semantics of extension proxy files and symlinks
-
-var ADDONS = [
-  {
-    id: "proxy1@tests.mozilla.org",
-    dirId: "proxy1@tests.mozilla.com",
-    type: "proxy"
-  },
-  {
-    id: "proxy2@tests.mozilla.org",
-    type: "proxy"
-  },
-  {
-    id: "symlink1@tests.mozilla.org",
-    dirId: "symlink1@tests.mozilla.com",
-    type: "symlink"
-  },
-  {
-    id: "symlink2@tests.mozilla.org",
-    type: "symlink"
-  }
-];
-
-var METADATA = {
-  version: "2.0",
-  targetApplications: [{
-    id: "xpcshell@tests.mozilla.org",
-    minVersion: "2",
-    maxVersion: "2"
-  }]
-}
-
-const ios = AM_Cc["@mozilla.org/network/io-service;1"].getService(AM_Ci.nsIIOService);
-
-const LocalFile = Components.Constructor("@mozilla.org/file/local;1",
-                                         "nsILocalFile", "initWithPath");
-const Process = Components.Constructor("@mozilla.org/process/util;1",
-                                       "nsIProcess", "init");
-
-const gHaveSymlinks = !("nsIWindowsRegKey" in AM_Ci);
-if (gHaveSymlinks)
-  var gLink = findExecutable("ln");
-
-
-// Unfortunately, GRE provides no way to create or manipulate symlinks
-// directly. Fallback to the ln(1) executable.
-function createSymlink(aSource, aDest) {
-  if (aSource instanceof AM_Ci.nsIFile)
-    aSource = aSource.path;
-
-  let process = Process(gLink);
-  process.run(true, ["-s", aSource, aDest.path], 3);
-  do_check_eq(process.exitValue, 0, Components.stack.caller);
-  return process.exitValue;
-}
-
-function findExecutable(aName) {
-  if (environment.PATH) {
-    for each (let path in environment.PATH.split(":")) {
-      try {
-        let file = LocalFile(path);
-        file.append(aName);
-
-        if (file.exists() && file.isFile() && file.isExecutable())
-          return file;
-      }
-      catch (e) {}
-    }
-  }
-  return null;
-}
-
-function writeFile(aData, aFile) {
-  if (!aFile.parent.exists())
-    aFile.parent.create(AM_Ci.nsIFile.DIRECTORY_TYPE, 0755);
-
-  var fos = AM_Cc["@mozilla.org/network/file-output-stream;1"].
-            createInstance(AM_Ci.nsIFileOutputStream);
-  fos.init(aFile,
-           FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
-           FileUtils.PERMS_FILE, 0);
-  fos.write(aData, aData.length);
-  fos.close();
-}
-
-function checkAddonsExist() {
-  for each (let addon in ADDONS) {
-    let file = addon.directory.clone();
-    file.append("install.rdf");
-    do_check_true(file.exists(), Components.stack.caller);
-  }
-}
-
-
-const profileDir = gProfD.clone();
-profileDir.append("extensions");
-
-
-function run_test() {
-  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
-
-  // Make sure we can create symlinks on platforms that support them.
-  do_check_true(!gHaveSymlinks || gLink != null);
-
-  add_test(run_proxy_tests);
-
-  if (gHaveSymlinks)
-    add_test(run_symlink_tests);
-
-  run_next_test();
-}
-
-function run_proxy_tests() {
-
-  for each (let addon in ADDONS) {
-    addon.directory = gTmpD.clone();
-    addon.directory.append(addon.id);
-
-    addon.proxyFile = profileDir.clone();
-    addon.proxyFile.append(addon.dirId || addon.id);
-
-    METADATA.id = addon.id;
-    METADATA.name = addon.id;
-    writeInstallRDFToDir(METADATA, addon.directory);
-
-    if (addon.type == "proxy") {
-      writeFile(addon.directory.path, addon.proxyFile)
-    }
-    else if (addon.type == "symlink" && gHaveSymlinks) {
-      createSymlink(addon.directory, addon.proxyFile)
-    }
-  }
-
-  startupManager();
-
-  // Check that all add-ons original sources still exist after invalid
-  // add-ons have been removed at startup.
-  checkAddonsExist();
-
-  AddonManager.getAddonsByIDs(ADDONS.map(function(addon) addon.id),
-                              function(addons) {
-    try {
-      for (let [i, addon] in Iterator(addons)) {
-        // Ensure that valid proxied add-ons were installed properly on
-        // platforms that support the installation method.
-        print(ADDONS[i].id, 
-              ADDONS[i].dirId,
-              ADDONS[i].dirId != null,
-              ADDONS[i].type == "symlink" && !gHaveSymlinks);
-        do_check_eq(addon == null,
-                    ADDONS[i].dirId != null
-                        || ADDONS[i].type == "symlink" && !gHaveSymlinks);
-
-        if (addon != null) {
-          // Check that proxied add-ons do not have upgrade permissions.
-          do_check_eq(addon.permissions & AddonManager.PERM_CAN_UPGRADE, 0);
-
-          // Check that getResourceURI points to the right place.
-          do_check_eq(ios.newFileURI(ADDONS[i].directory).spec,
-                      addon.getResourceURI().spec);
-
-          let file = ADDONS[i].directory.clone();
-          file.append("install.rdf");
-          do_check_eq(ios.newFileURI(file).spec,
-                      addon.getResourceURI("install.rdf").spec);
-
-          addon.uninstall();
-        }
-      }
-
-      // Check that original sources still exist after explicit uninstall.
-      restartManager();
-      checkAddonsExist();
-
-      shutdownManager();
-
-      // Check that all of the proxy files have been removed and remove
-      // the original targets.
-      for each (let addon in ADDONS) {
-        do_check_false(addon.proxyFile.exists());
-        addon.directory.remove(true);
-      }
-    }
-    catch (e) {
-      do_throw(e);
-    }
-
-    run_next_test();
-  });
-}
-
-function run_symlink_tests() {
-  // Check that symlinks are not followed out of a directory tree
-  // when deleting an add-on.
-
-  METADATA.id = "unpacked@test.mozilla.org";
-  METADATA.name = METADATA.id;
-  METADATA.unpack = "true";
-
-  let tempDirectory = gTmpD.clone();
-  tempDirectory.append(METADATA.id);
-
-  let tempFile = tempDirectory.clone();
-  tempFile.append("test.txt");
-  tempFile.create(AM_Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
-
-  let addonDirectory = profileDir.clone();
-  addonDirectory.append(METADATA.id);
-
-  let symlink = addonDirectory.clone();
-  symlink.append(tempDirectory.leafname);
-  createSymlink(tempDirectory, symlink);
-
-  // Make sure that the symlink was created properly.
-  let file = symlink.clone();
-  file.append(tempFile.leafName);
-  file.normalize();
-  do_check_true(file.equals(tempFile));
-
-  writeInstallRDFToDir(METADATA, addonDirectory);
-
-  startupManager();
-
-  AddonManager.getAddonByID(METADATA.id,
-                            function(addon) {
-    do_check_neq(addon, null);
-
-    addon.uninstall();
-
-    restartManager();
-    shutdownManager();
-
-    // Check that the install directory is gone.
-    do_check_false(addonDirectory.exists());
-
-    // Check that the temp file is not gone.
-    do_check_true(tempFile.exists());
-
-    tempDirectory.remove(true);
-
-    run_next_test();
-  });
-}
-
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -178,17 +178,16 @@ skip-if = os == "android"
 [test_migrate3.js]
 [test_migrate4.js]
 [test_migrate5.js]
 [test_migrateAddonRepository.js]
 [test_permissions.js]
 [test_plugins.js]
 # Bug 676992: test consistently fails on Android
 fail-if = os == "android"
-[test_proxies.js]
 [test_registry.js]
 [test_safemode.js]
 [test_startup.js]
 # Bug 676992: test consistently fails on Android
 fail-if = os == "android"
 [test_syncGUID.js]
 [test_strictcompatibility.js]
 [test_targetPlatforms.js]