[or-cvs] r18779: {torbutton} Fix bug #909 and bump xpi version. (in torbutton/trunk/src: . chrome/content)
mikeperry at seul.org
mikeperry at seul.org
Thu Mar 5 11:06:52 UTC 2009
Author: mikeperry
Date: 2009-03-05 06:06:52 -0500 (Thu, 05 Mar 2009)
New Revision: 18779
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
torbutton/trunk/src/install.rdf
Log:
Fix bug #909 and bump xpi version.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2009-03-05 11:06:17 UTC (rev 18778)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2009-03-05 11:06:52 UTC (rev 18779)
@@ -66,6 +66,7 @@
this._branch = pref_service.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
this._branch.addObserver("extensions.torbutton", this, false);
this._branch.addObserver("network.proxy", this, false);
+ this._branch.addObserver("network.cookie", this, false);
},
unregister: function()
@@ -73,6 +74,7 @@
if (!this._branch) return;
this._branch.removeObserver("extensions.torbutton", this);
this._branch.removeObserver("network.proxy", this);
+ this._branch.removeObserver("network.cookie", this);
},
// topic: what event occurred
@@ -100,6 +102,21 @@
torbutton_set_status();
break;
+ case "network.cookie.lifetimePolicy":
+ // Keep our prefs in sync with the lifetime policy for non-tor
+ torbutton_log(2, "Got FF cookie pref change");
+ var tor_mode = m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled");
+ var lp = m_tb_prefs.getIntPref("network.cookie.lifetimePolicy");
+
+ if(!tor_mode && lp == 2 &&
+ !m_tb_prefs.getBoolPref("extensions.torbutton.nontor_memory_jar")) {
+ m_tb_prefs.setBoolPref("extensions.torbutton.nontor_memory_jar", true);
+ } else if (!tor_mode && lp == 0 &&
+ m_tb_prefs.getBoolPref("extensions.torbutton.nontor_memory_jar")) {
+ m_tb_prefs.setBoolPref("extensions.torbutton.nontor_memory_jar", false);
+ }
+ break;
+
case "extensions.torbutton.tor_memory_jar":
case "extensions.torbutton.nontor_memory_jar":
case "extensions.torbutton.dual_cookie_jars":
@@ -107,27 +124,32 @@
case "extensions.torbutton.clear_cookies":
torbutton_log(2, "Got cookie pref change");
var tor_mode = m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled");
+ var lp = m_tb_prefs.getIntPref("network.cookie.lifetimePolicy");
if(m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
} else if(m_tb_prefs.getBoolPref('extensions.torbutton.cookie_jars')) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", tor_mode ? 2 : 0);
+ lp = tor_mode ? 2 : 0;
} else if(m_tb_prefs.getBoolPref("extensions.torbutton.dual_cookie_jars")) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 0);
+ lp = 0;
} else {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 0);
+ lp = 0;
}
if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar')
&& tor_mode) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
}
if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar')
&& !tor_mode) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
}
+ if(lp != m_tb_prefs.getIntPref("network.cookie.lifetimePolicy")) {
+ m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", lp);
+ }
+
break;
// These two are set from the Torbutton crash-observer component
@@ -1123,24 +1145,29 @@
auth.clearAll();
}
+ var lp = m_tb_prefs.getIntPref("network.cookie.lifetimePolicy");
+
if(m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
} else if(m_tb_prefs.getBoolPref('extensions.torbutton.cookie_jars')) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", mode ? 2 : 0);
+ lp = mode ? 2 : 0;
} else if(m_tb_prefs.getBoolPref("extensions.torbutton.dual_cookie_jars")) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 0);
+ lp = 0;
}
/* Don't write cookies to disk no matter what if memory jars are enabled
* for this mode. */
if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar') && mode) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
}
if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar') && !mode) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", 2);
+ lp = 2;
}
+ if(lp != m_tb_prefs.getIntPref("network.cookie.lifetimePolicy")) {
+ m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", lp);
+ }
if (m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
torbutton_clear_cookies();
Modified: torbutton/trunk/src/install.rdf
===================================================================
--- torbutton/trunk/src/install.rdf 2009-03-05 11:06:17 UTC (rev 18778)
+++ torbutton/trunk/src/install.rdf 2009-03-05 11:06:52 UTC (rev 18779)
@@ -6,7 +6,7 @@
<em:name>Torbutton</em:name>
<em:creator>Mike Perry & Scott Squires</em:creator>
<em:id>{e0204bd5-9d31-402b-a99d-a6aa8ffebdca}</em:id>
- <em:version>1.2.0</em:version>
+ <em:version>1.2.0-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>
@@ -18,7 +18,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>2.0</em:minVersion>
- <em:maxVersion>3.1a1pre</em:maxVersion>
+ <em:maxVersion>3.2a1pre</em:maxVersion>
</Description>
</em:targetApplication>
More information about the tor-commits
mailing list