Subscribe to RSS Feed

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 person implemented 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).
  • $p expression 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:

var person = {
    name: "Bob",
    age: 38

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!

Supported Objects

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
  • Cookies
  • 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).

Possible options:

  • Do not implement the feature for network requests and cookies
  • Implement the feature only for XHRs (and show the real XMLHttpRequest instance) and cookie (coming from document.cookie)
  • 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: $p0, $p1, $p2, ...

How would you expect it to be working?

Thanks for any feedback!

Rss Commenti

1 Comment

  1. [...] also detailed description of this [...]

    #1 Getfirebug Blog » Blog Archive » Firebug 1.12 alpha 6

Sorry, the comment form is closed at this time.