Showing posts with label xpcom. Show all posts
Showing posts with label xpcom. Show all posts

Friday, July 17, 2009

Bundling multiple versions of binary XPCOM components

I happened to come up with what I think is a clever hack for getting around a sticky compatibility problem in Firefox extensions.

The problem is that if your extension includes a binary XPCOM component that uses unfrozen interfaces (and it is hard not to, lots of things are unfrozen), then it is highly likely that you will have to recompile your component for each new version of the Gecko SDK (and therefore most new major versions of Fierfox).

The Mozilla wiki proposed the idea of using a "stub component" to sniff the environment version and load the right XPCOM component, but this is pretty complex to implement.

I realized that you can just use JavaScript to do the same, and it is trivial. Hope this helps someone else out (I've also updated the wiki).