Multiple breaking changes are coming for components in extensions

Posted: June 14th, 2010

Are you an extension or application developer? Have you written any XPCOM components, JS, binary or otherwise? If not you can probably ignore the rest of this post, unless you are interested anyway.

If you do then you might be interested to hear that your components are probably going to break in an upcoming Firefox nightly, maybe as early as next week. I’m going to blog specific examples on the changes you need to make once we have better documentation up and builds to test against, for now it is just important for you to know that the changes are coming.

Changing XPCOM component registration

One of the things we are doing is changing how XPCOM components are registered. Previously during registration we would load all binary and JS component files and call them asking them to register themselves. If you used XPCOMUtils.jsm then some of that ugliness will have been hidden from you. The future though will be registration using manifest files, similar to how chrome is registered (in the same files in fact). Every single JS or binary component will need fixes to support this. The amount of work to do is fairly trivial per component and it is possible to support both old and new styles of registration in the same component but until that work is done your components will not work.

Starting extension components later

Currently there are a bunch of different notifications that components can listen for to perform actions during startup. Commonly xpcom-startup, app-startup and profile-after-change have been the most common. The latter is generally the best to use since this is one of the earliest notifications that occurs after the profile folder (and hence preferences and other services) is available.

The news is that once we make our changes components from extensions will no longer be able to register for and receive the xpcom-startup or app-startup notifications at all. profile-after-change will be the first notification that components can be loaded by.

Most of the reasons for loading on app-startup were either because developers didn’t know about profile-after-change or at one point it used to be necessary to load for app-startup just to be able to register for profile-after-change in the observer service. That is no longer the case as you can register for it in the category manager exactly as you can for app-startup.

Why?

You might well ask why we are making all these changes.

Currently whenever we detect a potential change in the set of usable components (meaning either the application version has changed or an extension has been added/removed/enabled/disabled) we must throw away existing component registrations and then perform what has become known as the EM restart where the application is restarted during its startup (in theory invisibly to the user) to make sure that any component that weren’t meant to be loaded are unloaded and to re-register everything and load any new components that need it.

Registration is itself a costly process since every component must be loaded and executed when really many if not most of them do not need to be loaded during startup. In the E10S world there are even more problems. Content processes must either register all components during every startup or somehow share a component cache with the chrome process.

The new registration model allows us to do away with the EM restart. On startup rather than relying on a potentially stale component cache we will read the registrations for the main application out of a manifest file. This will give us enough of XPCOM to then be able to load the extension manager and do any necessary work to install/uninstall/update any extensions after which we can simply load the component registrations for those out of the manifest file. Startup then just proceeds as normal, no restart is necessary since nothing from extensions can have been loaded when it shouldn’t.

E10S content processes can just read the component registrations during startup, since they are in simple manifest files this will go a lot faster

Tags: , , , ,

6 Comments »

Categories: mozilla

Mossop Status Update: 2010-06-14

Posted: June 14th, 2010

Done:

  • Got a bunch of bug fixes either done or ready for review
  • Started reviews for the component registration changes

Next:

  • Fixes fixes fixes
  • Triage for beta 2
  • Work out which of the big 3 impossible things is actually going to make Firefox 4

Tags: , ,

1 Comment »

Categories: mozilla

Documenting the new Add-ons Manager

Posted: June 4th, 2010

I’ve spent some time this week transferring all the API documentation for the new add-ons manager from the Mozilla wiki to the Mozilla Developer Network. This should now be the place to go for the definitive info.

Right now it is pretty dry, for the most part just pure API info with no examples. Before I started working more on that side of things I wanted to ask what kind of examples people might like to see documented?

Tags: , , ,

3 Comments »

Categories: mozilla

Mossop Status Update: 2010-06-04

Posted: June 4th, 2010

Done:

Next:

  • Fix bugs damnit
  • Update mobile to use the new AddonRepository.jsm that Ben has been working on

Tags: , ,

1 Comment »

Categories: mozilla

Support for dropping XPI files into the extension install locations might be going away

Posted: May 27th, 2010

