Reza M. Reza wrote:
John:

THIS IS IMPRESSIVE.   Simple but effective!!!

On that note, can you please share (for the sake of curious developers)
some starting point on how one can write add-ons for Mozilla?
Compared to other languages and platforms it's pretty easy to get started developing add-ons for Firefox, Mozilla and Thunderbird. Unlike some languages the framework needed to get started is already installed on most Linux boxes. If not it's as easy as installing Firefox. The framework is called XUL (pronounced zool, for Ghostbusters fans: "there is only one".) What's also nice about XUL (as long as you're into Open Source) is that the XUL packages (called XPI, pronounced zippies) are ZIP files containing javascript. That makes it easy to look at someone else's work to see how it's done.

The developers of Mozilla decided to split development on the browser into two main camps: the gecko rendering engine, which had to render HTML into an image for display and the so-called "chrome": the fancy stuff that surrounds the browser window, you know, it's the menu, address bar, bookmarks, configuration.. in other words the entire user interface. They decided that this chrome should be done in javascript. That means you can also look at the entire source code for Firefox's interface as an aid for learning XUL (try unzipping /usr/lib/firefox-2.0.0.10/chrome/browser..jar.)

The code is Javascript with the metadata files formated in XML so if you are familiar with working with javascript you're halfway there. I started with the documentation on developer.mozilla.org. It's not easy to navigate and the XUL references weren't to forthcoming. But this page was a huge help: http://developer.mozilla.org/en/docs/Building_an_Extension

A little hacking got some results and I expanded the process from there to add a configuration page.

I thought I'd try Thunderbird then. I had to change lots of object names and there were two spots that I wanted to be able to "click-to-dial": when reading a message and when composing a message. So that meant duplicating some effort.

I'm told that some packages can be used for both Firefox and Thunderbird. I chose not to re-engineer mine for that purpose although I may in the future as it would reduce the duplication of code.

Here are the pitfalls in developing.

1. Poor debugging support. Ever worked on a PHP script in a web browser? You have the same debugging interface in XUL. In other words: none. Expect to place a lot of "alert(...)" statements in code. When an extension simply doesn't work it's a parse error, except there's no error message or if it's a partial compile you may see a "function not defined" message, so you have to scour your code for missing semi-colons or mismatched brackets. I did spend some time looking for tools to help but didn't find any. I wasn't thorough so give it a shot yourself and let me know what you find.

2. Poor documentation on object structures for the platforms. I ended up going to the browser.jar file (mentioned above) to see what objects I needed to access.

Aside from that it wasn't too hard for a reasonably experienced programmer like myself to achieve results and add tweaks until the end product was finished enough.

--
*John Van Ostrand* *Net Direct Inc.* CTO, co-CEO 564 Weber St. N. Unit 12 map <http://maps.google.ca/maps?q=564+Weber+Street+North+Unit+12,+Waterloo,+ON+N2L+5C6,+Canada&ll=43.494599,-80.548222&spn=0.038450,0.073956&iwloc=A&hl=en> Waterloo, ON N2L 5C6 [EMAIL PROTECTED] Ph: 866-883-1172 ext.5102 *Linux Solutions / IBM Hardware* Fx: 519-883-8533

Reply via email to