Thursday, November 26, 2009

Firefox Addon and XPCOM

So last week in DPS909 we were supposed to feel our way through a lab giving some idea how Mozilla's XPCOM works. XPCOM is used to ensure code portability. I do not pretend to understand how it all works, it's rather complicated and terrifying for a newbie, but at the very least I can follow instructions.

The big first step is to create an XPCOM interface using a XPIDL file, which includes function prototypes using familiar C/C++ data types (at least in the walkthrough, XPCOM may be used with other languages to). A header file is automatically generated which, amongst other things, transforms the data types into Mozilla's data types and creates a stub class using the header. In other words, a lot of the basic set up work is done for the code cruncher (winner!)

Most of the walkthrough was pretty straight forward. There were a few minor things that needed to be changed or were different. In install.rdf, I changed em:minVersion and em:maxVersion to 3.5.5 and 3.7a1pre respectively (that allowed the extension to work in the trunk build.) Also, IFirstXpcom,h was created in $(objdir)/dist/include/ rather than $(objdir)/dist/include/firstxpcom/.

But everything worked out and so I can now claim to have created (after near slavishly following somebody else's instructions) an add-on for Firefox.


No comments:

Post a Comment