[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [torbutton/master] Clean up fingerprinting pref setting a bit.



commit d0caf2b4a32152922daf7425eb87ff9eb067e620
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date:   Wed Feb 13 18:15:30 2013 -0800

    Clean up fingerprinting pref setting a bit.
    
    Forgot to obey the spoof_english prompt, and we should use TBB defaults.
---
 src/chrome/content/torbutton.js |   32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 649cddf..620214f 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -154,6 +154,7 @@ var torbutton_unique_pref_observer =
                 torbutton_update_disk_prefs();
                 break;
             case "extensions.torbutton.resist_fingerprinting":
+            case "extensions.torbutton.spoof_english":
                 torbutton_update_fingerprinting_prefs();
                 break;
             case "extensions.torbutton.restrict_thirdparty":
@@ -1411,22 +1412,35 @@ function torbutton_update_fingerprinting_prefs() {
 
     if (m_tb_tbb) {
       if (mode) {
-        m_tb_prefs.setIntPref("browser.display.max_font_attempts",10);
-        m_tb_prefs.setIntPref("browser.display.max_font_count",5);
-
-        m_tb_prefs.setCharPref("intl.accept_languages", "en-us, en");
-        m_tb_prefs.setCharPref("intl.accept_charsets", "iso-8859-1,*,utf-8");
-        m_tb_prefs.setCharPref("intl.charsetmenu.browser.cache", "UTF-8");
+        // Use TBB pref defaults for these two.
+        if(m_tb_prefs.prefHasUserValue("browser.display.max_font_attempts"))
+          m_tb_prefs.clearUserPref("browser.display.max_font_attempts");
+        if(m_tb_prefs.prefHasUserValue("browser.display.max_font_count"))
+          m_tb_prefs.clearUserPref("browser.display.max_font_count");
+ 
+        // Governed also by the spoof_english dialog..       
+        if (m_tb_prefs.getBoolPref("extensions.torbutton.spoof_english")) {
+          m_tb_prefs.setCharPref("intl.accept_languages", "en-us, en");
+          m_tb_prefs.setCharPref("intl.accept_charsets", "iso-8859-1,*,utf-8");
+          m_tb_prefs.setCharPref("intl.charsetmenu.browser.cache", "UTF-8");
+        } else {
+          if(m_tb_prefs.prefHasUserValue("intl.accept_languages"))
+            m_tb_prefs.clearUserPref("intl.accept_languages");
+          if(m_tb_prefs.prefHasUserValue("intl.charsetmenu.browser.cache"))
+            m_tb_prefs.clearUserPref("intl.charsetmenu.browser.cache");
+          if(m_tb_prefs.prefHasUserValue("intl.accept_charsets"))
+            m_tb_prefs.clearUserPref("intl.accept_charsets");
+        }
       } else {
         m_tb_prefs.setIntPref("browser.display.max_font_attempts",-1);
         m_tb_prefs.setIntPref("browser.display.max_font_count",-1);
 
         if(m_tb_prefs.prefHasUserValue("intl.accept_languages"))
-            m_tb_prefs.clearUserPref("intl.accept_languages");
+          m_tb_prefs.clearUserPref("intl.accept_languages");
         if(m_tb_prefs.prefHasUserValue("intl.charsetmenu.browser.cache"))
-            m_tb_prefs.clearUserPref("intl.charsetmenu.browser.cache");
+          m_tb_prefs.clearUserPref("intl.charsetmenu.browser.cache");
         if(m_tb_prefs.prefHasUserValue("intl.accept_charsets"))
-            m_tb_prefs.clearUserPref("intl.accept_charsets");
+          m_tb_prefs.clearUserPref("intl.accept_charsets");
 
       }
     }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits