Created
March 15, 2017 21:05
-
-
Save jaredhirsch/625048a088e70a00b658fbc1321eff52 to your computer and use it in GitHub Desktop.
trying to shutdown + restart embedded webextensions without a restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. This seems to work. Is it safe to use? | |
const { EmbeddedExtensionManager } = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm"); | |
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: '[email protected]'}); | |
webext.shutdown(); | |
webext.started = false; | |
webext.startup(); // throws no errors, toolbar button reappears, messaging works | |
// 2. This doesn't work: | |
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: '[email protected]'}); | |
webext.shutdown(); | |
EmbeddedExtensionManager.untrackEmbeddedExtension(webext); | |
const another = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: '[email protected]'}).catch(err => console.log(err)); | |
// fails with a Malformed URI Error because the resource URI wasn't specified | |
// 3. This also fails: | |
let pageshotAddon; | |
AddonManager.getAddonById('[email protected]', addon => { pageshotAddon = addon; }); | |
const third = EmbeddedExtensionManager.getEmbeddedExtensionFor({ | |
id: '[email protected]', | |
resourceURI: pageshotAddon.getResourceURI() | |
}); | |
third.startup(); | |
// fails with FILE_NOT_FOUND error trying to load the manifest from the wrong location: | |
// $PROFILE/extensions/webextension/manifest.json, rather than from the webextension inside pageshot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment