Is it possible for extensions in XUL application to auto update to newer version when app starts? I'm trying to figure this out. If this is possible I would be very grateful if someone would point me to good documentation about this, because I can't find any good articles about this subject on the Internet.
XULRunner has the same extension update mechanism built in as Firefox - it will look for extension updates once daily when the application is running. If it finds an update then it will update restartless extensions immediately, other extensions are downloaded and updated on next application start. You have to make sure that the following preferences are defined for your application (copied from Firefox preferences):
pref("extensions.update.autoUpdateDefault", true);
pref("extensions.update.enabled", true);
pref("extensions.update.interval", 86400);
pref("extensions.update.url", "...");
pref("extensions.update.background.url", "...");
The tricky part are the update URLs. Of course you can use the same URLs as Firefox:
https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%
https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%
This will work fine for extensions available on addons.mozilla.org. However, I suspect that the extensions for your application will not be available there. Then you have two options. You can enter some dummy URL here like data:text/xml,<nada/>
to keep the add-on manager quiet and make sure that all extensions have a custom updateURL
. Or you can run your own update server that will produce update manifests for all known extensions (basically what addons.mozilla.org is doing).