[tbb-commits] [torbutton/master] Bug 13835: Add support for TOR_DEFAULT_HOMEPAGE env variable.

brade at torproject.org brade at torproject.org
Wed Jan 7 20:43:41 UTC 2015


commit a8b1333f08cd79699bec0d3d9a74845487c9a8be
Author: linostar <linux.anas at gmail.com>
Date:   Tue Jan 6 17:33:39 2015 +0200

    Bug 13835: Add support for TOR_DEFAULT_HOMEPAGE env variable.
    
    If TOR_DEFAULT_HOMEPAGE is set and the user has not customized the browser
    home page, it is reset to the value contained in TOR_DEFAULT_HOMEPAGE.
---
 src/components/startup-observer.js |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/components/startup-observer.js b/src/components/startup-observer.js
index d7b7bcd..de39e64 100644
--- a/src/components/startup-observer.js
+++ b/src/components/startup-observer.js
@@ -38,6 +38,16 @@ function StartupObserver() {
             getService(Ci.nsIObserverService);
     observerService.addObserver(this, "quit-application-granted", false);
 
+    var env = Cc["@mozilla.org/process/environment;1"]
+                .getService(Ci.nsIEnvironment);
+    var prefName = "browser.startup.homepage";
+    if (env.exists("TOR_DEFAULT_HOMEPAGE")) {
+      // if the user has set this value in a previous installation, don't override it
+      if (!this._prefs.prefHasUserValue(prefName)) {
+        this._prefs.setCharPref(prefName, env.get("TOR_DEFAULT_HOMEPAGE"));
+      }
+    }
+
     try {
       var test = this._prefs.getCharPref("torbrowser.version");
       this.is_tbb = true;



More information about the tbb-commits mailing list