Immediately uninstalling WebExtension after install results in missing directory error

NEW
Unassigned

Status

()

Toolkit
Add-ons Manager
P3
normal
9 months ago
9 months ago

People

(Reporter: mkelly, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

9 months ago
STR: Run the following in the browser console (I'm using the Pioneer web extension from AMO as an example):

AddonManager.getInstallForURL(
  'https://addons.mozilla.org/firefox/downloads/latest/firefox-pioneer/addon-835630-latest.xpi',
  null,
  'application/x-xpinstall'
).then(install => {
  install.addListener({
    onInstallEnded(install, addon) {
      addon.uninstall();
    }
  });
  install.install();
});

Running that, I get two warnings and an error:

1501045980074	addons.xpi	WARN	Exception running bootstrap method shutdown on pioneer-opt-in@mozilla.org: TypeError: extension is undefined (resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/addons/WebExtensionBootstrap.js:33:3) JS Stack trace: shutdown@WebExtensionBootstrap.js:33:3 < callBootstrapMethod@XPIProvider.jsm:4391:11 < uninstallAddon@XPIProvider.jsm:4672:11 < uninstall@XPIProvider.jsm:5539:5 < onInstallEnded@debugger eval code:9:9 < callInstallListeners@AddonManager.jsm:1646:15 < callInstallListeners@AddonManager.jsm:3166:12 < startInstall/<@XPIInstall.jsm:1929:9 < async*startInstall@XPIInstall.jsm:1835:6 < install@XPIInstall.jsm:1488:7 < install@XPIInstall.jsm:2243:7 < checkForBlockers@XPIInstall.jsm:1793:5 < install@XPIInstall.jsm:1485:7 < install@XPIInstall.jsm:2243:7 < checkPrompt/<@XPIInstall.jsm:1768:7 < async*checkPrompt@XPIInstall.jsm:1748:6 < install@XPIInstall.jsm:1482:7 < install@XPIInstall.jsm:2243:7 < downloadCompleted/<@XPIInstall.jsm:2559:9 < makeSafe/<@XPIProviderUtils.js:109:17 < getRepositoryAddon@XPIProviderUtils.js:90:5 < getAddon/<@XPIProviderUtils.js:749:9 < promise callback*getAddon@XPIProviderUtils.js:747:12 < getVisibleAddonForID@XPIProviderUtils.js:796:5 < downloadCompleted@XPIInstall.jsm:2536:5 < onStopRequest/<@XPIInstall.jsm:2482:13 < promise callback*onStopRequest@XPIInstall.jsm:2480:9
1501045980109	addons.xpi	ERROR	Attempted to load bootstrap scope from missing directory /Users/mkelly/Library/Application Support/Firefox/Profiles/yy0fzwly.default-1477538586801/extensions/pioneer-opt-in@mozilla.org.xpi  Log.jsm:752
	App_append resource://gre/modules/Log.jsm:752:9
	log resource://gre/modules/Log.jsm:390:7
	error resource://gre/modules/Log.jsm:398:5
	loadBootstrapScope resource://gre/modules/addons/XPIProvider.jsm:4227:7
	callBootstrapMethod resource://gre/modules/addons/XPIProvider.jsm:4325:9
	startInstall/< resource://gre/modules/addons/XPIInstall.jsm:1935:13
	InterpretGeneratorResume self-hosted:1276:8
	next self-hosted:1183:9
1501045980110	addons.xpi	WARN	Add-on pioneer-opt-in@mozilla.org is missing bootstrap method startup

It does appear to successfully uninstall the extension, at least.

I originally ran into this during a test run with some wip code on Shield, but instead of the above, my test got the same error as bug 1376677. Not sure if these are related or not.

Updated

9 months ago
Flags: needinfo?(aswan)

Comment 1

9 months ago
This should be relatively easy to fix once bug 1385880 lands.
In the mean time, if you need a workaround you can listen for the "startup" event on the Management object from Extension.jsm, eg:
http://searchfox.org/mozilla-central/rev/765cc1b925c5d32d05111c364257a0b79bf2952e/toolkit/components/extensions/ExtensionXPCShellUtils.jsm#384

I think Kris has some different workaround that he might prefer, not sure how urgently you need a workaround or how strongly Kris feels about doing it differently but maybe check in with him if you need something in the short term.

Also setting a priority, but :Osmose, if you need something for Shield feel free to raise it.
Flags: needinfo?(aswan)
Priority: -- → P3
(Reporter)

Comment 2

9 months ago
(In reply to Andrew Swan [:aswan] (PTO through 8/9) from comment #1)
> This should be relatively easy to fix once bug 1385880 lands.
> In the mean time, if you need a workaround you can listen for the "startup"
> event on the Management object from Extension.jsm, eg:
> http://searchfox.org/mozilla-central/rev/
> 765cc1b925c5d32d05111c364257a0b79bf2952e/toolkit/components/extensions/
> ExtensionXPCShellUtils.jsm#384
> 
> I think Kris has some different workaround that he might prefer, not sure
> how urgently you need a workaround or how strongly Kris feels about doing it
> differently but maybe check in with him if you need something in the short
> term.
> 
> Also setting a priority, but :Osmose, if you need something for Shield feel
> free to raise it.

Rad, thanks. We already worked around this by moving add-on installation to be the last thing we do, so rolling it back isn't necessary now. So no rush. :D
You need to log in before you can comment on or make changes to this bug.