[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10281: [darcs-to-svn @ update live tor proxy settings when preferen (torbutton/trunk/src/chrome/content)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r10281: [darcs-to-svn @ update live tor proxy settings when preferen (torbutton/trunk/src/chrome/content)
- From: squires@xxxxxxxx
- Date: Tue, 22 May 2007 01:27:42 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Tue, 22 May 2007 01:27:52 -0400
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: squires
Date: 2007-05-22 01:27:32 -0400 (Tue, 22 May 2007)
New Revision: 10281
Modified:
torbutton/trunk/src/chrome/content/preferences.js
torbutton/trunk/src/chrome/content/torbutton.js
Log:
[darcs-to-svn @ update live tor proxy settings when preferences are changed]
Original author: squires@xxxxxxxxx
Date: 2006-11-18 06:33:40+00:00
Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js 2007-05-22 05:27:13 UTC (rev 10280)
+++ torbutton/trunk/src/chrome/content/preferences.js 2007-05-22 05:27:32 UTC (rev 10281)
@@ -3,6 +3,8 @@
// torbutton_prefs_init() -- on dialog load
// torbutton_prefs_save() -- on dialog save
+var tor_enabled = false;
+
function torbutton_prefs_set_field_attributes(doc)
{
torbutton_log(4, "called prefs_set_field_attributes()");
@@ -80,6 +82,9 @@
torbutton_log(4, "called prefs_init()");
sizeToContent();
+ // remember if tor settings were enabled when the window was opened
+ tor_enabled = torbutton_check_status();
+
var o_torprefs = torbutton_get_prefbranch('extensions.torbutton.');
doc.getElementById('torbutton_displayStatusPanel').checked = o_torprefs.getBoolPref('display_panel');
@@ -132,4 +137,7 @@
o_torprefs.setCharPref('socks_host', doc.getElementById('torbutton_socksHost').value);
o_torprefs.setIntPref('socks_port', doc.getElementById('torbutton_socksPort').value);
// o_torprefs.setBoolPref('prompt_before_visiting_excluded_sites', doc.getElementById('torbutton_warnUponExcludedSite').checked);
+
+ // if tor settings were initially active, update the active settings to reflect any changes
+ if (tor_enabled) torbutton_activate_tor_settings();
}
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2007-05-22 05:27:13 UTC (rev 10280)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2007-05-22 05:27:32 UTC (rev 10281)
@@ -379,44 +379,48 @@
liveprefs.setBoolPref('share_proxy_settings', savprefs.getBoolPref('share_proxy_settings'));
} catch(e) {}
if (torbutton_check_socks_remote_dns())
- nonprefs.setBoolPref('socks_remote_dns', savprefs.getBoolPref('socks_remote_dns'));
+ liveprefs.setBoolPref('socks_remote_dns', savprefs.getBoolPref('socks_remote_dns'));
}
+function torbutton_activate_tor_settings()
+{
+ var liveprefs = false;
+ var torprefs = false;
+
+ liveprefs = torbutton_get_prefbranch('network.proxy.');
+ torprefs = torbutton_get_prefbranch('extensions.torbutton.');
+ if (!liveprefs || !torprefs) return;
+
+ liveprefs.setCharPref('http', torprefs.getCharPref('http_proxy'));
+ liveprefs.setIntPref('http_port', torprefs.getIntPref('http_port'));
+ liveprefs.setCharPref('ssl', torprefs.getCharPref('https_proxy'));
+ liveprefs.setIntPref('ssl_port', torprefs.getIntPref('https_port'));
+ liveprefs.setCharPref('ftp', torprefs.getCharPref('ftp_proxy'));
+ liveprefs.setIntPref('ftp_port', torprefs.getIntPref('ftp_port'));
+ liveprefs.setCharPref('gopher', torprefs.getCharPref('gopher_proxy'));
+ liveprefs.setIntPref('gopher_port', torprefs.getIntPref('gopher_port'));
+ liveprefs.setCharPref('socks', torprefs.getCharPref('socks_host'));
+ liveprefs.setIntPref('socks_port', torprefs.getIntPref('socks_port'));
+ liveprefs.setIntPref('socks_version', 5);
+ liveprefs.setBoolPref('share_proxy_settings', false);
+ if (torbutton_check_socks_remote_dns()) {
+ liveprefs.setBoolPref('socks_remote_dns', true);
+ }
+ liveprefs.setIntPref('type', 1);
+}
+
function torbutton_disable_tor()
{
torbutton_log(2, 'called disable_tor()');
torbutton_restore_nontor_settings();
- // nonprefs.setIntPref("type", 0);
}
function torbutton_enable_tor()
{
- var nonprefs = false;
- var torprefs = false;
-
- nonprefs = torbutton_get_prefbranch('network.proxy.');
- torprefs = torbutton_get_prefbranch('extensions.torbutton.');
- if (!nonprefs || !torprefs) return;
-
torbutton_log(2, 'called enable_tor()');
torbutton_save_nontor_settings();
- nonprefs.setCharPref('http', torprefs.getCharPref('http_proxy'));
- nonprefs.setIntPref('http_port', torprefs.getIntPref('http_port'));
- nonprefs.setCharPref('ssl', torprefs.getCharPref('https_proxy'));
- nonprefs.setIntPref('ssl_port', torprefs.getIntPref('https_port'));
- nonprefs.setCharPref('ftp', torprefs.getCharPref('ftp_proxy'));
- nonprefs.setIntPref('ftp_port', torprefs.getIntPref('ftp_port'));
- nonprefs.setCharPref('gopher', torprefs.getCharPref('gopher_proxy'));
- nonprefs.setIntPref('gopher_port', torprefs.getIntPref('gopher_port'));
- nonprefs.setCharPref('socks', torprefs.getCharPref('socks_host'));
- nonprefs.setIntPref('socks_port', torprefs.getIntPref('socks_port'));
- nonprefs.setIntPref('socks_version', 5);
- nonprefs.setBoolPref('share_proxy_settings', false);
- if (torbutton_check_socks_remote_dns()) {
- nonprefs.setBoolPref('socks_remote_dns', true);
- }
- nonprefs.setIntPref('type', 1);
+ torbutton_activate_tor_settings();
}
function torbutton_update_toolbutton(mode)