Add-ons and Restarts – Yuck!

There has been a lot of discussion about the future of the Mozilla add-on infrastructure. I think it’s clear now that Mozilla is not removing the classic add-on mechanism. In fact, Fabrice Desré found a nice bit of news on an upcoming feature (via comments on Atul’s post):

Fabrice: Does the fact that jetpacks are now XPIs mean that the “no restart after install” feature will be implemented for traditionnal add-ons ?

Atul: That’s correct! We don’t have a bug filed for it yet, still need to do that, but the idea is that if an extension includes certain metadata in its install.rdf that essentially tells Firefox “look, I know how to unload all my resources reliably”, then Firefox will trust it and call a certain function whenever the extension needs to unload itself.

Mossop: I’ll just elaborate a little. Plans are naturally in flux right now but the idea is to allow XPI packages to install without restarts if they wish, however there will be constraints. They will be responsible for doing everything themselves, which means (at least in my head right now) we won’t automatically load chrome or components from these extensions. Instead we will just do startup and shutdown calls into the extension and allow it to register/unregister what it needs by itself. This means that just marking an existing extension to work without restarts wouldn’t get you anywhere, you still need to do the extra work to handle the startup/shutdown parts.

This is great news for add-on developers! I’m sure MDC will have some code snippets for dynamically loading chrome overlays and components to make it easy to support no-restart add-ons.

AdBlock Plus Adds Support for Fennec

Thanks to Fabrice Desré and Wladimir Palant, development builds of AdBlock Plus support Fennec! The port embraces Fennec’s minimalistic design asthetic – exposing only a simple options UI. However, this is more than enough to make a great impact on browsing in Fennec.

fennec-adblockplus-options-small

Besides reducing the visual clutter on web pages, ad-heavy pages load noticeably faster! As Wladimir notes in his post, AdBlock Plus will only work in nightly builds of Fennec (version 1.0b6pre). Install a nightly version (including desktop versions) or use the new nightly update channel from your Maemo device. He also mentions that work to improve the first-run experience is coming in future releases.

Install a development build of AdBlock Plus by navigating to https://adblockplus.org/devbuilds/adblockplus/ using Fennec and click on the most recent XPI file. Fennec will step you through installing the add-on.

Fennec – Let’s Build Some Add-ons

We’re in the last weeks of development before releasing Fennec 1.0 to the world. There has been a lot of great testing and feedback. I think we have a well defined set of things to work on for 1.0 and a good idea of what we want to look at for 1.0+.

However, there is one area I think we haven’t had enough testing and feedback – add-on development in Fennec. Add-on developers are a tricky bunch. They can make you re-think your architecture, brainstorm many new features and find lot’s of hidden bugs. We need more developers working on Fennec add-ons.

We have a small, but growing collection of Fennec-specific add-on developer resources. If you’re interested in building add-ons for Fennec, here’s a list of resources you might find helpful:

The documents have been, and will continue to be updated. Feel free to give feedback on any of the documents. What information or snippets are missing? Use comments, IRC channels (#mobile) or even file some bugs.

Fennec for Maemo and Fennec for Windows Mobile both support add-ons. In fact, the same add-on could be used on both platforms. So get out there are start building.

Oh, one thing I wanted to ask before you go. What features of a mobile device would make building mobile add-ons really kick ass? Support for geo-location? Accessing the camera? Making calls or sending SMS? Leave comments and please go into detail 🙂

Fennec – Handling Add-on Options

The add-on (extension) mechanism built into the Mozilla platform is very powerful. One of the optional features is support for options (preferences) dialogs. As discussed in my last post, Fennec doesn’t like dialogs. In addition, Fennec has a simple, clean preference system. While designing the Fennec Add-ons Manager, we discussed how we would support add-on options. We didn’t want popup dialogs of random and complicated XUL.

After brainstorming a few ideas, we settled on a simple idea. Fennec uses special XUL tags to create it’s list of preferences. Add-ons would be forced to use the same tags. The options would be merged into the Fennec Add-on Manager, not displayed as a popup dialog. Of course, add-ons can support more than one application, so we needed to make sure that the options XUL for Fennec could coexist with the options XUL for other applications. Let’s take a look at how this all works:

Install Manifest

Add-ons use install.rdf to identify the XUL used for displaying the preferences. This is optional.


chrome://myaddon/content/options.xul

This is needed for any add-on that wants to use an options dialog.

Chrome Manifest

Add-ons use the chrome manifest to selectively override XUL, and other resources, between different applications using the application flags


override chrome://myaddon/content/options.xul chrome://myaddon/content/fennec-options.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}

This will tell Mozilla to use fennec-options.xul anytime the options.xul resource is requested.

Options XUL

As I said, the XUL allowed for the Fennec options system is limited to a few new tags. Here is an example of a Fennec options dialog:







  
  
    Profiling can affect the performance of the application
  
  
  
  
    

Note that we don’t have any