Bug 1545415 - Remove new Function from parent_utils.js, r=MattN

Remove `new Function` from parent_utils.js and refactor affected code.
Remove parent_utils.js from eval()-whitelist.

Differential Revision: https://phabricator.services.mozilla.com/D28062

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonas Allmann 2019-04-25 14:10:05 +00:00
parent 290a5e07e8
commit 2fddbb5d45
3 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,8 @@
"use strict";
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal", true]]});
let MOCK_STORAGE = [{
"given-name": "John",
"additional-name": "R",

View File

@ -2717,7 +2717,7 @@ pref("csp.overrule_about_uris_without_csp_whitelist", false);
pref("csp.skip_about_page_has_csp_assert", false);
// assertion flag will be set to false after fixing Bug 1473549
pref("security.allow_eval_with_system_principal", false);
pref("security.uris_using_eval_with_system_principal", "autocomplete.xml,redux.js,react-redux.js,content-task.js,preferencesbindings.js,lodash.js,jszip.js,sinon-7.2.7.js,ajv-4.1.1.js,setup,jsol.js,parent_utils.js,chrometask_chromescript,simpletest/testrunner.js,simpletest/simpletest.js,file_bug1018265.xul,helperappdlg.jsm,test_execute_async_script.py");
pref("security.uris_using_eval_with_system_principal", "autocomplete.xml,redux.js,react-redux.js,content-task.js,preferencesbindings.js,lodash.js,jszip.js,sinon-7.2.7.js,ajv-4.1.1.js,setup,jsol.js,chrometask_chromescript,simpletest/testrunner.js,simpletest/simpletest.js,file_bug1018265.xul,helperappdlg.jsm,test_execute_async_script.py");
#endif
#if defined(DEBUG) || defined(FUZZING)

View File

@ -101,6 +101,9 @@ var ParentUtils = {
});
},
// Tests using this function need to flip pref for exceptional use of
// `new Function` / `eval()`.
// See test_autofill_and_ordinal_forms.html for example.
testMenuEntry(index, statement) {
ContentTaskUtils.waitForCondition(() => {
let el = gAutocompletePopup.richlistbox.getItemAtIndex(index);