Bug 1426563 Fix test_temporary.js on non-nightly channels draft
authorAndrew Swan <aswan@mozilla.com>
Thu, 21 Dec 2017 12:12:18 -0800
changeset 714147 64979cd6b0cf9323d00e226c3d2f529a594ed927
parent 714124 0843e4e6cb1d6e32a35ce4d7014bd250c24f74fa
child 744539 c3bdbf4d849477a7fe070f1c26048930a3b25a58
push id93867
push useraswan@mozilla.com
push dateThu, 21 Dec 2017 20:28:38 +0000
bugs1426563
milestone59.0a1
Bug 1426563 Fix test_temporary.js on non-nightly channels In the test of temporary installation of webextension experiments, the test certificate shim code was marking the test addon as privileged which allowed it to be loaded, fix that here. MozReview-Commit-ID: IaZshrMNr3v
toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -818,31 +818,38 @@ add_task(async function() {
   equal(addon.temporarilyInstalled, false);
 
   await promiseRestartManager();
 });
 
 // Check that WebExtensions experiments can only be installed temporarily
 // in builds that allow legacy extensions.
 add_task(async function() {
+  AddonTestUtils.usePrivilegedSignatures = false;
+
   const API_ID = "apiexperiment@tests.mozilla.org";
   let xpi = createTempXPIFile({
     id: API_ID,
     name: "WebExtension Experiment",
     version: "1.0",
     type: 256,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
   });
 
-  await AddonManager.installTemporaryAddon(xpi);
-  let addon = await promiseAddonByID(API_ID);
+  let addon = null;
+  try {
+    await AddonManager.installTemporaryAddon(xpi);
+    addon = await promiseAddonByID(API_ID);
+  } catch (err) {
+    // fall through, level addon null
+  }
 
   if (AppConstants.MOZ_ALLOW_LEGACY_EXTENSIONS) {
     notEqual(addon, null, "Temporary install of WebExtension experiment succeeded");
     addon.uninstall();
   } else {
     equal(addon, null, "Temporary install of WebExtension experiment was not allowed");
   }
 });