Plan for handling addon uninstall.

5 views
Skip to first unread message

Alexandre poirot

unread,
Jul 19, 2011, 12:02:15 PM7/19/11
to mozilla-labs-jetpack
Hi,

We are currently working on addon uninstall.
Handling uninstall event appears to be challenging as the Addon manager:
 - offers the end user to undo uninstall actions,
 - can uninstall an addon when it is disabled.

We end up not being able to handle uninstallation of an addon through `unload` module,
like:
require("unload").when(function (reason) {
  if (reason == "uninstall") {
    // remove cache, files, preferences, ...
   
  }
});

So I come up with various proposals exposed in the following bug:
  https://bugzilla.mozilla.org/show_bug.cgi?id=571049

My favorite, but most complex to implement would be to add an API that register uninstall modules dynamically.
It main benefit is to allow to any module to register scripts for unload event.
So we would have something like this:
  require("uninstall").registerModule("simple-storage-uninstall.js");

Then we keep an internal list of modules to execute on uninstall event.
We would be able to load these modules even if the addon is disabled.

Regarding discussion we had last week on supporting loader pattern in `require` argument for implementing e10s.
It appears that we could use another specific loader for uninstall,
and we would finally have something like:
  require("uninstall!simple-storage-uninstall.js");

The main issue of this approach is with the linker.
We will have to modify the linker so that it detects these new modules to ship in the XPI.

Finally, if we decide not to offer such API for any module.
We can implement the first proposal in the bug, that will call a specific uninstall module defined in package.json.


-------
Alex
Reply all
Reply to author
Forward
0 new messages