Bug 1463128 - Expose setInputValue and getInputValue at hud level; r=Honza.

Now that the JsTerm is a React component, we shouldn't
let external consumers have to get the instance in order
to perform some actions on the console input.
We start with the most used actions, setInputValue and getInputValue,
and might extend that in the future.

Differential Revision: https://phabricator.services.mozilla.com/D20685
This commit is contained in:
Nicolas Chevobbe
2019-02-27 10:09:35 +00:00
parent ccd419c03e
commit 8a8d018dff
11 changed files with 87 additions and 47 deletions

View File

@@ -324,8 +324,7 @@ class MarkupContextMenu {
*/
_useInConsole() {
this.toolbox.openSplitConsole().then(() => {
const panel = this.toolbox.getPanel("webconsole");
const jsterm = panel.hud.jsterm;
const {hud} = this.toolbox.getPanel("webconsole");
const evalString = `{ let i = 0;
while (window.hasOwnProperty("temp" + i) && i < 1000) {
@@ -338,8 +337,8 @@ class MarkupContextMenu {
const options = {
selectedNodeActor: this.selection.nodeFront.actorID,
};
jsterm.requestEvaluation(evalString, options).then((res) => {
jsterm.setInputValue(res.result);
hud.jsterm.requestEvaluation(evalString, options).then((res) => {
hud.setInputValue(res.result);
this.inspector.emit("console-var-ready");
});
});