For some time now Firefox has supported a way of installing extensions that involves simply copying the extension’s XPI file into one of the extension install locations. The next time Firefox runs it would pop up the install dialog for the extension and allow the user to choose whether to install it or not.

I don’t know how many people use this feature and while the code to do it (at least for the profile folder) isn’t terribly complex, it is additional code that may not be necessary. Right now the new add-ons manager doesn’t support it and I’ve heard only a couple of people comment on its absence but nightly testers are by no means representational so I’m asking a little more widely whether people have a real need for keeping this working in Firefox 4?

To be clear we aren’t talking about the method of installing where you extract your extension into a directory in the install locations, nor are we talking about the method where you create a text file in the install location containing the path to your extension.

Tags: , , , ,

9 Comments »

Categories: mozilla

Mossop Status Update: 2010-05-24

Posted: May 24th, 2010

Done:

  • Triaged all the bug reports from the new add-ons manager to determine the list of blockers
  • Reviewing update tests

Next:

  • Complete the review of the update tests stuff
  • Fix a lot of the blockers in the new add-ons manager backend

Tags: , ,

No Comments »

Categories: mozilla

Where is the updated Nightly Tester Tools?

Posted: May 17th, 2010

Many of you nightly testers may have noticed that Nightly Tester Tools’ compatibility override feature doesn’t work with the new add-ons manager and may be wondering when I’m planning to issue an update to fix that. The more astute of you may have noticed that there hasn’t actually been a real code update to Nightly Tester Tools in 2 years, barring a couple of simple app compatibility fixes. Those with a sharp memory will remember that I said just under 2 years ago that I was ceasing work on my extensions in my spare time. I suggested that Nightly Tester Tools might still receive the odd update but obviously that hasn’t happened and the truth is that I can’t see it happening anytime soon. I’m too busy with that whole real life thing to even be able to work on projects I do enjoy, let alone maintain old stuff that no longer really interests me.

This unfortunately leaves a sizable number of users losing a feature that they liked and still potentially have a need for. I can only really see a couple of possible roads to follow from here:

  1. Do nothing. Users will be annoyed for a time but eventually find ways around what they needed NTT for.
  2. Find someone else to pick up and maintain NTT. I’ve had numerous requests for the source code for many of my extensions over the past two years, none have ever apparently tried to do anything though. Perhaps someone out there will pick up the torch this time?
  3. Point all the users to something else, like the Add-on Compatibility Reporter (once that is updated to work on trunk). While nothing else I know of works quite like NTT at least something is better than nothing, and ACR has the benefit of being Mozilla supported, provides Mozilla with valuable information about add-on compatibility and may be rolled into Firefox at some point.

Option 3 is the only one available that involves any work on my part but probably the choice that leads to less user annoyance, unless someone reading this wants to take up the challenge or has a better idea?

Tags: , , , , ,

6 Comments »

Categories: extensions

Mossop Status Update: 2010-05-14

Posted: May 14th, 2010

Done:

  • Relanded the new extension manager
  • Working through more bugs and issues
  • Started implementing transactions and locking for the main database

Next:

  • Fix overlays for about: urls
  • Make chrome registration possible for bootstrapped add-ons
  • Work on shipping default extensions with the app
  • Help Ben Parr, the new intern get up to speed

Tags: , ,

1 Comment »

Categories: mozilla

Add-ons manager re-landed

Posted: May 10th, 2010

A little sort of coincidental performance regression forced us to back out the new add-ons manager last week. It has now been re-landed with added bug fixes and should be in tomorrow’s nightly.

Tags: , , , , ,

2 Comments »

Categories: mozilla

Mossop Status Update: 2010-05-07

Posted: May 7th, 2010

Done:

  • Backed out the new extension manager
  • Fixed some of the bugs found during the extension manager testday
  • Found the cause of the Ts regression
  • Prepared everything to be landed again

Next:

  • Work out when we can re-land the new extension manager
  • Start churning through more of the known issues

Coordination:

Need to work with IT and RelEng to find out what the situation is with getting the Talos boxes all dongled up

Tags: , ,

No Comments »

Categories: mozilla