Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Thinking in commands, developer tools command line

80 views
Skip to first unread message

Kevin Dangoor

unread,
Dec 12, 2011, 3:18:22 PM12/12/11
to dev-apps-firefox
Joe Walker has been building a great "modern command line" for developer
tools. You can see it right now in Nightly by setting devtools.gcli.enable
to true in about:config.

When you do so, you'll see the Web Console's JavaScript command line change
to a tool-oriented command line (which means: designed to be very quick to
type). You can still run JavaScript by hitting { (curly brace)

This has the potential to be an amazing feature... but it needs commands. I
started a wiki page:

https://wiki.mozilla.org/DevTools/ThinkingInCommands

I'm interested in hearing people's thoughts about the command line feature
and the kinds of commands they'd like to see. Bugs with patches for
commands would be cool, too :)

Kevin

--
Kevin Dangoor

work: http://mozilla.com/
email: kdan...@mozilla.com <k...@blazingthings.com>
blog: http://www.BlueSkyOnMars.com

Barry van Oudtshoorn

unread,
Dec 12, 2011, 7:35:04 PM12/12/11
to dev-apps...@lists.mozilla.org
A quick brain-dump of the commands I'd find particularly useful:

* resize width, height, viewport?
- Resize the browser window or viewport.
* cache on/off (for current page)
* reload (css)
- Purge all CSS resources, and reload them.
* screenshot (window|viewport)
- Grab a screenshot of the browser window (perhaps viewport as default)
* cookie foo/blah = blah
- Set cookie at foo/blah to blah
* cookie blah
- Retrieve value of cookie blah
* cookie blah !
- Erase cookie blah
* inject http://foo.com/bar.js (element)
- Inject resource into the page -- handle JS and CSS appropriately. If
element specified, use that, otherwise put scripts at bottom of <body>,
and CSS at bottom of <head>.
* plugins on/off
- Enable or disable plugins (Flash, silverlight, etc.) for current page
* break foo.js#324
- Add a breakpoint in foo.js at line 324.

I'll probably think of more during the day. I've not expressed them as
commands per se -- the list is meant to indicate desired functionality
more than desired syntax.

- Barry

On 13/12/11 04:18, Kevin Dangoor wrote:
> Joe Walker has been building a great "modern command line" for developer
> tools. You can see it right now in Nightly by setting devtools.gcli.enable
> to true in about:config.
>
> When you do so, you'll see the Web Console's JavaScript command line change
> to a tool-oriented command line (which means: designed to be very quick to
> type). You can still run JavaScript by hitting { (curly brace)
>
> This has the potential to be an amazing feature... but it needs commands. I
> started a wiki page:
>
> https://wiki.mozilla.org/DevTools/ThinkingInCommands
>
> I'm interested in hearing people's thoughts about the command line feature
> and the kinds of commands they'd like to see. Bugs with patches for
> commands would be cool, too :)
>
> Kevin
>


--
Barry van Oudtshoorn
www.barryvan.com.au

Not sent from my Apple πPhone.

Joe Walker

unread,
Dec 13, 2011, 5:28:47 AM12/13/11
to dev-apps...@lists.mozilla.org

Thanks for the brain dump.
I totally agree on this list and we've got bugs for some of them already:
* screenshot: bug 709460
* cookie: bug 683511
* debugger: bug 683503
* resource injection: bug 709223

I've also raised:
* resize: bug 710153
* cache: bug 710157
* plugin: bug 710159

I'd quite like a command to rebuild firefox and when done, relaunch,
leaving me back at a command prompt.

Joe.

Gervase Markham

unread,
Dec 13, 2011, 7:40:03 AM12/13/11
to
On 12/12/11 20:18, Kevin Dangoor wrote:
> https://wiki.mozilla.org/DevTools/ThinkingInCommands

The most important thing IMO is that addons should be able to add new
commands or sets of commands easily. One would then hope that good
commands would naturally be created, and assembled into sets, which
would acquire reputations, and so on.

Gerv

Joe Walker

unread,
Dec 13, 2011, 8:07:41 AM12/13/11
to dev-apps...@lists.mozilla.org
Command creation is well documented:
https://github.com/mozilla/gcli/blob/master/docs/writing-commands.md

It would be nice to have ~/.commands/foo.js become automatically
available etc. However there's code to be written, and security reviews
to be passed before we've got that.

Joe.

Cedric Vivier

unread,
Dec 13, 2011, 8:44:23 AM12/13/11
to Joe Walker, dev-apps...@lists.mozilla.org
Perhaps we could help/promote the creation of new/custom/user-specific
commands with some kind of Scratchpad integration?

eg.
createCommand foo => launch a scratchpad window with the necessary
boilerplate code to create a command 'foo'.



On Tue, Dec 13, 2011 at 21:07, Joe Walker <jwa...@mozilla.com> wrote:
> On 13/12/2011 12:40, Gervase Markham wrote:
>>
> Command creation is well documented:
> https://github.com/mozilla/gcli/blob/master/docs/writing-commands.md
>
> It would be nice to have ~/.commands/foo.js become automatically available
> etc. However there's code to be written, and security reviews to be passed
> before we've got that.
>
> Joe.
>
>
> _______________________________________________
> dev-apps-firefox mailing list
> dev-apps...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-apps-firefox

