Bug 1580165 - fix selected node for console; r=nchevobbe

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Laster 2019-10-29 00:36:23 +00:00
Родитель a57c1f48b0
Коммит ddef712d8f
3 изменённых файлов: 25 добавлений и 8 удалений

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

@ -37,7 +37,7 @@ loader.lazyRequireGetter(
const HELP_URL = "https://developer.mozilla.org/docs/Tools/Web_Console/Helpers";
function evaluateExpression(expression) {
return async ({ dispatch, webConsoleUI, hud }) => {
return async ({ dispatch, webConsoleUI, hud, client }) => {
if (!expression) {
expression = hud.getInputSelection() || hud.getInputValue();
}
@ -78,10 +78,11 @@ function evaluateExpression(expression) {
// we still need to pass the error response to onExpressionEvaluated.
const onSettled = res => res;
const response = await webConsoleFront
const response = await client
.evaluateJSAsync(expression, {
frameActor,
selectedNodeActor: webConsoleUI.getSelectedNodeActor(),
selectedNodeFront: webConsoleUI.getSelectedNodeFront(),
webConsoleFront,
mapped: mappedExpressionRes ? mappedExpressionRes.mapped : null,
})
.then(onSettled, onSettled);

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

@ -15,7 +15,21 @@ class ConsoleCommands {
}
evaluateJSAsync(expression, options) {
return this.proxy.webConsoleFront.evaluateJSAsync(expression, options);
const { selectedNodeFront, webConsoleFront } = options;
let front = this.proxy.webConsoleFront;
// Defer to the selected paused thread front
if (webConsoleFront) {
front = webConsoleFront;
}
// Defer to the selected node's thread console front
if (selectedNodeFront) {
front = selectedNodeFront.targetFront.activeConsole;
options.selectedNodeActor = selectedNodeFront.actorID;
}
return front.evaluateJSAsync(expression, options);
}
createObjectFront(object) {

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

@ -594,11 +594,13 @@ class WebConsoleUI {
}
getSelectedNodeActor() {
const front = this.getSelectedNodeFront();
return front ? front.actorID : null;
}
getSelectedNodeFront() {
const inspectorSelection = this.hud.getInspectorSelection();
if (inspectorSelection && inspectorSelection.nodeFront) {
return inspectorSelection.nodeFront.actorID;
}
return null;
return inspectorSelection ? inspectorSelection.nodeFront : null;
}
onMessageHover(type, message) {