Bug 1363760 - Part 2 - Corrected the permission that is reset at the end of a test draft
authorAlex Gaynor <agaynor@mozilla.com>
Tue, 30 May 2017 10:08:55 -0400
changeset 586502 1f897aa292ed
parent 586471 09fc5c4b2937
child 586503 6a99c80e7407
push id61436
push userbmo:agaynor@mozilla.com
push dateTue, 30 May 2017 15:38:05 +0000
bugs1363760
milestone55.0a1
Bug 1363760 - Part 2 - Corrected the permission that is reset at the end of a test Without this change, browser_update.js "resets" a preference that it never changed to a different value, which leaks through to future tests. This was introduced in a8fcca075fde, and appears to be a simple mistake since that change removes a setup/teardown pref change pair, but the prefs it changes are two different ones! This leaked pref change leads to test failures when special powers and mochitest are installed as non-temporary addons. MozReview-Commit-ID: 2jx3fB1iZMx
toolkit/mozapps/extensions/test/browser/browser_update.js
--- a/toolkit/mozapps/extensions/test/browser/browser_update.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_update.js
@@ -3,17 +3,19 @@
  */
 
 // Tests that updates correctly flush caches and that new files gets updated.
 
 function test() {
   requestLongerTimeout(2);
   waitForExplicitFinish();
 
-  Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
+  SpecialPowers.pushPrefEnv({"set": [
+    ["extensions.checkUpdateSecurity", false],
+  ]});
 
   run_next_test();
 }
 
 // Install a first version
 add_test(function() {
   AddonManager.getInstallForURL(TESTROOT + "addons/browser_update1_1.xpi",
                                 function(aInstall) {
@@ -38,16 +40,14 @@ add_test(function() {
     Services.ppmm.removeMessageListener("my-addon-2", messageListener);
     ok(true, "second version sent frame script message");
     run_next_test();
   });
 });
 
 // Finally, cleanup things
 add_test(function() {
-  Services.prefs.setBoolPref("xpinstall.signatures.required", true);
-
   AddonManager.getAddonByID("update1@tests.mozilla.org", function(aAddon) {
     aAddon.uninstall();
 
     finish();
   });
 });