[or-cvs] r10654: Added radio buttons to set good defaults for Private Data cl (in torbutton/trunk/src: chrome/content chrome/locale/en-US defaults/preferences)

mikeperry at seul.org mikeperry at seul.org
Wed Jun 20 06:13:47 UTC 2007


Author: mikeperry
Date: 2007-06-20 02:13:46 -0400 (Wed, 20 Jun 2007)
New Revision: 10654

Modified:
   torbutton/trunk/src/chrome/content/preferences.js
   torbutton/trunk/src/chrome/content/preferences.xul
   torbutton/trunk/src/chrome/content/torbutton.js
   torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
   torbutton/trunk/src/defaults/preferences/preferences.js
Log:

Added radio buttons to set good defaults for Private Data
clearing if Tor is enabled during browser shutdown. The idea
is to have some automatic mechanism for regularly clearing
cookies for people who use Tor all the time and rarely turn
it off.



Modified: torbutton/trunk/src/chrome/content/preferences.js
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.js	2007-06-20 06:04:00 UTC (rev 10653)
+++ torbutton/trunk/src/chrome/content/preferences.js	2007-06-20 06:13:46 UTC (rev 10654)
@@ -159,6 +159,18 @@
         o_torprefs.setBoolPref('cookie_jars', false);
         o_torprefs.setBoolPref('clear_cookies', false); 
     }
+    
+    if(o_torprefs.getIntPref('shutdown_method') == 0) {
+        doc.getElementById('torbutton_shutdownGroup').selectedItem
+            = doc.getElementById('torbutton_noShutdown');
+    } else if(o_torprefs.getIntPref('shutdown_method') == 1) {
+        doc.getElementById('torbutton_shutdownGroup').selectedItem
+            = doc.getElementById('torbutton_torShutdown');
+    } else {
+        o_torprefs.setIntPref('shutdown_method', 2); 
+        doc.getElementById('torbutton_shutdownGroup').selectedItem
+            = doc.getElementById('torbutton_allShutdown');
+    }
 
     doc.getElementById('torbutton_blockTorHRead').checked = o_torprefs.getBoolPref('block_thread');
     doc.getElementById('torbutton_blockTorHWrite').checked = o_torprefs.getBoolPref('block_thwrite');
@@ -168,6 +180,7 @@
     doc.getElementById('torbutton_noSearch').checked = o_torprefs.getBoolPref('no_search');
     doc.getElementById('torbutton_noUpdates').checked = o_torprefs.getBoolPref('no_updates');
     doc.getElementById('torbutton_setUagent').checked = o_torprefs.getBoolPref('set_uagent');
+    
 
     torbutton_prefs_set_field_attributes(doc);
 }
@@ -215,7 +228,18 @@
     o_torprefs.setBoolPref('block_cache', doc.getElementById('torbutton_blockCache').selected);
     o_torprefs.setBoolPref('clear_cookies', doc.getElementById('torbutton_clearCookies').selected);
     o_torprefs.setBoolPref('cookie_jars', doc.getElementById('torbutton_cookieJars').selected);
-    
+
+
+    if(doc.getElementById('torbutton_shutdownGroup').selectedItem ==
+            doc.getElementById('torbutton_noShutdown')) {
+        o_torprefs.setIntPref('shutdown_method', 0); 
+    } else if(doc.getElementById('torbutton_shutdownGroup').selectedItem ==
+            doc.getElementById('torbutton_torShutdown')) {
+        o_torprefs.setIntPref('shutdown_method', 1); 
+    } else {
+        o_torprefs.setIntPref('shutdown_method', 2); 
+    }
+
     o_torprefs.setBoolPref('block_thread', doc.getElementById('torbutton_blockTorHRead').checked);
     o_torprefs.setBoolPref('block_thwrite', doc.getElementById('torbutton_blockTorHWrite').checked);
     o_torprefs.setBoolPref('block_nthread', doc.getElementById('torbutton_blockNonTorHRead').checked);

Modified: torbutton/trunk/src/chrome/content/preferences.xul
===================================================================
--- torbutton/trunk/src/chrome/content/preferences.xul	2007-06-20 06:04:00 UTC (rev 10653)
+++ torbutton/trunk/src/chrome/content/preferences.xul	2007-06-20 06:13:46 UTC (rev 10654)
@@ -115,9 +115,10 @@
         <tabbox>
          <tabs>
           <tab label="&torbutton.prefs.dynamic;"/>
