From d076d477192a906792e5e3a2aad2bf1b2b3eb3f8 Mon Sep 17 00:00:00 2001 From: Kirk Steuber Date: Wed, 14 Feb 2018 14:55:27 -0800 Subject: [PATCH] Bug 1436851 - Prevent AddonTestUtils.jsm from overriding a pref value r=kmag AddonTestUtils.overrideBuiltIns sets |security.turn_off_all_security_so_that_viruses_can_take_over_this_computer| to true when it starts. It then naively sets it to false, assuming that that was the original value. This patch simply corrects that behavior to return the value to the previously set value, whatever that may have been. MozReview-Commit-ID: KbhmoixBvpW --HG-- extra : rebase_source : 0440ca6f4867e71fe1c3b10eb9a4fb735add4c29 --- toolkit/mozapps/extensions/internal/AddonTestUtils.jsm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm index cc6bff8382be..185d507f2bc6 100644 --- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm +++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm @@ -1286,6 +1286,7 @@ var AddonTestUtils = { async overrideBuiltIns(data) { // We need to set this in order load the URL preloader service, which // is only possible when running in automation. + let prevPrefVal = Services.prefs.getBoolPref(PREF_DISABLE_SECURITY, false); Services.prefs.setBoolPref(PREF_DISABLE_SECURITY, true); aomStartup.initializeURLPreloader(); @@ -1297,7 +1298,7 @@ var AddonTestUtils = { ["override", "chrome://browser/content/built_in_addons.json", Services.io.newFileURI(file).spec], ]); - Services.prefs.setBoolPref(PREF_DISABLE_SECURITY, false); + Services.prefs.setBoolPref(PREF_DISABLE_SECURITY, prevPrefVal); } };