[or-cvs] r13754: If the pref is set, close tabs before actually changing prox (torbutton/trunk/src/chrome/content)
mikeperry at seul.org
mikeperry at seul.org
Wed Feb 27 20:07:29 UTC 2008
Author: mikeperry
Date: 2008-02-27 15:07:28 -0500 (Wed, 27 Feb 2008)
New Revision: 13754
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
Log:
If the pref is set, close tabs before actually changing proxy
settings.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2008-02-27 19:19:38 UTC (rev 13753)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2008-02-27 20:07:28 UTC (rev 13754)
@@ -190,8 +190,12 @@
}
if (torbutton_check_status()) {
+ // Close on toggle before actually changing proxy settings
+ // as additional safety precaution
+ torbutton_close_on_toggle(false);
torbutton_disable_tor();
} else {
+ torbutton_close_on_toggle(true);
torbutton_enable_tor();
}
}
@@ -713,6 +717,39 @@
if(!changed && force_update)
return;
+ // This call also has to be here for 3rd party proxy changers.
+ torbutton_close_on_toggle(mode);
+
+ if(torprefs.getBoolPref('clear_http_auth')) {
+ var auth = Components.classes["@mozilla.org/network/http-auth-manager;1"].
+ getService(Components.interfaces.nsIHttpAuthManager);
+ auth.clearAll();
+ }
+
+ // Prevent tor cookies from being written to disk
+ if(torprefs.getBoolPref('clear_cookies')
+ || torprefs.getBoolPref('cookie_jars')) {
+ torbutton_log(2, "Changing cookie lifetime");
+ if(mode) {
+ torprefs.setIntPref("saved.cookieLifetime",
+ m_tb_prefs.getIntPref("network.cookie.lifetimePolicy"));
+ m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ } else {
+ m_tb_prefs.setIntPref("network.cookie.lifetimePolicy",
+ torprefs.getIntPref("saved.cookieLifetime"));
+ }
+ torbutton_log(2, "Cookie lifetime changed");
+ }
+
+ if (torprefs.getBoolPref('clear_cookies')) {
+ torbutton_clear_cookies();
+ } else if (torprefs.getBoolPref('cookie_jars')
+ || torprefs.getBoolPref('dual_cookie_jars')) {
+ torbutton_jar_cookies(mode);
+ }
+}
+
+function torbutton_close_on_toggle(mode) {
var close_tor = m_tb_prefs.getBoolPref("extensions.torbutton.close_tor");
var close_nontor = m_tb_prefs.getBoolPref("extensions.torbutton.close_nontor");
@@ -753,36 +790,9 @@
}
}
}
+}
- if(torprefs.getBoolPref('clear_http_auth')) {
- var auth = Components.classes["@mozilla.org/network/http-auth-manager;1"].
- getService(Components.interfaces.nsIHttpAuthManager);
- auth.clearAll();
- }
- // Prevent tor cookies from being written to disk
- if(torprefs.getBoolPref('clear_cookies')
- || torprefs.getBoolPref('cookie_jars')) {
- torbutton_log(2, "Changing cookie lifetime");
- if(mode) {
- torprefs.setIntPref("saved.cookieLifetime",
- m_tb_prefs.getIntPref("network.cookie.lifetimePolicy"));
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
- } else {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy",
- torprefs.getIntPref("saved.cookieLifetime"));
- }
- torbutton_log(2, "Cookie lifetime changed");
- }
-
- if (torprefs.getBoolPref('clear_cookies')) {
- torbutton_clear_cookies();
- } else if (torprefs.getBoolPref('cookie_jars')
- || torprefs.getBoolPref('dual_cookie_jars')) {
- torbutton_jar_cookies(mode);
- }
-}
-
function torbutton_open_prefs_dialog() {
window.openDialog("chrome://torbutton/content/preferences.xul","torbutton-preferences","centerscreen, chrome");
torbutton_log(2, 'opened preferences window');
More information about the tor-commits
mailing list