Command-line SpiderMonkey

UPDATE: the patch has landed, and nightly builds now get put posted here beside the Firefox nightly builds.

One of the tools I use on a daily basis is the SpiderMonkey JavaScript Shell.  "But Dave," you say, "I also use SpiderMonkey every Firefox!"  Right, but I'm talking about the command-line shell.  It is invaluable to my work as a browser and web developer; so much so that I want to get you using it, too.  And!  I've made it drop-dead easy...more on that below.

The first time I saw the shell used was many years ago on irc.  I remember asking a question about JavaScript, and Vlad pasting a response that included output with a funny "js>" prompt in it.  It blew my mind.  Here was a way for me to test things quickly without having to write a whole web page.  Since then I've always had one open in a terminal.

Another way that I use the shell is for various automated test systems we have for projects like Processing.js.  Using the shell with a Makefile, we have a fast and easy way to run the thousands of parser and unit tests we have.

So if this is such a useful tool, why aren't you using it already?  The answer is that Mozilla doesn't produce binaries.  You have to build Firefox and/or SpiderMonkey to get a working shell.  For all the Mozilla developers I talk to, that's no problem--we all have build environments setup, and build this code on a daily basis.  It's as simple as objdir/dist/bin/js.

But for the web developers I work with, this is a lot to ask.  Most of them think I'm crazy when I tell them to build C/C++ code in order to get this shell.  Sure, there are other JS Shells you can use.  But I don't want to use Java, and ideally I want to have the same JS engine on the command-line that I'll use in the browser.  Better still, I'd like to have access to the latest and greatest fixes and new features being added to the JS engine shipping in Firefox.

To solve this, I filed a bug and wrote a patch to package the js shell binaries we build when we create nightly builds, and have this get uploaded where people can easily download them.  Ted just landed it in the build-system branch, while will find its way into mozilla-central, tracemonkey, etc when there is a merge.

In the meantime, I have try server builds you can get here.  I'd encourage you to read the excellent docs for the shell, which has many features not available from within the browser, and useful for automated testing, loading external programs, etc.

Python devs know how valuable it is to have an interactive shell at the ready, and now JavaScript devs can do the same.