Panos Astithas

unread,
Dec 13, 2011, 8:54:07 AM12/13/11
to Cedric Vivier, Joe Walker, dev-apps...@lists.mozilla.org
+1

This could be an alias to the scratchpad command (bug 683513) that adds a
specific parameter.

On Tue, Dec 13, 2011 at 3:44 PM, Cedric Vivier <ced...@neonux.com> wrote:

> Perhaps we could help/promote the creation of new/custom/user-specific
> commands with some kind of Scratchpad integration?
>
> eg.
> createCommand foo => launch a scratchpad window with the necessary
> boilerplate code to create a command 'foo'.
>
>
>
> On Tue, Dec 13, 2011 at 21:07, Joe Walker <jwa...@mozilla.com> wrote:
> > On 13/12/2011 12:40, Gervase Markham wrote:
> >>

Rob Campbell

unread,
Dec 13, 2011, 12:04:39 PM12/13/11
to dev-apps-firefox, Cedric Vivier, Joe Walker
That'd be cool. We could even have a custom userGCLI.js stashed in the profile that gets loaded when you first start the command line.

On 2011-12-13, at 09:44, Cedric Vivier wrote:

> Perhaps we could help/promote the creation of new/custom/user-specific
> commands with some kind of Scratchpad integration?
>
> eg.
> createCommand foo => launch a scratchpad window with the necessary
> boilerplate code to create a command 'foo'.
>
>
>
> On Tue, Dec 13, 2011 at 21:07, Joe Walker <jwa...@mozilla.com> wrote:
>> On 13/12/2011 12:40, Gervase Markham wrote:
>>>

Joe Walker

unread,
Dec 13, 2011, 12:16:35 PM12/13/11
to dev-apps...@lists.mozilla.org

Nice idea.
I added a comment to the bug.
https://bugzilla.mozilla.org/show_bug.cgi?id=683513#c11

Joe.


On 13/12/2011 13:54, Panos Astithas wrote:
> +1
>
> This could be an alias to the scratchpad command (bug 683513) that
> adds a specific parameter.
>
> On Tue, Dec 13, 2011 at 3:44 PM, Cedric Vivier <ced...@neonux.com
> <mailto:ced...@neonux.com>> wrote:
>
> Perhaps we could help/promote the creation of new/custom/user-specific
> commands with some kind of Scratchpad integration?
>
> eg.
> createCommand foo => launch a scratchpad window with the necessary
> boilerplate code to create a command 'foo'.
>
>
>
> On Tue, Dec 13, 2011 at 21:07, Joe Walker <jwa...@mozilla.com
> <mailto:jwa...@mozilla.com>> wrote:
> > On 13/12/2011 12:40, Gervase Markham wrote:
> >>
> > Command creation is well documented:
> > https://github.com/mozilla/gcli/blob/master/docs/writing-commands.md
> >
> > It would be nice to have ~/.commands/foo.js become automatically
> available
> > etc. However there's code to be written, and security reviews to
> be passed
> > before we've got that.
> >
> > Joe.
> >
> >
> > _______________________________________________
> > dev-apps-firefox mailing list
> > dev-apps...@lists.mozilla.org
> <mailto:dev-apps...@lists.mozilla.org>
> > https://lists.mozilla.org/listinfo/dev-apps-firefox
> _______________________________________________
> dev-apps-firefox mailing list
> dev-apps...@lists.mozilla.org
> <mailto:dev-apps...@lists.mozilla.org>
> https://lists.mozilla.org/listinfo/dev-apps-firefox
>
>

Gervase Markham

unread,
Dec 14, 2011, 4:43:13 AM12/14/11
to Rob Campbell, Cedric Vivier, Joe Walker
On 13/12/11 17:04, Rob Campbell wrote:
> That'd be cool. We could even have a custom userGCLI.js stashed in the profile that gets loaded when you first start the command line.

Can we please think of a more snappy name than "GCLI"? :-)

Gerv

Panos Astithas

unread,
Dec 14, 2011, 5:00:06 AM12/14/11
to Gervase Markham, Cedric Vivier, Joe Walker, dev-apps...@lists.mozilla.org
Some of us prefer to call it "geekly", does that help? :-)

Panos

Joe Walker

unread,
Dec 14, 2011, 5:11:29 AM12/14/11
to dev-apps...@lists.mozilla.org
To most people it doesn't have a name - it's just the place where you
type things in the Web Console.

