Bug 1598259 - Remove support for MOZ_TOOLBOX_TEST_SCRIPT in ToolboxProcess.jsm r=ochameau

Depends on D54118

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2019-11-22 18:32:02 +00:00
Родитель 43086cf675
Коммит 07d61b0b9b
3 изменённых файлов: 8 добавлений и 27 удалений

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

@ -17,8 +17,6 @@ function _getSupportsFile(path) {
async function enableExtensionDebugging() {
// Disable security prompt
await pushPref("devtools.debugger.prompt-connection", false);
// Enable Browser toolbox test script execution via env variable
await pushPref("devtools.browser-toolbox.allow-unsafe-script", true);
}
/* exported enableExtensionDebugging */

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

@ -35,7 +35,7 @@ const { DebuggerClient } = require("devtools/shared/client/debugger-client");
async function initBrowserToolboxTask({ enableBrowserToolboxFission } = {}) {
await pushPref("devtools.chrome.enabled", true);
await pushPref("devtools.debugger.remote-enabled", true);
await pushPref("devtools.browser-toolbox.allow-unsafe-script", true);
await pushPref("devtools.browsertoolbox.enable-test-server", true);
await pushPref("devtools.debugger.prompt-connection", false);
// This rejection seems to affect all tests using the browser toolbox.

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

@ -206,35 +206,18 @@ async function onNewToolbox(toolbox) {
bindToolboxHandlers();
raise();
// Enable some testing features if a testing-only pref is set.
const prefName = "devtools.browser-toolbox.allow-unsafe-script";
// Enable some testing features if the browser toolbox test pref is set.
if (
Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL &&
Services.prefs.getBoolPref(prefName) === true
Services.prefs.getBoolPref(
"devtools.browsertoolbox.enable-test-server",
false
)
) {
// Execute any test script provided by an environment variable.
const env = Cc["@mozilla.org/process/environment;1"].getService(
Ci.nsIEnvironment
);
const testScript = env.get("MOZ_TOOLBOX_TEST_SCRIPT");
if (testScript) {
evaluateTestScript(testScript, toolbox);
} else {
// If there is no testing script, setup a server so that the test can
// evaluate messages in this process.
installTestingServer(toolbox);
}
// setup a server so that the test can evaluate messages in this process.
installTestingServer(toolbox);
}
}
function evaluateTestScript(script, toolbox) {
const sandbox = Cu.Sandbox(window);
sandbox.window = window;
sandbox.toolbox = toolbox;
sandbox.ChromeUtils = ChromeUtils;
Cu.evalInSandbox(script, sandbox);
}
function installTestingServer(toolbox) {
// Install a DebuggerServer in this process and inform the server of its
// location. Tests operating on the browser toolbox run in the server