+          <tab label="&torbutton.prefs.history;"/>
+          <tab label="&torbutton.prefs.cache;"/>
           <tab label="&torbutton.prefs.cookies;"/>
-          <tab label="&torbutton.prefs.cache;"/>
-          <tab label="&torbutton.prefs.history;"/>
+          <tab label="&torbutton.prefs.shutdown;"/>
           <tab label="&torbutton.prefs.uagent;"/>
          </tabs>
          <tabpanels>
@@ -135,18 +136,18 @@
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </vbox>
           </tabpanel>
-          <tabpanel id="cookies">
+          <tabpanel id="history">
            <vbox>
-            <radiogroup id="torbutton_cookieGroup">
-             <radio id="torbutton_clearCookies"
-                    label="&torbutton.prefs.clear_cookies;" 
-                    oncommand="torbutton_prefs_set_field_attributes(document)"/>             
-			<radio id="torbutton_cookieJars"
-                    label="&torbutton.prefs.cookie_jars;" 
-                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
-   			<radio id="torbutton_mmmCookies"
-                    label="&torbutton.prefs.mmm_cookies;" 
-                    oncommand="torbutton_prefs_set_field_attributes(document)"/>          </radiogroup>
+          <checkbox id="torbutton_blockTorHRead" label="&torbutton.prefs.block_thread;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+          <checkbox id="torbutton_blockTorHWrite" label="&torbutton.prefs.block_thwrite;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+          <checkbox id="torbutton_blockNonTorHRead" label="&torbutton.prefs.block_nthread;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+          <checkbox id="torbutton_blockNonTorHWrite" label="&torbutton.prefs.block_nthwrite;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+          <checkbox id="torbutton_clearHistory" label="&torbutton.prefs.clear_history;" 
+                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </vbox>
           </tabpanel>
           <tabpanel id="cache">
@@ -161,27 +162,42 @@
             </radiogroup>
            </vbox>
           </tabpanel>
-          <tabpanel id="history">
+          <tabpanel id="cookies">
            <vbox>
-          <checkbox id="torbutton_blockTorHRead" label="&torbutton.prefs.block_thread;" 
-                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
-          <checkbox id="torbutton_blockTorHWrite" label="&torbutton.prefs.block_thwrite;" 
-                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
-          <checkbox id="torbutton_blockNonTorHRead" label="&torbutton.prefs.block_nthread;" 
-                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
-          <checkbox id="torbutton_blockNonTorHWrite" label="&torbutton.prefs.block_nthwrite;" 
-                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
-          <checkbox id="torbutton_clearHistory" label="&torbutton.prefs.clear_history;" 
-                  oncommand="torbutton_prefs_set_field_attributes(document)"/>
+            <radiogroup id="torbutton_cookieGroup">
+             <radio id="torbutton_clearCookies"
+                    label="&torbutton.prefs.clear_cookies;" 
+                    oncommand="torbutton_prefs_set_field_attributes(document)"/>             
+            <radio id="torbutton_cookieJars"
+                    label="&torbutton.prefs.cookie_jars;" 
+                    oncommand="torbutton_prefs_set_field_attributes(document)"/>
+            <radio id="torbutton_mmmCookies"
+                    label="&torbutton.prefs.mmm_cookies;" 
+                    oncommand="torbutton_prefs_set_field_attributes(document)"/> 
+            </radiogroup>
            </vbox>
           </tabpanel>
+          <tabpanel id="shutdown">
+           <vbox>
+            <radiogroup id="torbutton_shutdownGroup">
+             <radio id="torbutton_noShutdown" 
+                   label="&torbutton.prefs.no_shutdown;" 
+                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
+             <radio id="torbutton_torShutdown" 
+                   label="&torbutton.prefs.tor_shutdown;" 
+                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
+             <radio id="torbutton_allShutdown" 
+                   label="&torbutton.prefs.all_shutdown;" 
+                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
+            </radiogroup>
+           </vbox>
+          </tabpanel>
           <tabpanel id="uagent">
            <vbox>
           <checkbox id="torbutton_setUagent" label="&torbutton.prefs.set_uagent;" 
                   oncommand="torbutton_prefs_set_field_attributes(document)"/>
            </vbox>
           </tabpanel>
