Skip to content

Instantly share code, notes, and snippets.

@nickrussler
Created May 23, 2015 17:25
Show Gist options
  • Save nickrussler/075eab7a209f99984e37 to your computer and use it in GitHub Desktop.
Save nickrussler/075eab7a209f99984e37 to your computer and use it in GitHub Desktop.
Programatically self-update a Firefox Addon
const self = require('sdk/self');
const chrome = require('chrome');
/**
* Autoupdate this addon on startup
*/
(function() {
let AddonManager = chrome.Cu.import('resource://gre/modules/AddonManager.jsm', null).AddonManager;
AddonManager.getAddonByID(self.id, function(addon) {
addon.findUpdates({
onUpdateAvailable: function(addon, install) {
install.install();
}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment