Archives For 2009/01/31

>I basically re-implemented Javascript Shell for my own fun and excitement. I re-used the History functions and the enumerateWindows functions from Javascript Shell 1.4 and the Extension Developer’s Extension.

I could not think of another name, so MozShell it is. Of course, I should have done a little bit more research before posting it to Google Code: http://code.google.com/p/moz-shell/

I have spent a bit of my spare time coding this up, and it is not an easy problem to solve, so pitch in and help – or, at least report bugs and ideas:)

>I am having a wild time trying to follow the voluminous amount of code involved in the Places component of Firefox. I finally remembered to install the Extension Developer’s extension, which would not install by default as it has no “secure update method” (or some such complaint by Add-ons). Anyway, I added a couple of configuration option to about:config…

note: Javascript Shell is included in “Extension Developer’s Extension“.

extensions.checkCompatibility (bool) = false <– because I am hacking on Trunk

extensions.checkUpdateSecurity (bool) = false <– because Ext. Devel. Ext. has no secure update?

Not sure exactly, too lazy to find out:) Coming from the Python school, I always prototype and inspect code and live objects in iPython or the Python interpreter. This is a great way to become familiar with new code even before you try to read or run the test suite – especially complex code like Firefox Places. What I wouldn’t do for a python “inspect”-like module for Javascript inside chrome. So anyway – I get all of this running and am in high spirits, but I noticed that the Javascript shell is not formatting anything that is spit out into it’s ouput div. Tab completion on objects shows you a long sinlge line of each completable item, making this basically unusable (for me). I also started playing with Xush, but, without tab completion, a lightweight stand-alone window and a few bugs on Linux (which I think have been rectified), I figured I would add some css and js tweaks to make JS shell more my style. Here is what I tweaked:

1. Made all fonts 1em and ‘monospace’ font-family. Like a shell should be:)

2. Check the output to see if it is a function, if so, display in a pre element.

3. Added “prettyprint” source code beautifier so the above-mentioned functions are easier on the eyes – not “emacs classic theme” or anything, but a step in the “iPython” direction.

4. Added ctrl-a and ctrl-e key commands to the input widget. Yay!

5. Open the shell in a 800 x 600 window

6. Added a promt like the xpcshell promt: js>

This makes jsshell just a tad bit easier to use and cleaner to boot. I like that it is so lightweight – I tried using ChromeBug too, and it is getting faster, but it can be a bit flaky.

I just think nothing can beat a very lightweight, responsive shell.

I am sure I will keep tweaking it. If you want to get a copy, I have posted my extensiondev.jar that is part of the Extension deveoper’s extension here: extensiondev.jar

postscript:

If I had bothered to look (i’m slow like that) at the google code page for Extension Developer’s Extension, ( http://code.google.com/p/extensiondev/ ) I would have seen that the formatting bug was reported and the submitted patch was a simple css fix!

Well, it was fun. I may have to join the project:)