[tbb-commits] [tor-browser/tor-browser-45.4.0esr-6.0-1] fixup! Bug #4234: Use the Firefox Update Process for Tor Browser.
gk at torproject.org
gk at torproject.org
Wed Sep 7 06:07:47 UTC 2016
commit 11de35257e2b4ce656f71c0d5f08c339ab7f172d
Author: Kathy Brade <brade at pearlcrescent.com>
Date: Tue Jul 26 10:40:24 2016 -0400
fixup! Bug #4234: Use the Firefox Update Process for Tor Browser.
When updating from an earlier version to Tor Browser 6.0 or later, old
update info files are left behind on Linux and Windows. Remove them.
This fixes bug 19725.
---
toolkit/mozapps/update/nsUpdateService.js | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js
index 4495210..b9b91fc 100644
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -1946,6 +1946,10 @@ UpdateService.prototype = {
* notify the user of install success.
*/
_postUpdateProcessing: function AUS__postUpdateProcessing() {
+#if defined(TOR_BROWSER_UPDATE) && !defined(XP_MACOSX)
+ this._removeOrphanedTorBrowserFiles();
+#endif
+
if (!this.canCheckForUpdates) {
LOG("UpdateService:_postUpdateProcessing - unable to check for " +
"updates... returning early");
@@ -2113,6 +2117,42 @@ UpdateService.prototype = {
cleanUpMozUpdaterDirs();
},
+#if defined(TOR_BROWSER_UPDATE) && !defined(XP_MACOSX)
+ /**
+ * When updating from an earlier version to Tor Browser 6.0 or later, old
+ * update info files are left behind on Linux and Windows. Remove them.
+ */
+ _removeOrphanedTorBrowserFiles: function AUS__removeOrphanedTorBrowserFiles() {
+ try {
+ let oldUpdateInfoDir = getAppBaseDir(); // aka the Browser directory.
+
+#ifdef XP_WIN
+ // On Windows, the updater files were stored under
+ // Browser/TorBrowser/Data/Browser/Caches/firefox/
+ oldUpdateInfoDir.appendRelativePath(
+ "TorBrowser\\Data\\Browser\\Caches\\firefox");
+#endif
+
+ // Remove the updates directory.
+ let updatesDir = oldUpdateInfoDir.clone();
+ updatesDir.append("updates");
+ if (updatesDir.exists() && updatesDir.isDirectory()) {
+ updatesDir.remove(true);
+ }
+
+ // Remove files: active-update.xml and updates.xml
+ let filesToRemove = [ "active-update.xml", "updates.xml" ];
+ filesToRemove.forEach(function(aFileName) {
+ let f = oldUpdateInfoDir.clone();
+ f.append(aFileName);
+ if (f.exists()) {
+ f.remove(false);
+ }
+ });
+ } catch (e) {}
+ },
+#endif
+
/**
* Register an observer when the network comes online, so we can short-circuit
* the app.update.interval when there isn't connectivity
More information about the tbb-commits
mailing list