[or-cvs] r12497: Prevent Tor cookies from being written to disk if the user w (in torbutton/trunk/src: . chrome/content defaults/preferences)
mikeperry at seul.org
mikeperry at seul.org
Thu Nov 15 06:11:35 UTC 2007
Author: mikeperry
Date: 2007-11-15 01:11:35 -0500 (Thu, 15 Nov 2007)
New Revision: 12497
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
torbutton/trunk/src/defaults/preferences/preferences.js
torbutton/trunk/src/install.rdf
Log:
Prevent Tor cookies from being written to disk if the user
wants them cleared on toggle.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2007-11-14 20:01:15 UTC (rev 12496)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2007-11-15 06:11:35 UTC (rev 12497)
@@ -72,6 +72,14 @@
// XXX: called way too often
torbutton_set_status();
break;
+ case "extensions.torbutton.cookie_jars":
+ case "extensions.torbutton.clear_cookies":
+ if(!m_tb_prefs.getBoolPref("extensions.torbutton.cookie_jars")
+ && !m_tb_prefs.getBoolPref("extensions.torbutton.clear_cookies")) {
+ m_tb_prefs.setIntPref("network.cookie.lifetimePolicy",
+ torprefs.getIntPref("saved.cookieLifetime"));
+ }
+ break;
case "extensions.torbutton.crashed":
// can we say ghetto hack, boys and girls?
torbutton_crash_recover();
@@ -199,6 +207,7 @@
torbutton_init_jshooks();
torbutton_log(1, 'registering pref observer');
+ // XXX: Perf: do we really need one for each window?
torbutton_pref_observer.register();
m_tb_wasinited = true;
} else {
@@ -287,7 +296,7 @@
} else if (document.getElementById("torbutton-button-tb-msg")) {
o_toolbutton = document.getElementById("torbutton-button-tb-msg");
} else {
- torbutton_log(5, 'get_toolbutton(): did not find torbutton-button');
+ torbutton_log(3, 'get_toolbutton(): did not find torbutton-button');
}
return o_toolbutton;
@@ -499,7 +508,7 @@
}
}
}
-
+
torbutton_log(2, 'Done with user agent: '+changed);
// FIXME: This is not ideal, but the refspoof method is not compatible
@@ -610,6 +619,21 @@
if(!changed && force_update)
return;
+ // 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')
@@ -1189,7 +1213,7 @@
var chanreq = aRequest.QueryInterface(Components.interfaces.nsIChannel);
// XXX: do we need to QI this bastard?
if(chanreq
- && aRequest instanceof Components.interfaces.nsIChannel
+ && chanreq instanceof Components.interfaces.nsIChannel
&& aRequest.isPending()
&& m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")
&& m_tb_prefs.getBoolPref("extensions.torbutton.no_tor_plugins")) {
Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js 2007-11-14 20:01:15 UTC (rev 12496)
+++ torbutton/trunk/src/defaults/preferences/preferences.js 2007-11-15 06:11:35 UTC (rev 12497)
@@ -38,6 +38,7 @@
pref("extensions.torbutton.saved.socks_host","");
pref("extensions.torbutton.saved.socks_version",0);
pref("extensions.torbutton.saved.socks_port",0);
+pref("extensions.torbutton.saved.cookieLifetime",0);
pref("extensions.{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}.description", "chrome://torbutton/locale/torbutton.properties");
// XXX: Hrmm, what is the convention for above? do some of these belong in
// 'saved'?
Modified: torbutton/trunk/src/install.rdf
===================================================================
--- torbutton/trunk/src/install.rdf 2007-11-14 20:01:15 UTC (rev 12496)
+++ torbutton/trunk/src/install.rdf 2007-11-15 06:11:35 UTC (rev 12497)
@@ -6,7 +6,7 @@
<em:name>Torbutton</em:name>
<em:creator>Scott Squires & Mike Perry</em:creator>
<em:id>{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}</em:id>
- <em:version>1.1.10-alpha</em:version>
+ <em:version>1.1.10-alpha-dev</em:version>
<em:homepageURL>https://torbutton.torproject.org/dev/</em:homepageURL>
<em:optionsURL>chrome://torbutton/content/preferences.xul</em:optionsURL>
<em:iconURL>chrome://torbutton/skin/tor.png</em:iconURL>
More information about the tor-commits
mailing list