One thing we have planned to make part of the Add-on SDK story is to have “automatic repacks” for developers using the SDK. What this means is that if you host your add-on, built with the SDK, on AMO (addons.mozilla.org), we would automatically rebuild it everytime we release a new version of the Add-on SDK to maintain compatibility with a new version of Firefox. This would make sure that your add-on was always up-to-date with the latest version of Firefox.
This is still the plan, but for our first attempt we noticed some things that were wrong with the plan as we currently have it and would like to propose a way of getting past these problems and getting to a new repack process.
What Went Wrong
The first problem we faced is that the repacker is the first service to use AMO’s brand-new APIs for updating add-ons, and we hadn’t tested the interaction between the two sites sufficiently beforehand, so we had to implement fixes for issues we encountered during the repack testing, which slowed down the testing.
Second, our testing was short and not deep enough for what we were trying to accomplish. The repack team didn’t get enough testing in themselves, nor did they make it possible for other project participants to test repacks and suggests issues and fixes before the production run of repacking.
Finally, what we are fundamentally trying to do is repackage a derived format without the source code it came from as reference, like decompiling a program, making changes, and then recompiling it. This is something that is hard to do and as it turned out, didn’t work very well. We could fix that by including the source code in the XPI. However, including the source code in the XPI would defeat our goal of making the XPI size as small as possible (this is extremely important for mobile versions of Firefox).
So what can we do about these issues? First of all, the repack team will answer the testing problems by starting testing earlier and sharing the results with everyone. In addition, the use of the AMO APIs is now solved as the calls we are using are now verified and tested.
However, the issue about the required sources for a clean rebuild is a bit more difficult and needs a new proposal.
In the short-term I propose that we only repack add-ons which are built using the Add-on Builder. This is the quickest and safest solution as we have access to all the sources with Builder-based add-ons. The repack process is much simpler too as we don’t have to unpack a XPI first. For those who use a local installation of the Add-on SDK to build an add-on, we will document how to repack your add-on and the process for pushing the new one to AMO. In addition, you can move your add-on to the Add-on Builder and take advantage of the automatic repacks if you’d like, but do keep in mind that the Add-on Builder is still in beta at this point.
The long-term solutions will need to be studied and debated a bit more. One option we have is to create a “source package” that can be pushed to AMO for use in repacking. However, this would mean that AMO would have to store these source packages and generate XPIs from them in addition to taking on responsibility for repacking when a new SDK is released. Obviously this would involve adding a great deal of functionality to AMO, as well as tooling up the services side to store these new, larger packages.
Another option is to land parts of the Add-on SDK into Firefox itself, including API implementations and the module loader. If an API already in Firefox needs updating to maintain compatibility with changes to Firefox, we won’t need to repack add-ons that use that API, as the updates can be made to that new version of the browser rather than each individual add-on. Doing this has other benefits as well. For example, it may help reduce XPI sizes tremendously. However, this too would take a bit of time to implement and is thus a long-term solution.
At this point we think that the short-term solution of just repacking Add-on Builder-based add-ons would be the best approach. We would also provide documentation describing the simplest approach for repacking add-ons along with best practices and troubleshooting. In addition, we would look into how best to notify authors when their add-ons need to be repacked manually.
Still, we also want to know what you think about this as well as the long-term ideas. Please feel free to leave your comments here or on our jetpack discussion forum