New Address Book Popup Binding

One of the aims of rewriting the address book interfaces, is also to remove RDF from the address book code base. Up until a few days ago, we had many menu lists of address books based around an RDF builder, these have now been replaced by an xbl binding on the menupopup.

This has several advantages, firstly javascript is now doing the work of building the menu, secondly it is all encapsulated in one area and useable from any dialog we want. In doing this change, we now also have proper tracking of addition/removal/changes of address books for all menus that use the new binding.

There are still a few preference menus based on the old RDF method, however, we are working on replacing them, and there’s still a change we’re working on to the menu binding itself.

For extensions, this is also good news. You can pull in the new binding to your menulist/menupopup on your own dialogs, just specify class="addrbooksPopup" on your menupopup, see the new card dialog xul for an example. There are some attributes you can specify to affect what is displayed, for now its easier to look at the code for the binding; I will be putting up documentation on devmo when it re-opens for edits.

Address Book rewrite – The benefits: OS X AB searching/filtering.

As many folks will already know by now, we are currently rewriting a lot of the interfaces for the address book.

With Joshua’s most recent push, the “cardForEmailAddress” function has moved from the interface specific to local/mork address books, to the generic interface for all address books (nsIAbDirectory).

The benefits of this are great, with one simple function addition for the OS X address book interfaces, we now have support for searching and filtering against “is/isn’t in my OS X address book”.

One of the main aims of the rewrite has been to reduce the local/mork address book specialisations within the mailnews code base to make it work better with any type of address book. This first change does that, and we’ve got a few more to come.

The usefulness of fake servers

A while ago, Joshua created a “fake” news server for xpcshell tests in mailnews, then a few days ago I was reminded about Bug 327510 – XML Parsing Error: no element found/netError.xhtml on newsgroup msg download timout.

This was turning out to be a hard bug to reproduce to order, because it needed intermittent newsgroup connections. Having then remembered about the fake news server, and the fact it ran on xpcshell got me thinking.

In a couple of hours, I had written a wrapper around the fake news server (based on some of the existing unit tests) and got it up and running in xpcshell as a standalone process. Then I pointed Thunderbird at it, downloaded the message list, and before selecting the message, killed the server process, selecting the message then reproduced the bug.

This was good news, and having fixed a similar bug before, I’ve now fixed that bug (I’m currently investigating getting it in the SeaMonkey 1.1/Thunderbird 2.0 security/stability releases).

The great advantage with the fake server here was that I was able to (with some copy and paste) set it up to do exactly what I wanted and quickly; to have done this with a full server, or tried to manage my internet connection to a main server, it would have taken me longer, and I doubt it would have been so easy to consistently reproduce.

At some stage I want to have some scripts alongside the source code so that we can do this type of testing easily. However Joshua is working on something at the moment, and I’m waiting on seeing what that will give us as it is likely to be more useful than my scripts. If in the meantime you think you need something like this for a bug you’re working on, please drop me a line.