Bug 1469686: Fix nonsense in test_temporary and re-enable on win32-debug. r=rhelmer
authorKris Maglione <maglione.k@gmail.com>
Tue, 19 Jun 2018 13:58:27 -0700
changeset 423051 c159c8750ee1aa29a568a5d4609af98d8a9ea1b0
parent 423050 42d6174c52eeba85a89d72a5cb2d25411b4c22a4
child 423052 693b36bb1292c4b999c4ef8b9ed6b06256be0bca
push id34162
push userapavel@mozilla.com
push dateWed, 20 Jun 2018 11:28:39 +0000
treeherdermozilla-central@681eb7dfa324 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhelmer
bugs1469686
milestone62.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 1469686: Fix nonsense in test_temporary and re-enable on win32-debug. r=rhelmer MozReview-Commit-ID: 32oAFlUsDRq
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -201,16 +201,24 @@ function isManifestRegistered(file) {
   }
   return false;
 }
 
 const BOOTSTRAP_MONITOR_BOOTSTRAP_JS = `
   ChromeUtils.import("resource://xpcshell-data/BootstrapMonitor.jsm").monitor(this);
 `;
 
+
+const EMPTY_BOOTSTRAP_JS = `
+  function startup() {}
+  function shutdown() {}
+  function install() {}
+  function uninstall() {}
+`;
+
 // Listens to messages from bootstrap.js telling us what add-ons were started
 // and stopped etc. and performs some sanity checks that only installed add-ons
 // are started etc.
 this.BootstrapMonitor = {
   inited: false,
 
   // Contain the current state of add-ons in the system
   installed: new Map(),
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -9,25 +9,25 @@ const ID = "bootstrap1@tests.mozilla.org
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
 
 const ADDONS = {
   test_bootstrap1_1: {
     "install.rdf": {
       "id": ID,
       "name": "Test Bootstrap 1",
     },
-    "bootstrap.js": BOOTSTRAP_MONITOR_BOOTSTRAP_JS
+    "bootstrap.js": EMPTY_BOOTSTRAP_JS
   },
   test_bootstrap1_2: {
     "install.rdf": {
       "id": "bootstrap1@tests.mozilla.org",
       "version": "2.0",
       "name": "Test Bootstrap 1",
     },
-    "bootstrap.js": BOOTSTRAP_MONITOR_BOOTSTRAP_JS
+    "bootstrap.js": EMPTY_BOOTSTRAP_JS
   },
 };
 
 const XPIS = {};
 for (let [name, files] of Object.entries(ADDONS)) {
   XPIS[name] = AddonTestUtils.createTempXPIFile(files);
 }
 
@@ -57,17 +57,17 @@ async function checkEvent(promise, {reas
   }
 }
 
 let Monitor = SlightlyLessDodgyBootstrapMonitor;
 Monitor.init();
 
 // Install a temporary add-on with no existing add-on present.
 // Restart and make sure it has gone away.
-add_task(async function() {
+add_task(async function test_new_temporary() {
   await promiseStartupManager();
 
   let extInstallCalled = false;
   AddonManager.addInstallListener({
     onExternalInstall: (aInstall) => {
       Assert.equal(aInstall.id, ID);
       Assert.equal(aInstall.version, "1.0");
       extInstallCalled = true;
@@ -111,16 +111,17 @@ add_task(async function() {
   checkAddon(ID, addon, {
     version: "1.0",
     name: "Test Bootstrap 1",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: true,
   });
 
   let onShutdown = waitForBootstrapEvent("shutdown", ID);
   let onUninstall = waitForBootstrapEvent("uninstall", ID);
 
   await promiseRestartManager();
 
   let shutdown = await onShutdown;
@@ -135,30 +136,31 @@ add_task(async function() {
   addon = await promiseAddonByID(ID);
   Assert.equal(addon, null);
 
   await promiseRestartManager();
 });
 
 // Install a temporary add-on over the top of an existing add-on.
 // Restart and make sure the existing add-on comes back.
-add_task(async function() {
+add_task(async function test_replace_temporary() {
   let {addon} = await AddonTestUtils.promiseInstallXPI(ADDONS.test_bootstrap1_2);
 
   Monitor.checkInstalled(ID, "2.0");
   Monitor.checkStarted(ID, "2.0");
 
   checkAddon(ID, addon, {
     version: "2.0",
     name: "Test Bootstrap 1",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: false,
   });
 
   let tempdir = gTmpD.clone();
 
   let bootstrapJS = await OS.File.read("data/test_temporary/bootstrap.js", {encoding: "utf-8"});
 
   for (let newversion of ["1.0", "3.0"]) {
     for (let packed of [false, true]) {
@@ -246,16 +248,17 @@ add_task(async function() {
       checkAddon(ID, addon, {
         version: newversion,
         name: "Test Bootstrap 1 (temporary)",
         isCompatible: true,
         appDisabled: false,
         isActive: true,
         type: "extension",
         signedState,
+        temporarilyInstalled: true,
       });
 
       // Now restart, the temporary addon will go away which should
       // be the opposite action (ie, if the temporary addon was an
       // upgrade, then removing it is a downgrade and vice versa)
       reason = reason == BOOTSTRAP_REASONS.ADDON_UPGRADE ?
                BOOTSTRAP_REASONS.ADDON_DOWNGRADE :
                BOOTSTRAP_REASONS.ADDON_UPGRADE;
@@ -308,16 +311,17 @@ add_task(async function() {
       checkAddon(ID, addon, {
         version: "2.0",
         name: "Test Bootstrap 1",
         isCompatible: true,
         appDisabled: false,
         isActive: true,
         type: "extension",
         signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+        temporarilyInstalled: false,
       });
 
       Services.obs.notifyObservers(target, "flush-cache-entry");
       target.remove(true);
     }
   }
 
   // remove original add-on
@@ -355,16 +359,17 @@ add_task(async function test_samefile() 
   checkAddon(ID, addon, {
     version: "1.0",
     name: "Test WebExtension 1 (temporary)",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: true,
   });
 
   Services.obs.notifyObservers(webext, "flush-cache-entry");
   webext.remove(false);
   webext = createTempWebExtensionFile({
     manifest: {
       version: "2.0",
       name: "Test WebExtension 1 (temporary)",
@@ -383,30 +388,31 @@ add_task(async function test_samefile() 
     version: "2.0",
     name: "Test WebExtension 1 (temporary)",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     isWebExtension: true,
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: true,
   });
 
   await addon.uninstall();
 });
 
 function promiseWriteWebExtensionToDir(dir, manifest) {
   return AddonTestUtils.promiseWriteFilesToDir(dir.path, {
     "manifest.json": ExtensionTestCommon.generateManifest(manifest),
   });
 }
 
 // Install a temporary add-on over the top of an existing add-on.
 // Uninstall it and make sure the existing add-on comes back.
-add_task(async function() {
+add_task(async function test_replace_permanent() {
   await promiseInstallWebExtension({
     manifest: {
       applications: {gecko: {id: ID}},
       version: "1.0",
       name: "Test Bootstrap 1",
     },
   });
 
@@ -464,16 +470,17 @@ add_task(async function() {
   checkAddon(ID, addon, {
     version: "2.0",
     name: "Test Bootstrap 1 (temporary)",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_UNKNOWN,
+    temporarilyInstalled: true,
   });
 
   await addon.uninstall();
 
   Monitor.checkInstalled(ID);
   Monitor.checkStarted(ID);
 
   addon = await promiseAddonByID(ID);
@@ -482,30 +489,31 @@ add_task(async function() {
   checkAddon(ID, addon, {
     version: "1.0",
     name: "Test Bootstrap 1",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: false,
   });
 
   unpacked_addon.remove(true);
   await addon.uninstall();
 
   Monitor.checkNotInstalled(ID);
   Monitor.checkNotStarted(ID);
 
   await promiseRestartManager();
 });
 
 // Install a temporary add-on as a version upgrade over the top of an
 // existing temporary add-on.
-add_task(async function() {
+add_task(async function test_replace_temporary_upgrade_presumably_in_a_different_way_from_the_previous_similar_task() {
   const unpackedAddon = gTmpD.clone();
   unpackedAddon.append(ID);
 
   await promiseWriteWebExtensionToDir(unpackedAddon, {
     applications: {gecko: {id: ID}},
     version: "1.0",
   });
 
@@ -550,17 +558,17 @@ add_task(async function() {
   await addon.uninstall();
 
   unpackedAddon.remove(true);
   await promiseRestartManager();
 });
 
 // Install a temporary add-on as a version downgrade over the top of an
 // existing temporary add-on.
-add_task(async function() {
+add_task(async function test_replace_temporary_downgrade() {
   const unpackedAddon = gTmpD.clone();
   unpackedAddon.append(ID);
 
   await promiseWriteWebExtensionToDir(unpackedAddon, {
     applications: {gecko: {id: ID}},
     version: "1.0",
   });
 
@@ -604,17 +612,17 @@ add_task(async function() {
   await addon.uninstall();
 
   unpackedAddon.remove(true);
   await promiseRestartManager();
 });
 
 // Installing a temporary add-on over an existing add-on with the same
 // version number should be installed as an upgrade.
-add_task(async function() {
+add_task(async function test_replace_permanent_upgrade_presumably_in_a_different_way_from_the_previous_similar_task() {
   const unpackedAddon = gTmpD.clone();
   unpackedAddon.append(ID);
 
   await promiseWriteWebExtensionToDir(unpackedAddon, {
     applications: {gecko: {id: ID}},
     version: "1.0",
   });
 
@@ -671,17 +679,17 @@ add_task(async function() {
   await addon.uninstall();
 
   unpackedAddon.remove(true);
   await promiseRestartManager();
 });
 
 // Install a temporary add-on over the top of an existing disabled add-on.
 // After restart, the existing add-on should continue to be installed and disabled.
-add_task(async function() {
+add_task(async function test_replace_permanent_disabled() {
   let {addon} = await AddonTestUtils.promiseInstallXPI(ADDONS.test_bootstrap1_1);
 
   Monitor.checkInstalled(ID, "1.0");
   Monitor.checkStarted(ID, "1.0");
 
   await addon.disable();
 
   Monitor.checkInstalled(ID, "1.0");
@@ -716,16 +724,17 @@ add_task(async function() {
   checkAddon(ID, tempAddon, {
     version: "2.0",
     name: "Test Bootstrap 1 (temporary)",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_UNKNOWN,
+    temporarilyInstalled: true,
   });
 
   await tempAddon.uninstall();
   unpacked_addon.remove(true);
 
   await addon.enable();
   await new Promise(executeSoon);
   addon = await promiseAddonByID(ID);
@@ -737,81 +746,27 @@ add_task(async function() {
   checkAddon(ID, addon, {
     version: "1.0",
     name: "Test Bootstrap 1",
     isCompatible: true,
     appDisabled: false,
     isActive: true,
     type: "extension",
     signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
+    temporarilyInstalled: false,
   });
 
   await addon.uninstall();
 
   Monitor.checkNotInstalled(ID);
   Monitor.checkNotStarted(ID);
 
   await promiseRestartManager();
 });
 
-// Installing a temporary add-on when there is already a temporary
-// add-on should fail.
-add_task(async function() {
-  await AddonManager.installTemporaryAddon(XPIS.test_bootstrap1_1);
-
-  let addon = await promiseAddonByID(ID);
-
-  Monitor.checkInstalled(ID, "1.0");
-  Monitor.checkStarted(ID, "1.0");
-
-  checkAddon(ID, addon, {
-    version: "1.0",
-    name: "Test Bootstrap 1",
-    isCompatible: true,
-    appDisabled: false,
-    isActive: true,
-    type: "extension",
-    isWebExtension: false,
-    signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
-  });
-
-  await AddonManager.installTemporaryAddon(XPIS.test_bootstrap1_1);
-
-  Monitor.checkInstalled(ID, "1.0");
-  Monitor.checkStarted(ID, "1.0");
-
-  await promiseRestartManager();
-
-  Monitor.checkNotInstalled(ID);
-  Monitor.checkNotStarted(ID);
-});
-
-// Check that a temporary add-on is marked as such.
-add_task(async function() {
-  await AddonManager.installTemporaryAddon(XPIS.test_bootstrap1_1);
-  const addon = await promiseAddonByID(ID);
-
-  checkAddon(ID, addon, {
-    temporarilyInstalled: true,
-  });
-
-  await promiseRestartManager();
-});
-
-// Check that a permanent add-on is not marked as temporarily installed.
-add_task(async function() {
-  let {addon} = await AddonTestUtils.promiseInstallXPI(ADDONS.test_bootstrap1_1);
-
-  checkAddon(ID, addon, {
-    temporarilyInstalled: false,
-  });
-
-  await promiseRestartManager();
-});
-
 // Tests that XPIs with a .zip extension work when loaded temporarily.
 add_task({ skip_if: () => AppConstants.MOZ_APP_NAME == "thunderbird" },
          async function test_zip_extension() {
   let xpi = createTempWebExtensionFile({
     background() {
       /* globals browser */
       browser.test.sendMessage("started", "Hello.");
     },
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -226,17 +226,16 @@ skip-if = true # Failing intermittently 
 [test_system_update_enterprisepolicy.js]
 skip-if = appname == "thunderbird"
 [test_system_update_fail.js]
 [test_system_update_newset.js]
 [test_system_update_overlapping.js]
 [test_system_update_upgrades.js]
 [test_temporary.js]
 tags = webextensions
-skip-if = debug && os == 'win' # Bug 1469686
 [test_theme_update.js]
 [test_trash_directory.js]
 skip-if = os != "win"
 [test_types.js]
 [test_undouninstall.js]
 skip-if = os == "win" # Bug 1358846
 [test_update.js]
 # Bug 676992: test consistently hangs on Android; bug 1330227 - linux