Skip to content

Instantly share code, notes, and snippets.

@xabolcs
Created August 24, 2012 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xabolcs/3447122 to your computer and use it in GitHub Desktop.
Save xabolcs/3447122 to your computer and use it in GitHub Desktop.
NTT Issue #60: Langpack auto updater for daily builds
Components.utils.import("resource:///modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource:///modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource:///modules/AddonManager.jsm");
AddonManager.getAddonsByTypes(["locale"] , function (aAddons) {
aAddons.forEach(function(aAddon){
Services.console.logStringMessage(aAddon.name + " ("+ aAddon.id +") is " + (aAddon.isCompatible ? "compatible" : "not compatible") );
});
});
Components.utils.import("resource:///modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource:///modules/AddonManager.jsm");
var langpackURL = "https://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mozilla-aurora-l10n/win32/xpi/firefox-16.0a2.hu.langpack.xpi";
AddonManager.getInstallForURL(langpackURL , function(aInstall) {
/* After installation a notification about restart would be needed! */
aInstall.install();
}, "application/x-xpinstall");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment