Alternative to the Indignity of Dealing with the Error Console

The JavaScript error console is a relic from the Mozilla stone age. There are two problems with it:

  1. It lives in a separate window
  2. It is not helpful

I’ve been drooling over the new Firefox Web Console, but unfortunately it doesn’t have chrome privs [yet?] so it isn’t a replacement for the error console since it operates with privileges of the webpage displayed. Turns out I was 2 steps away from nirvana:

  1. Navigate to chrome://global/content/console.xul.
  2. Menu -> “Web Developer” -> “Web Console”

Turns out that one can load a url with chrome privs (about:memory works too) and the web console becomes a very helpful [with autocompletion, less noise, etc) tool for typing Components.interfaces…

Update:

Scratchpad can also do this sans autocompletion, see Rob’s comment below.

4 comments

  1. You can also switch scratchpad to browser mode, but I agree that the autocomplete provided by the Firefox Web Console is incredibly useful. Great hack!

  2. In the past, I had used the extension developer extension’s javascript shell. Simply invaluable because it allows you do exactly this. It lives in a separate window, but it did its job so well.

    I think at one point it was broken and stopped working. Not sure what the current status is.

  3. Jeff suggests using the Scratchpad and this is probably the best solution for what you’re trying to do, sans autocomplete.

    From my blog:

    If you’re an extension or browser developer, you’ll want to open about:config and change devtools.chrome.enabled to true. This adds a ChromeBrowser item to the ContextEnvironment menu for Scratchpad. As the menu might suggest, it changes your default JavaScript context to be the browser’s chrome space.

    We’re planning on building a chrome version of the Web Console as a replacement for the Error Console but that work’s lower priority than what we’ve got now. In the meantime, you have your chrome hack and the Scratchpad to get you by. :)

  4. I use robcee’s Sctratchpad and the Extension Developer’s JS Shell that Cesar mentioned and can’t live without it. https://addons.mozilla.org/en-US/firefox/addon/extension-developer/

    Also, extending your hack, if you need access to the main browser window’s variables from the web console, take a look at this Frank’s post: http://frankyan.wordpress.com/2011/07/19/hacking-firefox-ui-from-web-console/