You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

blue sky: extension

May 11th
Submitted by Michael Bayne <> to Extension.

Scripting support for an application that is used frequently is an absolute necessity. Mozilla is an application that I use frequently. In fact, about the only things I use more frequently than Mozilla are pine and emacs. And I spend an awful lot of time wishing that pine supported better scripting. Again, I remind you that when I'm talking about scripting, I don't mean things that someone would embed in a web page, but external scripts that the user would specifically obtain and install (even though that installation might be an absurdly simple process).

The idea here is that while Mozilla does a whole bunch of stuff, it doesn't necessarily do quite what you want or do so quite the way you'd like it. Since people working on the Mozilla code base itself are few in number, they have neither the resources nor the inclination to anticipate exactly what everyone wants. Instead, they can develop an interface to a scripting language that allows low level control of just about everything useful that Mozilla can do. Then the much larger set of people who happen to know how to program but don't have the time or resources to work directly on the Mozilla code base can write scripts that do what they want and how they want it. The hope is then that with this wider set of people implementing features, a simple feature desired by a non-programmer is more likely to get done as a scripted extension than as a feature added directly to the Mozilla code base.

Let me illustrate some situations where one might make use of scripting support for those of you who don't find yourselves brimming over with ideas already.

  • Mailing list management
    This one comes our way from the coordinated contemplating efforts of and They posit that it would be real keen to be able to, with a single gesture, subscribe to a mailing list, set up filters so that all mail to that list go into the same folder, configure the mailer such that all posts to the mailing list are FCC'd to a folder devoted to that list and, since we're just that visionary, effect duplicate detection and removal of all messages arriving from that list to prevent us from receiving a message twice if someone sends it to both us and the list.

  • In place editing of HTML
    Some kind soul on mozilla-wishlist ( in fact) gave me this idea. He wanted the ability to edit directly in the "view source" window and easily upload the HTML back to the server. The idea being that composer is nice and all, but often enough you just want to make a quick modification.

    With a little scripting support, I could take this one further and fire up my favorite editor (see above) with the document source and then have Mozilla HTTP upload (or FTP upload) the source back to the web server all from a handy dandy script that I invoked from a toolbar at the top of my Mozilla window. (Yes, I know that you can approach this level of functionality with a great deal of contortion on the Mac or Windows where Communicator allows you to specify an editor for "view source," but it's way too complicated.)

The next order of business is to describe some ideas on how to accomplish all of this.

Let me start by describing my grand vision of how scriptability would be implemented in Mozilla. The engineers at Netscape are working on modularizing the code base and have taken the initiative to architect a framework for doing just that. This framework provides for the definition of interfaces to objects that comprise a running instance of the browser. Consider writing a tool that automates the generation of hook functions that allows calling of those interface functions on your scripting language's idea of objects. Bingo, everything you wanted to do and more just became possible. You would then have to establish some mechanism for addressing (getting a handle on) important objects from within a script, so there's a little work to do. Then good scripting support is simply a matter of well thought out modularization. Can you say "two birds with one stone"? I thought you could.

With the hard part out of the way, you would then want to make these scripts easily callable in Mozilla by allowing the user to bind scripts to some sort of script menu (with hot keys) or drag them right onto whichever toolbar happens to be visible while they are performing the task that they want to script. This would provide an easy mechanism for people to distribute (and for other people to install) these scripts. Imagine downloading a script into file and dragging it right onto the browser's toolbar and all of a sudden having the "edit source in place" functionality that I described above. How cool would that be?

Some links to get you started: