Bug 1609345 - Fix inspect(el) in split console. r=jlast.

In the inspect handler, we were only selecting
the element in the inspector if the current panel
wasn't the inspector.
But if the current panel is the inspector, and the
split console is open, we still want the element
to be selected in the inspector.
This patch removes the extra check on the current
panel, and adds a test so we don't regress.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2020-01-15 16:14:37 +00:00
Родитель b2a45adc2b
Коммит adce7e15a3
2 изменённых файлов: 11 добавлений и 1 удалений

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

@ -3494,7 +3494,6 @@ Toolbox.prototype = {
objectActor && objectActor.getGrip ? objectActor.getGrip() : objectActor;
if (
this.currentToolId != "inspector" &&
objectGrip.preview &&
objectGrip.preview.nodeType === domNodeConstants.ELEMENT_NODE
) {

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

@ -21,6 +21,17 @@ async function testInspectingElement(hud) {
execute(hud, "inspect(document.querySelector('p'))");
await waitForSelectedElementInInspector(hud.toolbox, "p");
ok(true, "inspected element is now selected in the inspector");
info(
"Test that inspect selects the node in the inspector in the split console as well"
);
const onSplitConsoleReady = hud.toolbox.once("split-console");
EventUtils.sendKey("ESCAPE", hud.toolbox.win);
await onSplitConsoleReady;
execute(hud, "inspect(document.querySelector('body'))");
await waitForSelectedElementInInspector(hud.toolbox, "body");
ok(true, "the inspected element is selected in the inspector");
}
async function testInspectingFunction(hud) {