Bug 1512949 - Remove eval from tests and flip assertion flag r=ckerschb

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
vinoth 2019-01-15 13:11:19 +00:00
Родитель c7936919a5
Коммит 5d09ad138e
13 изменённых файлов: 53 добавлений и 13 удалений

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

@ -4,6 +4,12 @@
"use strict";
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
async function testPrincipal(options, globalPrincipal, debuggeeHasXrays) {
const { debuggee } = options;
let global, subsumes, isOpaque, globalIsInvisible;

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

@ -4,6 +4,12 @@
"use strict";
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
// Run test_unsafe_grips twice, one against a system principal debuggee
// and another time with a null principal debuggee

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

@ -1,5 +1,9 @@
/* eslint-disable strict */
function run_test() {
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
ChromeUtils.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
const g = testGlobal("test");

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

@ -4,6 +4,12 @@
"use strict";
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
/**
* Make sure that stepping in the last statement of the last frame doesn't
* cause an unexpected pause, when another JS frame is pushed on the stack

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

@ -13,6 +13,12 @@ var gDebuggee;
var gClient;
var gThreadClient;
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
function run_test() {
if (typeof WebAssembly == "undefined") {
// wasm is not enabled for this platform

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

@ -31,8 +31,10 @@ const { LabelAndShallowSizeVisitor } = DominatorTreeNode;
// the output away anyway, unless you give it the --verbose flag.
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
Services.prefs.setBoolPref("devtools.debugger.log", true);
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("devtools.debugger.log");
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
}

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

@ -140,8 +140,15 @@ function* testSteps()
let newValue = cursor.value;
let destProp = Array.isArray(info.keyPath) ? info.keyPath[0] : info.keyPath;
if (destProp) {
// eslint-disable-next-line no-eval
eval("newValue." + destProp + " = 'newKeyValue'");
let splitDestProp = destProp.split(".");
if (splitDestProp.length == 1)
{
newValue[splitDestProp[0]] = "newKeyValue";
} else if (splitDestProp.length == 2) {
newValue[splitDestProp[0]][splitDestProp[1]] = "newKeyValue";
} else {
newValue[splitDestProp[0]][splitDestProp[1]][splitDestProp[2]] = "newKeyValue";
}
}
else {
newValue = "newKeyValue";

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

@ -22,6 +22,9 @@ var sandbox = new Cu.Sandbox("about:blank");
var test_utils = window.windowUtils;
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal",
true]]});
function getCOW(x) {
if (typeof x != 'object' && typeof x != 'function')
return x;

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

@ -2677,7 +2677,7 @@ pref("csp.about_uris_without_csp", "blank,printpreview,srcdoc,about,addons,cache
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", true);
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,content-task.js,tree.xml,dialog.xml,preferencesbindings.js,wizard.xml,lodash.js,jszip.js,ajv-4.1.1.js,updates.js,setup,jsol.js");
#endif

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

@ -29,11 +29,11 @@ function run_test()
function run_test_number(num)
{
testPath = testPathBase + num;
httpserver.registerPathHandler(testPath, eval("handler" + num));
httpserver.registerPathHandler(testPath, this["handler" + num]);
var channel = setupChannel(testPath);
flags = test_flags[num]; // OK if flags undefined for test
channel.asyncOpen2(new ChannelListener(eval("completeTest" + num),
channel.asyncOpen2(new ChannelListener(this["completeTest" + num],
channel, flags));
}

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

@ -50,9 +50,9 @@ function runNextTest()
}
nextTest++;
// Make sure test functions exist
if (eval("handler" + nextTest) == undefined)
if (this["handler" + nextTest] == undefined)
do_throw("handler" + nextTest + " undefined!");
if (eval("completeTest" + nextTest) == undefined)
if (this["completeTest" + nextTest] == undefined)
do_throw("completeTest" + nextTest + " undefined!");
run_test_number(nextTest);
@ -61,11 +61,11 @@ function runNextTest()
function run_test_number(num)
{
testPath = testPathBase + num;
httpserver.registerPathHandler(testPath, eval("handler" + num));
httpserver.registerPathHandler(testPath, this["handler" + num]);
var channel = setupChannel(testPath);
flags = test_flags[num]; // OK if flags undefined for test
channel.asyncOpen2(new ChannelListener(eval("completeTest" + num),
channel.asyncOpen2(new ChannelListener(this["completeTest" + num],
channel, flags));
}

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

@ -82,14 +82,12 @@ var setupScript = runInParent(function setup() {
}
addMessageListener("addLogin", loginVariableName => {
// eslint-disable-next-line no-eval
let login = eval(loginVariableName);
let login = this[loginVariableName];
assert.ok(!!login, "Login to add is defined: " + loginVariableName);
Services.logins.addLogin(login);
});
addMessageListener("removeLogin", loginVariableName => {
// eslint-disable-next-line no-eval
let login = eval(loginVariableName);
let login = this[loginVariableName];
assert.ok(!!login, "Login to delete is defined: " + loginVariableName);
Services.logins.removeLogin(login);
});

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

@ -141,6 +141,8 @@ Form History test: form field autocomplete
<script class="testbody" type="text/javascript">
/** Test for Form History autocomplete **/
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal", true]]});
var input = $_(1, "field1");
function setupFormHistory(aCallback) {