commit b7beaadb7c1394eafcc39d764346d4ea57294931 Author: Kathy Brade brade@pearlcrescent.com Date: Tue Oct 22 11:53:30 2013 -0400
ESR24 compat: compute correct paths for tor files.
Add a version check so Tor Launcher will find tor files in older versions of Firefox (as well as in Firefox 21 and newer). --- src/components/tl-process.js | 10 +++++++--- src/modules/tl-util.jsm | 9 +++++++++ 2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/components/tl-process.js b/src/components/tl-process.js index aef961c..a1ec60b 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -528,9 +528,13 @@ TorProcessService.prototype = else { // For Firefox, paths are relative to the top of the TBB install. - // In FF21+, CurProcD is the "browser" directory that is next to - // the firefox binary, e.g., <TorFileBaseDir>/Browser/browser - var tbbBrowserDepth = 2; // Windows and Linux + var tbbBrowserDepth = 1; // Windows and Linux + if (TorLauncherUtil.isAppVersionAtLeast("21.0")) + { + // In FF21+, CurProcD is the "browser" directory that is next to + // the firefox binary, e.g., <TorFileBaseDir>/Browser/browser + ++tbbBrowserDepth; + } if (TorLauncherUtil.isMac) tbbBrowserDepth += 4;
diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm index 67cbfcd..e6298e8 100644 --- a/src/modules/tl-util.jsm +++ b/src/modules/tl-util.jsm @@ -26,6 +26,15 @@ let TorLauncherUtil = // Public return ("WINNT" == TLUtilInternal._OS); },
+ isAppVersionAtLeast: function(aVersion) + { + var appInfo = Cc["@mozilla.org/xre/app-info;1"] + .getService(Ci.nsIXULAppInfo); + var vc = Cc["@mozilla.org/xpcom/version-comparator;1"] + .getService(Ci.nsIVersionComparator); + return (vc.compare(appInfo.version, aVersion) >= 0); + }, + // Error Reporting / Prompting showAlert: function(aParentWindow, aMsg) {
tor-commits@lists.torproject.org