Firebug 1.12 alpha 6 introduces one new feature called simply: Use in Command Line
This feature allows referring various page objects (HTML elements, JS objects, network requests, cookies, etc.) from within Firebug Command Line.
The user can also use object's properties in JS expressions.
See issue 6422 for more details.
This post explains the feature in detail and also asks for feedback.
How it works
As depicted on the previous screenshot the feature is represented by a new context menu item called Use in Command Line. This item is available for various objects (in various panels).
The action is simple: an expression
$p is inserted into the Command Line if you execute the command. It's a variable that refers to the clicked object. You can also use the variable to access any property of the object.
What happens on the screenshot:
- The DOM panel shows an object
personimplemented on the page.
- The user clicks on the person's value (the green right hand part) and executes Use in Command Line.
- Command Line popup is opened within the DOM panel (so, the user doesn't have to leave the DOM panel).
$pexpression is inserted into the Command Line (and the command line automatically gets focus).
- The user presses the Enter key to evaluate the expression.
Note that the
person object implemented on the page looks as follows:
If you want to access properties of an object just use dot notation. You can do following in our example.
See, even the auto-completion works as expected!
The feature is implemented for various objects across all Firebug panels. Here is a list of those objects.
- Any JS object (even functions etc.)
- HTML elements
- CSS rules and properties
- Network requests
Call for Feedback
All objects accessible through the
$p variable are coming from the page content except of network requests and cookies.
We are actually logging
nsIHttpChannel for network requests and
nsICookie for cookies. So, the object comes from chrome (privileged scope) and isn't accessible in the page content. This way, the user has more info, but it could be confusing since the user could expect that the data are actually accessible from the page content (and Firebug is for page content debugging).
- Do not implement the feature for network requests and cookies
- Implement the feature only for XHRs (and show the real
XMLHttpRequestinstance) and cookie (coming from
- Keep it as it is
- Anything else?
What do you think?
Also, would you like to refer more objects at the same time? Something like having more variables (a history) available:
How would you expect it to be working?
Thanks for any feedback!