Creating custom add-on types just got easier

One of the nice features that we added to the add-ons manager in Firefox 4 was supportĀ  for custom add-on types that could be treated the same way as the built-in types, even showing up in the same UI if you did a little work. I blogged a basic example of how to do this and I know since then Greasemonkey and Stylish have been using the support.

A few days ago (and now in Aurora builds) I landed some improvements that simplify the hardest part of this, making the UI appear.

Registering a custom type

Previously in order to add a new type of add-on and have it appear in the add-ons manager you would have to do two things, first tell the add-ons manager module that you supported add-ons and secondly manually create some elements in the UI to allow the user to view them. These two things have now been combined:

AddonManagerPrivate.registerProvider(myProvider, [{
  id: "scripts",
  name: "User Scripts",
  uiPriority: 3500,
  viewType: AddonManager.VIEW_TYPE_LIST

This registers the provider as before but also tells the module that your provider supports an AddonType with the ID “scripts” and some other information. The documentation explains a little more about the properties. You’ll note it passes an array to allow for providers registering multiple types.

Currently you only need to do this if you want your add-on types to show up in the UI, however we may start requiring providers to register their types to help speed up some of the API calls. If you want to register your type and not have the UI automatically show it just don’t give it a viewType.

Breaking changes

Some of the changes we had to make may have broken some add-ons that have been doing this the hard way in the past. Here are the once I’ve identified and some ways to work around the problems:

Types must be registered

The UI now requires that if you’re displaying your add-ons in the regular list view then it must have been registered. If you only care about supporting Firefox 6 and higher then you can just remove your code for adding your type to the category list, if you want to support both then you should either only do that on versions before Firefox 6, or you could always manually add your type to the UI but also register your type with no viewType.

Some IDs changed in the UI

We made some changes to the IDs of elements in the add-ons manager UI, we dropped the “s” on the end of the type selectors. category-extensions became category-extension as an example.

Category items aren’t in the UI immediately

Because we now build the list of types to display in the UI (even the built-in types use the same type registration I’ve talked about here), the elements for those types aren’t in the UI until after the main initialize function for the window has completed. If you try to use overlays that refer to those elements or if you run script that tries to find these elements before the initialize function completes (it is a load event listener) then they won’t exist and you’ll probably find things broken.


How to disable extension compatibility checking on Nightly builds of Firefox

A long long time ago (I can still remember…) we changed the preference you use to disable compatibility checking for extensions. We still aim for users to instead use tools like the Add-on Compatibility Reporter to handle this (especially since we are going to start crowdsourcing data from it), but for developers who don’t want to install that but still want to use extensions on their nightly builds the new rapid release model would mean setting a new preference every 6 weeks.

We’ve now changed this and any nightly, try, or self-made builds (anything not on the aurora, beta or release channels) will instead use the single preference extensions.checkCompatibility.nightly from now on, regardless of version. This will be available from tonight’s nightly onwards.

Do I need a new camera?

It’s been about a year since I last went through this. The result of my last plea for help was a number of recommendations and I ended up buying the excellent Canon Powershot S90. It really is a great point and shoot and I think pretty much exactly what I needed at the time to help me learn a little more about photography. I always figured it would be good test to be able to play with and figure out whether I eventually needed to move onto something more. I guess the main thing that disappoints me a little about the S90 is its slow speed, it can only take about a shot a second in RAW. I often could do with something faster. Also while its low-light performance is better than anything I’ve ever used before it still isn’t as good as I’d like. I could certainly do with a longer optical zoom but that’d have to be combined with something that used faster shutter speeds I guess.

So I’m starting to get a little itch again, fueled by people talking about cameras across twitter all this morning and planning a honeymoon visiting an active volcano in Hawaii. So I’m starting to wonder if its time to look for something more, but I confess I don’t know whether a DSLR is really for me yet. I don’t know enough about lenses to really know what I’d be looking at right now and I’m pretty concerned that I’d just never actually carry a DSLR around enough to make it worthwhile. Micro 4:3 seems like a smaller yet still more powerful option but again I don’t really know what I’m looking at. What actually are the benefits of these over my point and shoot?

So I am asking my good friends of the internet to once again help me out. Should I look for something new or stick with what I have for now? Are there any good books that it might be worth reading to learn more about photography or is a learn-by-doing approach as I’ve been using for now the best way?