Remove code to prompt for Firefox extension updates on startup error

And change button from "Check for Update" to "Check for Updates"
This commit is contained in:
Dan Stillman 2019-05-19 21:30:20 -04:00
parent 4b60c6ca27
commit 7bcec02326
2 changed files with 10 additions and 44 deletions

View file

@ -636,7 +636,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
Zotero.getString('general.error'),
Zotero.startupError,
buttonFlags,
Zotero.getString('general.checkForUpdate'),
Zotero.getString('general.checkForUpdates'),
null,
Zotero.getString('general.moreInformation'),
null,
@ -644,49 +644,8 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
);
// "Check for Update" button
if(index === 0) {
if(Zotero.isStandalone) {
Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher)
.openWindow(null, 'chrome://mozapps/content/update/updates.xul',
'updateChecker', 'chrome,centerscreen,modal', null);
} else {
// In Firefox, show the add-on manager
Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID(ZOTERO_CONFIG['GUID'],
function (addon) {
// Disable auto-update so that the user is presented with the option
var initUpdateState = addon.applyBackgroundUpdates;
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
addon.findUpdates({
onNoUpdateAvailable: function() {
ps.alert(
null,
Zotero.getString('general.noUpdatesFound'),
Zotero.getString('general.isUpToDate', 'Zotero')
);
},
onUpdateAvailable: function() {
// Show available update
Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser')
.BrowserOpenAddonsMgr('addons://updates/available');
},
onUpdateFinished: function() {
// Restore add-on auto-update state, but don't fire
// too quickly or the update will not show in the
// add-on manager
setTimeout(function() {
addon.applyBackgroundUpdates = initUpdateState;
}, 1000);
}
},
AddonManager.UPDATE_WHEN_USER_REQUESTED
);
}
);
}
if (index === 0) {
Zotero.openCheckForUpdatesWindow();
}
// Load More Info page
else if (index == 2) {
@ -988,6 +947,12 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
}
this.openCheckForUpdatesWindow = function () {
Services.ww.openWindow(null, 'chrome://mozapps/content/update/updates.xul',
'updateChecker', 'chrome,centerscreen,modal', null);
};
/**
* Launch a file, the best way we can
*/

View file

@ -21,6 +21,7 @@ general.serverError = The server returned an error. Please try again.
general.pleaseRestart = Please restart %S.
general.pleaseRestartAndTryAgain = Please restart %S and try again.
general.checkForUpdate = Check for Update
general.checkForUpdates = Check for Updates
general.actionCannotBeUndone = This action cannot be undone.
general.install = Install
general.updateAvailable = Update Available