dcsimg
Linux Today: Linux News On Internet Time.





More on LinuxToday


How many hacks does it take to make your extension install without a restart?

Sep 14, 2010, 22:36 (0 Talkback[s])
(Other stories by Wladimir Palant)

WEBINAR:
On-Demand

Re-Imagining Linux Platforms to Meet the Needs of Cloud Service Providers


[ Thanks to SilverWave for this link. ]

"Dave Townsend did some really great work on the add-on manager recently, he managed to completely rewrite the old crappy backend code and replace it with something far more sane. Along the way a new feature was added: starting with Firefox 4 some add-ons should be able to opt-in and install/uninstall without requiring a browser restart. This feature was primarily meant for JetPack-built extensions but is generally open to all other extensions as well. I tried enabling this feature for Adblock Plus and found that there is an awful number of catches attached to it. I wrote these down, might save somebody else's time:

* Catch 1: No XPCOM components. What you get is a single JavaScript file (bootstrap.js) that will run when your extension needs to initialize itself or shut itself down. Solution: move all global code you might have into JavaScript modules, load these modules from the bootstrap script and register XPCOM components dynamically. Do Components.manager.QueryInterface(Ci.nsIComponentRegistrar) and call registerFactory() the required number of times."

Complete Story

Related Stories: