Bug 1613845 - Remove print helper. r=jdescottes.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Fri, 07 Feb 2020 14:12:27 +0000
changeset 512897 6634c857d0916980fd0f8ec10b6898b2aaca5920
parent 512896 c4b3720c1985839fa8cd3a4f17a8df7b2e6a768e
child 512898 2b0d755fe4688620f85fc98d8d644453847d5c4e
push id37100
push userapavel@mozilla.com
push dateFri, 07 Feb 2020 21:53:54 +0000
treeherdermozilla-central@882200a11bcf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1613845
milestone74.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 1613845 - Remove print helper. r=jdescottes. Differential Revision: https://phabricator.services.mozilla.com/D61989
devtools/server/actors/webconsole/eval-with-debugger.js
devtools/server/actors/webconsole/utils.js
--- a/devtools/server/actors/webconsole/eval-with-debugger.js
+++ b/devtools/server/actors/webconsole/eval-with-debugger.js
@@ -651,21 +651,18 @@ function cleanupBindings(bindings, helpe
 
 function bindCommands(isCmd, dbgWindow, bindSelf, frame, helpers) {
   const bindings = helpers.sandbox;
   if (bindSelf) {
     bindings._self = bindSelf;
   }
   // Check if the Debugger.Frame or Debugger.Object for the global include any of the
   // helper function we set. We will not overwrite these functions with the Web Console
-  // commands. The exception being "print" which should exist everywhere as
-  // `window.print`, and that we don't want to trigger from the console.
-  const availableHelpers = [
-    ...WebConsoleCommands._originalCommands.keys(),
-  ].filter(h => h !== "print");
+  // commands.
+  const availableHelpers = [...WebConsoleCommands._originalCommands.keys()];
 
   let helpersToDisable = [];
   const helperCache = {};
 
   // do not override command functions if we are using the command key `:`
   // before the command string
   if (!isCmd) {
     if (frame) {
--- a/devtools/server/actors/webconsole/utils.js
+++ b/devtools/server/actors/webconsole/utils.js
@@ -595,35 +595,16 @@ WebConsoleCommands._registerOriginal("in
     type: "inspectObject",
     input: owner.evalInput,
     object: grip,
     forceExpandInConsole,
   };
 });
 
 /**
- * Print the String representation of a value to the output, as-is.
- *
- * @param any value
- *        A value you want to output as a string.
- * @return void
- */
-WebConsoleCommands._registerOriginal("print", function(owner, value) {
-  owner.helperResult = { rawOutput: true };
-  if (typeof value === "symbol") {
-    return Symbol.prototype.toString.call(value);
-  }
-  // Waiving Xrays here allows us to see a closer representation of the
-  // underlying object. This may execute arbitrary content code, but that
-  // code will run with content privileges, and the result will be rendered
-  // inert by coercing it to a String.
-  return String(Cu.waiveXrays(value));
-});
-
-/**
  * Copy the String representation of a value to the clipboard.
  *
  * @param any value
  *        A value you want to copy as a string.
  * @return void
  */
 WebConsoleCommands._registerOriginal("copy", function(owner, value) {
   let payload;