From f8f2933c5a52305c042b09d0eccec6c5b5a16b96 Mon Sep 17 00:00:00 2001 From: Richard Marti Date: Sat, 20 Apr 2019 10:09:02 +0200 Subject: [PATCH] Bug 1545879 - Port bug 1520321 and bug 1544562: Changes to Application Updater. r=jorgk Bug 1520321 - Implement XPCOM interface for interacting with the update agent. Bug 1544562 - aboutDialog-appUpdater's onUnload doesn't run in about:preferences --- mail/app/profile/all-thunderbird.js | 5 +++++ mail/base/content/aboutDialog-appUpdater.js | 13 +++++++------ mail/components/preferences/advanced.js | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js index 6f5f96d57d..ae578adfaa 100644 --- a/mail/app/profile/all-thunderbird.js +++ b/mail/app/profile/all-thunderbird.js @@ -117,6 +117,11 @@ pref("app.update.idletime", 60); pref("app.update.service.enabled", true); #endif +#ifdef XP_WIN +// This pref prevents BITS from being used by Thunderbird to download updates. +pref("app.update.BITS.enabled", false); +#endif + // Release notes URL pref("app.releaseNotesURL", "https://live.thunderbird.net/%APP%/releasenotes?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%"); diff --git a/mail/base/content/aboutDialog-appUpdater.js b/mail/base/content/aboutDialog-appUpdater.js index 5bd1f3ba3e..c88364f9b7 100644 --- a/mail/base/content/aboutDialog-appUpdater.js +++ b/mail/base/content/aboutDialog-appUpdater.js @@ -18,11 +18,13 @@ const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never"; var gAppUpdater; function onUnload(aEvent) { - if (gAppUpdater.isChecking) - gAppUpdater.checker.stopCurrentCheck(); - // Safe to call even when there isn't a download in progress. - gAppUpdater.removeDownloadListener(); - gAppUpdater = null; + if (gAppUpdater) { + if (gAppUpdater.isChecking) + gAppUpdater.checker.stopCurrentCheck(); + // Safe to call even when there isn't a download in progress. + gAppUpdater.removeDownloadListener(); + gAppUpdater = null; + } } @@ -294,7 +296,6 @@ appUpdater.prototype = { this.update.QueryInterface(Ci.nsIWritablePropertyBag); this.update.setProperty("foregroundDownload", "true"); - this.aus.pauseDownload(); let state = this.aus.downloadUpdate(this.update, false); if (state == "failed") { this.selectPanel("downloadFailed"); diff --git a/mail/components/preferences/advanced.js b/mail/components/preferences/advanced.js index 4381b19ad5..aa6ebde6a6 100644 --- a/mail/components/preferences/advanced.js +++ b/mail/components/preferences/advanced.js @@ -785,6 +785,9 @@ var gAdvancedPane = { handleEvent(aEvent) { if (aEvent.type == "unload") { this.destroy(); + if (AppConstants.MOZ_UPDATER) { + onUnload(); + } } },