[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r18788: {torbutton} Attempt to fix the rest of bug 909: allow users to use the " (torbutton/trunk/src/chrome/content)
Author: mikeperry
Date: 2009-03-06 06:25:23 -0500 (Fri, 06 Mar 2009)
New Revision: 18788
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
Log:
Attempt to fix the rest of bug 909: allow users to use the
"Ask me every time" cookie lifetime option.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2009-03-06 09:48:47 UTC (rev 18787)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2009-03-06 11:25:23 UTC (rev 18788)
@@ -108,12 +108,38 @@
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);
+ if(!tor_mode) {
+ if(lp == 0 &&
+ m_tb_prefs.getBoolPref("extensions.torbutton.nontor_memory_jar")) {
+ m_tb_prefs.setBoolPref("extensions.torbutton.nontor_memory_jar", false);
+ } else if(lp == 1) {
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.tor_memory_jar', false);
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.nontor_memory_jar', false);
+ } else if(lp == 2 &&
+ !m_tb_prefs.getBoolPref("extensions.torbutton.nontor_memory_jar")) {
+ m_tb_prefs.setBoolPref("extensions.torbutton.nontor_memory_jar", true);
+ }
+ } else {
+ if(lp == 0) { // The cookie's lifetime is supplied by the server.
+ if(m_tb_prefs.getBoolPref("extensions.torbutton.clear_cookies"))
+ m_tb_prefs.setBoolPref("extensions.torbutton.clear_cookies", false);
+ if(m_tb_prefs.getBoolPref("extensions.torbutton.tor_memory_jar"))
+ m_tb_prefs.setBoolPref("extensions.torbutton.tor_memory_jar", false);
+ if(m_tb_prefs.getBoolPref("extensions.torbutton.cookie_jars"))
+ m_tb_prefs.setBoolPref("extensions.torbutton.cookie_jars", false);
+ if(!m_tb_prefs.getBoolPref("extensions.torbutton.dual_cookie_jars"))
+ m_tb_prefs.setBoolPref("extensions.torbutton.dual_cookie_jars", true);
+ } else if(lp == 1) { // The user is prompted for the cookie's lifetime.
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.tor_memory_jar', false);
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.nontor_memory_jar', false);
+ } else if(lp == 2 && // The cookie expires when the browser closes.
+ !m_tb_prefs.getBoolPref("extensions.torbutton.tor_memory_jar")) {
+ m_tb_prefs.setBoolPref("extensions.torbutton.tor_memory_jar", true);
+ }
}
break;
@@ -126,6 +152,15 @@
var tor_mode = m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled");
var lp = m_tb_prefs.getIntPref("network.cookie.lifetimePolicy");
+ if(lp == 1) {
+ torbutton_log(3, "Ignoring lifetime policy of 1 (ask user)");
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.tor_memory_jar', false);
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.nontor_memory_jar', false);
+ break;
+ }
+
if(m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
lp = 2;
} else if(m_tb_prefs.getBoolPref('extensions.torbutton.cookie_jars')) {
@@ -1147,26 +1182,34 @@
var lp = m_tb_prefs.getIntPref("network.cookie.lifetimePolicy");
- if(m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
- lp = 2;
- } else if(m_tb_prefs.getBoolPref('extensions.torbutton.cookie_jars')) {
- lp = mode ? 2 : 0;
- } else if(m_tb_prefs.getBoolPref("extensions.torbutton.dual_cookie_jars")) {
- lp = 0;
- }
+ if(lp == 1) {
+ torbutton_log(3, "Ignoring update lifetime policy of 1 (ask user)");
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.tor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.tor_memory_jar', false);
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar'))
+ m_tb_prefs.setBoolPref('extensions.torbutton.nontor_memory_jar', false);
+ } else {
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.clear_cookies')) {
+ lp = 2;
+ } else if(m_tb_prefs.getBoolPref('extensions.torbutton.cookie_jars')) {
+ lp = mode ? 2 : 0;
+ } else if(m_tb_prefs.getBoolPref("extensions.torbutton.dual_cookie_jars")) {
+ 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) {
- lp = 2;
- }
+ /* 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) {
+ lp = 2;
+ }
- if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar') && !mode) {
- lp = 2;
- }
+ if(m_tb_prefs.getBoolPref('extensions.torbutton.nontor_memory_jar') && !mode) {
+ lp = 2;
+ }
- if(lp != m_tb_prefs.getIntPref("network.cookie.lifetimePolicy")) {
- m_tb_prefs.setIntPref("network.cookie.lifetimePolicy", lp);
+ 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')) {