-
          </tabpanels>
         </tabbox>
     </groupbox>

Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2007-06-20 06:04:00 UTC (rev 10653)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2007-06-20 06:13:46 UTC (rev 10654)
@@ -68,6 +68,7 @@
             case "extensions.torbutton.set_uagent":
             case "extensions.torbutton.block_nthwrite":
             case "extensions.torbutton.block_thwrite":
+            case "extensions.torbutton.shutdown_method":
                 torbutton_update_status(
                         m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled"),
                         true);
@@ -416,6 +417,11 @@
     torbutton_update_toolbutton(mode);
     torbutton_update_statusbar(mode);
 
+    // this function is called every time there is a new window! Alot of this
+    // stuff expects to be called on toggle only.. like the cookie jars and
+    // history/cookie clearing
+    if(!changed && !force_update) return;
+
     torbutton_log(2, 'Setting user agent');
     if(torprefs.getBoolPref("set_uagent")) {
         if(mode) {
@@ -457,13 +463,18 @@
     
     torbutton_log(2, 'Done with user agent: '+changed);
 
-    // this function is called every time there is a new window! Alot of this
-    // stuff expects to be called on toggle only.. like the cookie jars and
-    // history/cookie clearing
-    if(!changed && !force_update) return;
+    if(torprefs.getIntPref("shutdown_method") == 1) {
+        // clear cookies on shutdown only if tor is enabled.
+        m_tb_prefs.setBoolPref("privacy.item.cookies", true);
+        m_tb_prefs.setBoolPref("privacy.sanitize.promptOnSanitize", false);
+        m_tb_prefs.setBoolPref("privacy.sanitize.sanitizeOnShutdown", mode);
+    } else if(torprefs.getIntPref("shutdown_method") == 2) {
+        // clear cookies on shutdown always
+        m_tb_prefs.setBoolPref("privacy.item.cookies", true);
+        m_tb_prefs.setBoolPref("privacy.sanitize.promptOnSanitize", false);
+        m_tb_prefs.setBoolPref("privacy.sanitize.sanitizeOnShutdown", true);
+    }
 
-    // TODO: store user settings for these groups 
-    //      - never enable them if user wants them off.
     if (torprefs.getBoolPref("no_updates")) {
         m_tb_prefs.setBoolPref("extensions.update.enabled", !mode);
         m_tb_prefs.setBoolPref("app.update.enabled", !mode);

Modified: torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd
===================================================================
--- torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-06-20 06:04:00 UTC (rev 10653)
+++ torbutton/trunk/src/chrome/locale/en-US/torbutton.dtd	2007-06-20 06:13:46 UTC (rev 10654)
@@ -36,6 +36,10 @@
 <!ENTITY torbutton.prefs.history             "History">
 <!ENTITY torbutton.prefs.uagent              "User Agent">
 <!ENTITY torbutton.prefs.no_search           "Disable search suggestions during Tor (optional)">
+<!ENTITY torbutton.prefs.shutdown              "Shutdown">
+<!ENTITY torbutton.prefs.tor_shutdown          "Clear cookies during Tor-enabled browser shutdown">
+<!ENTITY torbutton.prefs.all_shutdown          "Clear cookies during any browser shutdown">
+<!ENTITY torbutton.prefs.no_shutdown           "Let me manage my own Private Data settings">
 <!ENTITY torbutton.about.title                          "About Torbutton">
 <!ENTITY torbutton.pref_connection.notice               "Disable Torbutton to change these settings.">
 <!ENTITY torbutton.pref_connection.more_info            "More information">

Modified: torbutton/trunk/src/defaults/preferences/preferences.js
===================================================================
--- torbutton/trunk/src/defaults/preferences/preferences.js	2007-06-20 06:04:00 UTC (rev 10653)
+++ torbutton/trunk/src/defaults/preferences/preferences.js	2007-06-20 06:13:46 UTC (rev 10654)
@@ -55,6 +55,7 @@
 pref("extensions.torbutton.isolate_content",true);
 pref("extensions.torbutton.no_search",true);
 pref("extensions.torbutton.set_uagent",true);
+pref("extensions.torbutton.shutdown_method",1); // 0=none, 1=tor, 2=all
 
 // Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
 pref("extensions.torbutton.appname_override","Netscape");



More information about the tor-commits mailing list