isn't quite ashamed enough to present

jr conlin's ink stained banana

2008-08-25

::Mucking with Mozilla: Part 1

One of the reasons you've not heard much from me lately is because i've joined a monastery and devoted my attention to transcribing the Manhattan Yellow Pages into pages of hand written Urdu been spelunking into Firefox 3 in order to build out an extension.

The extension is, by and large, fairly simple. i can't really say the same thing about the Firefox docs, however.

i've been taking notes and have been thinking about releasing a "how-to" guide for building these things. Kind of a step above building a "hello world" type plug-in where you start doing more useful things.

The problem is, however, that engineers generally don't have time to write documentation. This is important to note because one of the things that's been most frustrating lately is the fact that once you try to dig into something, you inevitably fall down one or more rabbit holes of "nearly working solutions" that give "almost enough" info for you to work with. And then you discover that things recently changed and now it's much easier to do things.

Let's take debugging for instance:

The classic way one goes about dumping stuff to the Javascript Console according to the docs is to call dump(). That works, for the most part, except when it doesn't. There can be any number of reasons why (such as you're running inside of a protected chrome window and the local "window" object hasn't been created yet, or you've not enabled browser.dom.window.dump.enabled=true, etc., etc. and sadly, etc.). One of the outcomes is that the console buggers itself and stops showing any output at all. Digging around in the docs shows a slightly more direct way of getting to the javascript console by calling:
var console = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
console.logStringMessage(msg);

which does a damn reliable job of getting your string to the javascript console.

Well, unless you're running Firefox 3, in which case, you could call
Application.console.log(msg);

You probably don't know about that because it's part of FUEL, the brand, spakin' new library that makes writing extensions super easy. Granted, you probably have no idea that FUEL exists because it's not mentioned on the Mozilla Developer Home Page, although there are a veritable termite's nest of holes one can fall into right there.

The absolute One Thing i've found out is that the only way to really get how this stuff falls together is to crack open the browser.jar file in your Mozilla App/chrome directory and get spelunkin'. (A jar is just a renamed .zip file.)

So, what i'm going to do is keep notes here. i'll be posting up various things i've discovered while building out my plug-in and you can benefit from it. Consider this Mozilla 201, Slightly more advanced, but no where near doctorate level.

(Plus this'll give me a topic to ramble about.)

Hey, delicious user, Save This Page
Blogs of note
personal that's my blog
(The Official Blog of the Internet)
memoirs of hydrogen guy matthew shepherd (quebec) rhapsodic.org j$ (right) Henriette's Herbal Blog fanatical apathy lynne ydw i iconophobia slumbering lungfish
geek Y!Cool Thing michael j radwin jeremy z
(The Official Website of the Internet)
dave's picks ultramookie Josh Woodward derek balling j$ (left) simon willison Yahoo! Search Blog
news ars technica search engine watch webmaster world.com
forums uh.net man-man killroy & tina

experimental

Firefox search plugins for Yahoo!

My Living Room media box config

The Official "Official" Registry of the Internet

Powered by WordPress
Hosted on Dreamhost.
And Steveo's page is Totally Fucking Awsome.