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
This commit is contained in:
Kirk Steuber 2018-02-14 14:55:27 -08:00
Родитель cf67ba7589
Коммит d076d47719
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -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);
}
};