Closed Bug 1274303 Opened 4 years ago Closed 3 years ago

GCLI 'inspect' command doesn't work anymore

Categories

(DevTools Graveyard :: Graphic Commandline and Toolbar, defect, P1)

defect

Tracking

(firefox49 affected, firefox50 verified)

VERIFIED FIXED
Firefox 50
Tracking Status
firefox49 --- affected
firefox50 --- verified

People

(Reporter: pbro, Assigned: tromey)

References

Details

(Whiteboard: [reserve-html])

Attachments

(1 file)

STR:

- open a new tab with url:
  data:text/html,<div class="foo"><div class="bar">
- open gcli (shift+F2)
- type the following command:
  inspect .foo
- hit ENTER

Nothing happens, the toolbox doesn't open and the node isn't selected in the inspector.

The following gcli output is displayed: 
Missing or invalid toolbox passed to getHighlighterUtils

And in the browser console (ctrl+shift+J), the following message appears:

Object { isTypedData: true, data: Object, type: "error" } cli.js:2056

Switching the window to non e10s gives a better stack trace in the browser console:

Error: Missing or invalid toolbox passed to getHighlighterUtils
Stack trace:
exports.getHighlighterUtils@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/framework/toolbox-highlighter-utils.js:35:11
Toolbox@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/framework/toolbox.js:134:27
DevTools.prototype.showToolbox@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/framework/devtools.js:418:17
exports.items<.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/inspector/inspector-commands.js:27:12
Requisition.prototype.exec/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2085:16
createAsyncFunction/asyncFunction@resource://gre/modules/Task.jsm:243:18
Task_spawn@resource://gre/modules/Task.jsm:168:12
exports.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/util/host.js:64:10
Requisition.prototype.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2084:14
Requisition.prototype.updateExec/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2124:12
promise callback*Requisition.prototype.updateExec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2123:10
promise callback*GcliActor<.execute<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/gcli.js:116:12
generateRequestHandlers/</handler@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1046:19
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1643:15
LocalDebuggerTransport.prototype.send/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:569:11
exports.makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
DevToolsUtils.executeSoon*executeSoon@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/DevToolsUtils.js:33:11
LocalDebuggerTransport.prototype.send@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:562:7
Front<.send/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1207:9
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:937:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:816:7
Promise*this.PromiseWalker.scheduleWalkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:747:11
this.PromiseWalker.schedulePromise@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:779:7
Promise.prototype.then@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:454:5
Front<.send@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1205:7
Front<.request@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1225:5
generateRequestMethods/</frontProto[name]@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1382:14
addLocalFunctions/</commandSpec.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/system.js:347:16
Requisition.prototype.exec/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2085:16
createAsyncFunction/asyncFunction@resource://gre/modules/Task.jsm:243:18
Task_spawn@resource://gre/modules/Task.jsm:168:12
exports.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/util/host.js:64:10
Requisition.prototype.exec@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/cli.js:2084:14
Inputter.prototype._handleReturn@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/mozui/inputter.js:560:12
Inputter.prototype.handleKeyUp@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/mozui/inputter.js:459:12
Inputter.prototype.onKeyUp@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/mozui/inputter.js:431:3
EventListener.handleEvent*Inputter@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/gcli/source/lib/gcli/mozui/inputter.js:54:3
promise callback*DeveloperToolbar.prototype.show/this._showPromise</</<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/shared/developer-toolbar.js:456:16
promise callback*DeveloperToolbar.prototype.show/this._showPromise</<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/client/shared/developer-toolbar.js:450:14
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:937:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:816:7
The inspect command lives at devtools\client\inspector\inspector-commands.js
It is set to run at the server, but it tries to open a toolbox, which is a client-only thing.
So first thing to do is change runAt: "server" to runAt: "client".

Once done, the type for the "selector" param is set to "node" which, in gcli, has a special meaning. node translates string css selectors into DOM nodes. But it only works if the command runs on the server which it doesn't.

So I would suggest changing the "node" type to a simple "string", and instead, do the conversion to a "NodeFront" on the client, using the WalkerFront.
Duplicate of this bug: 1274233
Stumbled across this while trying to do some refactoring for de-chrome-ification.
Assignee: nobody → ttromey
Blocks: 1281931
Status: NEW → ASSIGNED
Whiteboard: [devtools-html] [triage]
I fixed this pretty much following the plan in comment #1.
This does change the behavior of the command a bit.
In particular it doesn't immediately display whether the selector matches
while the user is typing.  You can see the fallout in the test case change.
Comment on attachment 8775571 [details]
Bug 1274303 - fix gcli "inspect" command;

https://reviewboard.mozilla.org/r/67740/#review64800

::: devtools/client/inspector/test/browser_inspector_gcli-inspect-command.js:40
(Diff revision 1)
>        {
>          setup: "inspect h1",
>          check: {
>            input:  "inspect h1",
>            hints:            "",
> -          markup: "VVVVVVVVII",
> +          markup: "VVVVVVVVVV",

So having done s/node/string, I think these tests are not valuable, and we should probably delete `inspect h1`, `inspect span` and inspect `.someclas`.
Attachment #8775571 - Flags: review?(jwalker) → review+
Comment on attachment 8775571 [details]
Bug 1274303 - fix gcli "inspect" command;

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67740/diff/1-2/
Iteration: --- → 50.4 - Aug 1
Flags: qe-verify+
Priority: P2 → P1
QA Contact: alexandra.lucinet
Whiteboard: [devtools-html] [triage] → [reserve-html]
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6284dacc7718
fix gcli "inspect" command; r=jwalker
https://hg.mozilla.org/mozilla-central/rev/6284dacc7718
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 50
Reproduced the "Missing or invalid toolbox passed to getHighlighterUtils" error on Nightly 50.0a1 2016-07-31.

On Nightly 51.0a1 and Aurora 50.0a2 from 2016-08-02, the Inspector is displayed the first time "inspect 
.foo" is typed. After closing it and trying to open it on the same tab, "TypeError: toolbox.getCurrentPanel(...) is undefined" output is shown. Filled bug 1291675 for this.

Marking version 50 as verified based on this.
QA Whiteboard: [qe-dthtml]
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.