Also we suck a naming, and by suck at naming, I mean that we keep on
deciding that the current name is bad, so we bikeshed until we have a
different name, which sticks until someone next says we need a new name. :(

Joe.

Barry van Oudtshoorn

unread,
Dec 14, 2011, 5:17:08 AM12/14/11
to dev-apps...@lists.mozilla.org
> _______________________________________________
> dev-apps-firefox mailing list
> dev-apps...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-apps-firefox
>

Out of curiosity, what is the intended scope of the (for lack of a better
term as yet) GCLI? I assume that it's primary focus will be development,
but is it intended to also allow access to basic Firefox functionality? To
my mind, there's some crossover between the two. For example, when a tab is
pinned as an app tab, my understanding is that it may have elevated
privileges (such as more storage space). As a developer, then, I'll want to
be able to easily toggle the pinned state of an app tab. Other places where
this overlap occurs are:

* Full-screen mode
* Whether or not DNT is enabled
* Whether or not JS, cookies, CSS, etc. are enabled
* The character encoding of the document

Other useful commands that I've thought of include:
* Emulation of network connectivity issues and absence
* Execution of bookmarklets (general access to bookmarks)
* Execution of arbitrary JS files (i.e. load them in Scratchpad and run
them immediately)
* Addon enabling/disabling/reloading (perhaps especially useful when
developing Jetpack addons)

I'll no doubt come up with more over time. :)

Barry van Oudtshoorn
http://barryvan.com.au/
bvanoud...@gmail.com

Joe Walker

unread,
Dec 14, 2011, 5:54:53 AM12/14/11
to dev-apps...@lists.mozilla.org
On 14/12/2011 10:17, Barry van Oudtshoorn wrote:
> Out of curiosity, what is the intended scope of the (for lack of a better
> term as yet) GCLI? I assume that it's primary focus will be development,
> but is it intended to also allow access to basic Firefox functionality? To
> my mind, there's some crossover between the two. For example, when a tab is
> pinned as an app tab, my understanding is that it may have elevated
> privileges (such as more storage space). As a developer, then, I'll want to
> be able to easily toggle the pinned state of an app tab. Other places where
> this overlap occurs are:
>
> * Full-screen mode
> * Whether or not DNT is enabled
> * Whether or not JS, cookies, CSS, etc. are enabled
> * The character encoding of the document
>
> Other useful commands that I've thought of include:
> * Emulation of network connectivity issues and absence
> * Execution of bookmarklets (general access to bookmarks)
> * Execution of arbitrary JS files (i.e. load them in Scratchpad and run
> them immediately)
> * Addon enabling/disabling/reloading (perhaps especially useful when
> developing Jetpack addons)
>
> I'll no doubt come up with more over time. :)

This is a developer tool.

GCLI commands run with chrome privileges. So we need to be as careful
with new commands as we would be with any new code - they go through
security review.
The command line may contain a section bounded by {}, which is plain
JavaScript, which executes with content privileges.

Hence:
» screenshot ~/demo.png
Should work once we've written the command

» { window.Components.utils.import('blah'); }
Exception: Permission denied for to get property XPCComponents.utils

» inspect { document.getElementById('foo') }
We've not written this yet, and we'll need to be careful about not
letting content JS execute with chrome privs, but in principle...

Of course there is a better way of doing the above
» inspect #foo

Joe.

Dao

unread,
Dec 14, 2011, 8:25:15 AM12/14/11
to
On 14.12.2011 11:54, Joe Walker wrote:
> GCLI commands run with chrome privileges. So we need to be as careful
> with new commands as we would be with any new code - they go through
> security review.

s/security/peer/

Joe Walker

unread,
Dec 14, 2011, 9:55:33 AM12/14/11
to dev-apps...@lists.mozilla.org
All our code goes through peer review. In addition we ask for security
review.

See:
https://bugzilla.mozilla.org/show_bug.cgi?id=664696
https://github.com/mozilla/gcli/blob/master/docs/review/security-review-2011.md

Joe.

Dao

unread,
Dec 14, 2011, 11:07:34 AM12/14/11
to
On 14.12.2011 15:55, Joe Walker wrote:
> On 14/12/2011 13:25, Dao wrote:
>> On 14.12.2011 11:54, Joe Walker wrote:
>>> GCLI commands run with chrome privileges. So we need to be as careful
>>> with new commands as we would be with any new code - they go through
>>> security review.
>>
>> s/security/peer/
>
> All our code goes through peer review. In addition we ask for security
> review.

Why? You said "we need to be as careful with new commands as we would be
with any new code", but obviously we don't security-review all new code.

Joe Walker

unread,
Dec 14, 2011, 1:39:12 PM12/14/11
to dev-apps...@lists.mozilla.org
New features need security review, so I guess I'm saying that we look at
new commands as new features.

Joe.

rfo...@gmail.com

unread,
Dec 14, 2011, 5:11:13 PM12/14/11
to dev-apps...@lists.mozilla.org
Cool and exciting stuff!!

How one get's access to the `gcli` object or to a `canon` ? I'd be interested in implementing an SDK API for adding new commands.

Joe Walker

unread,
Dec 14, 2011, 6:20:05 PM12/14/11
to dev-apps...@lists.mozilla.org
On 14/12/2011 22:11, rfo...@gmail.com wrote:
> Cool and exciting stuff!!
>
> How one get's access to the `gcli` object or to a `canon` ? I'd be interested in implementing an SDK API for adding new commands.

An example:
https://hg.mozilla.org/mozilla-central/file/tip/browser/devtools/webconsole/GcliCommands.jsm

Further documentation:
https://github.com/mozilla/gcli/blob/master/docs/writing-commands.md

Joe.

0 new messages