Bug 1425542 - Move inspectObjectActor away from jsterm; r=bgrins.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 15 Oct 2018 14:23:51 +0000
changeset 489639 71a04ddae0fad8b796e63f482269e825b98fd686
parent 489638 57c85fc5a5bc6a1c25fc0050aa4350bbe82f6ecf
child 489640 ba17ddb6432e1c67c860994697a565f9a663ecec
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersbgrins
bugs1425542
milestone64.0a1
Bug 1425542 - Move inspectObjectActor away from jsterm; r=bgrins. Differential Revision: https://phabricator.services.mozilla.com/D8519
devtools/client/framework/toolbox.js
devtools/client/webconsole/components/JSTerm.js
devtools/client/webconsole/webconsole-frame.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -2752,19 +2752,17 @@ Toolbox.prototype = {
         await this.selectTool("inspector");
       }
     } else if (objectActor.type !== "null" &&
                objectActor.type !== "undefined") {
       // Open then split console and inspect the object in the variables view,
       // when the objectActor doesn't represent an undefined or null value.
       await this.openSplitConsole();
       const panel = this.getPanel("webconsole");
-      const jsterm = panel.hud.jsterm;
-
-      jsterm.inspectObjectActor(objectActor);
+      panel.hud.ui.inspectObjectActor(objectActor);
     }
   },
 
   /**
    * Destroy the inspector/walker/selection fronts
    * Returns a promise that resolves when the fronts are destroyed
    * TODO: move to the inspector front once we can have listener hooks into fronts
    */
--- a/devtools/client/webconsole/components/JSTerm.js
+++ b/devtools/client/webconsole/components/JSTerm.js
@@ -470,17 +470,17 @@ class JSTerm extends Component {
       switch (helperResult.type) {
         case "clearOutput":
           this.hud.clearOutput();
           break;
         case "clearHistory":
           this.props.clearHistory();
           break;
         case "inspectObject":
-          this.inspectObjectActor(helperResult.object);
+          this.hud.inspectObjectActor(helperResult.object);
           break;
         case "error":
           try {
             errorMessage = l10n.getStr(helperResult.message);
           } catch (ex) {
             errorMessage = helperResult.message;
           }
           break;
@@ -508,26 +508,16 @@ class JSTerm extends Component {
 
     if (this.hud.consoleOutput) {
       return this.hud.consoleOutput.dispatchMessageAdd(response, true);
     }
 
     return null;
   }
 
-  inspectObjectActor(objectActor) {
-    this.hud.consoleOutput.dispatchMessageAdd({
-      helperResult: {
-        type: "inspectObject",
-        object: objectActor
-      }
-    }, true);
-    return this.hud.consoleOutput;
-  }
-
   screenshotNotify(results) {
     const wrappedResults = results.map(message => ({ message, type: "logMessage" }));
     this.hud.consoleOutput.dispatchMessagesAdd(wrappedResults);
   }
 
   /**
    * Execute a string. Execution happens asynchronously in the content process.
    *
--- a/devtools/client/webconsole/webconsole-frame.js
+++ b/devtools/client/webconsole/webconsole-frame.js
@@ -150,16 +150,26 @@ WebConsoleFrame.prototype = {
    */
   clearPrivateMessages() {
     if (this.consoleOutput) {
       this.consoleOutput.dispatchPrivateMessagesClear();
       this.emit("private-messages-cleared");
     }
   },
 
+  inspectObjectActor(objectActor) {
+    this.consoleOutput.dispatchMessageAdd({
+      helperResult: {
+        type: "inspectObject",
+        object: objectActor
+      }
+    }, true);
+    return this.consoleOutput;
+  },
+
   _onUpdateListeners() {
 
   },
 
   logWarningAboutReplacedAPI() {
     this.owner.target.logWarningInPage(l10n.getStr("ConsoleAPIDisabled"),
       "ConsoleAPIDisabled");
   },