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).


Unknown said...

Interesting. The alternative approach that the wiki talks about is using the IDL to build a version of the unfrozen components that you can then detect at runtime. That's what we've done with webdriver

Seems like your approach is a lot neater if there are multiple dependencies.

Anonymous said...

hello on the drag and drop code

I want to Drag the picture and duplicate the image leaving the original (so you can keep on duplicate the image click on image and drag)

email me answer please to script

I want to use the limiting rang to please

Aaron L. said...

Totally unrelated...I saw you at the NYC highline, this past saturday, Sept 5 2009. I followed a lot of your stuff when I started to do javascript seriously. I wanted to say hi but it was just so sudden. I was wearing a green checkered shirt! Hope you had a great trip

boots said...

Hello other aaron,

Yes, that was me. I was there w/ my fiance. We used to live in NYC and missed it so we came for a quick weekend visit.

You should have said hi!