Bug 1598259 - Remove support for MOZ_TOOLBOX_TEST_SCRIPT in ToolboxProcess.jsm r=ochameau
☠☠ backed out by 3bd8841fab31 ☠ ☠
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 22 Nov 2019 07:54:10 +0000
changeset 503324 38140fd01a52aa9e9f42d98200304eec6fcb6018
parent 503323 70b22c90ea2e2a3294d46a41cb4cb42be065537c
child 503325 772d21d0b16f3c75648e56040460a7d942c116d4
push id36833
push userbtara@mozilla.com
push dateFri, 22 Nov 2019 21:40:53 +0000
treeherdermozilla-central@2c912e46295e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1598259
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/aboutdebugging/test/browser/helper-addons.js
devtools/client/framework/test/helpers.js
devtools/client/framework/toolbox-process-window.js
--- a/devtools/client/aboutdebugging/test/browser/helper-addons.js
+++ b/devtools/client/aboutdebugging/test/browser/helper-addons.js
@@ -12,18 +12,16 @@ function _getSupportsFile(path) {
   const uri = Services.io.newURI(CHROME_URL_ROOT + path);
   const fileurl = cr.convertChromeURL(uri);
   return fileurl.QueryInterface(Ci.nsIFileURL);
 }
 
 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 */
 
 /**
  * Install an extension using the AddonManager so it does not show up as temporary.
  */
 async function installRegularExtension(pathOrFile) {
   const isFile = typeof pathOrFile.isFile === "function" && pathOrFile.isFile();
--- a/devtools/client/framework/test/helpers.js
+++ b/devtools/client/framework/test/helpers.js
@@ -30,17 +30,17 @@ const { DebuggerClient } = require("devt
  *   Destroy the browser toolbox and make sure it exits cleanly.
  *
  * @param {Object}:
  *        - {Boolean} enableBrowserToolboxFission: pass true to enable the OBT.
  */
 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.
   ChromeUtils.import(
     "resource://testing-common/PromiseTestUtils.jsm"
   ).PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
 
   const process = await new Promise(onRun => {
--- a/devtools/client/framework/toolbox-process-window.js
+++ b/devtools/client/framework/toolbox-process-window.js
@@ -201,45 +201,28 @@ async function openToolbox(target) {
   await onNewToolbox(toolbox);
 }
 
 async function onNewToolbox(toolbox) {
   gToolbox = 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
   // (the firefox parent process) and can connect to this new server using
   // initBrowserToolboxTask(), allowing them to evaluate scripts here.
 
   const testLoader = new DevToolsLoader({
     invisibleToDebugger: true,