AddonInstall.cancel() doesn't handle restartless installs that have reached STATE_INSTALLED




6 years ago
4 months ago


(Reporter: Unfocused, Unassigned)


Firefox Tracking Flags

(Not tracked)


AddonInstall.cancel() is unaware of restartless installs. This is fine during the install, as they act the same as non-restartless installs. However, once the install reaches STATE_INSTALLED and has completed, the new addon has been completely installed - so it can't just delete the staged install.

If we have a restartless install, and try to cancel it once it's reached STATE_INSTALLED (within the onInstallEnded event), we get the following exception:

*** WARN addons.manager: InstallListener threw exception when calling onInstallEnded: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIFile.directoryEntries]"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "JS frame :: resource://gre/modules/XPIProvider.jsm :: cleanStagingDir :: line 1211"  data: no]

There's two ways to fix this:
* Disallow canceling restartless installs once they've completed. This is easy, and kinda makes sense given that the addon has been completely installed.
* Uninstall the addon (or roll back to the previous version, if it was an upgrade). This is hard, mostly due to upgrades - we'd need to keep the old addon, restore that, and somehow deal with multiple upgrades during runtime.

I'm leaning strongly towards the easy way.
Yeah, just make it throw a sane exception if the install already completed I think. I tend to think of AddonInstall as basically immutable at that point.

Comment 2

4 months ago
Per policy at If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Last Resolved: 4 months ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.