Skip to content

Commit

Permalink
Bug 1504605 - Add Prefs to xpcshell test files for allowing usage of …
Browse files Browse the repository at this point in the history
…eval. r=ckerschb

Reviewers: ckerschb

Reviewed By: ckerschb

Subscribers: ckerschb

Bug #: 1504605

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

--HG--
extra : rebase_source : 9abb395224bdfa7795516295babfd847ea2553f4
  • Loading branch information
cegvinoth committed Nov 5, 2018
1 parent 3400b2b commit e14aa29
Show file tree
Hide file tree
Showing 63 changed files with 372 additions and 0 deletions.
2 changes: 2 additions & 0 deletions devtools/client/debugger/test/mochitest/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtool
// be affected by this pref.
var gEnableLogging = Services.prefs.getBoolPref("devtools.debugger.log");
Services.prefs.setBoolPref("devtools.debugger.log", false);
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

var { BrowserToolboxProcess } = ChromeUtils.import("resource://devtools/client/framework/ToolboxProcess.jsm", {});
var { DebuggerServer } = require("devtools/server/main");
Expand All @@ -37,6 +38,7 @@ const CHROME_URI = Services.io.newURI(CHROME_URL);
registerCleanupFunction(async function() {
info("finish() was called, cleaning up...");
Services.prefs.setBoolPref("devtools.debugger.log", gEnableLogging);
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");

while (gBrowser && gBrowser.tabs && gBrowser.tabs.length > 1) {
info("Destroying toolbox.");
Expand Down
6 changes: 6 additions & 0 deletions devtools/client/shared/test/browser_dbg_listworkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

"use strict";

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

// Import helpers for the workers
/* import-globals-from helper_workers.js */
Services.scriptloader.loadSubScript(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

// Test dynamic updates in the storage inspector for cookies.

add_task(async function() {
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-02.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-03.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-04.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-05.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-stack");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-06.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_framebindings-07.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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");
});

// Test that the EnvironmentClient's getBindings() method works as expected.
function run_test() {
initTestDebuggerServer();
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_longstringgrips-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_longstringgrips-02.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-04.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-05.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-06.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-07.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-08.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-09.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-10.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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");
});

// Test that closures can be inspected.

function run_test() {
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-11.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-12.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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() {
initTestDebuggerServer();
gDebuggee = addTestGlobal("test-grips");
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-16.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-17.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ var gGlobalIsInvisible;
var gSubsumes;
var gIsOpaque;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-18.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ var gClient;
var gThreadClient;
var gCallback;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

function run_test() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-19.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
var gDebuggee;
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() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-20.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
// when passing `ignoreNonIndexedProperties` and `ignoreIndexedProperties` options
// with various objects. (See Bug 1403065)

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

async function run_test() {
do_test_pending();
await run_test_with_server(DebuggerServer);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-21.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
var gDebuggee;
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() {
run_test_with_server(DebuggerServer, function() {
run_test_with_server(WorkerDebuggerServer, do_test_finished);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-22.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
var gDebuggee;
var gThreadClient;

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

add_task(async function run_test() {
await run_test_with_server(DebuggerServer);
await run_test_with_server(WorkerDebuggerServer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
// numeric keys, and if they have a length property, that it matches the number
// of numeric keys. (See Bug 1371936)

Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);

registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});

async function run_test() {
do_test_pending();
await run_test_with_server(DebuggerServer);
Expand Down
6 changes: 6 additions & 0 deletions devtools/server/tests/unit/test_objectgrips-fn-apply-01.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 run_test() {
try {
do_test_pending();
Expand Down
Loading

0 comments on commit e14aa29

Please sign in to comment.