From 7bcec023261daa69d9f5aba70354a836505495d9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 19 May 2019 21:30:20 -0400 Subject: [PATCH] Remove code to prompt for Firefox extension updates on startup error And change button from "Check for Update" to "Check for Updates" --- chrome/content/zotero/xpcom/zotero.js | 53 ++++---------------- chrome/locale/en-US/zotero/zotero.properties | 1 + 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 92b5a9444a..a4fdd4caeb 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -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 */ diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 3722fe154d..f8d25687ef 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -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