commit 2978978e64fbc9164185564a19d56d5fea0b25d8
Author: Arthur Edelstein <arthuredelst...@gmail.com>
Date:   Tue Oct 4 23:37:19 2016 +0000

    Bug 20244.3: Remove 'restrict third party cookies...' checkbox
    
    Also, we remove the 'extensions.torbutton.restrict_thirdparty'
    and use the 'privacy.thirdparty.isolate' pref. At the same time we
    will need to add a checkbox to the about:preferences#privacy page
    that toggles 'privacy.thirdparty.isolate'.
    
    Note that 'privacy.thirdparty.isolate' will be renamed to
    'privacy.firstparty.isolate' in Firefox 52.
---
 src/chrome/content/preferences.js       |  2 --
 src/chrome/content/preferences.xul      |  3 ---
 src/chrome/content/torbutton.js         | 25 +++++++++----------------
 src/defaults/preferences/preferences.js |  1 -
 4 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/src/chrome/content/preferences.js 
b/src/chrome/content/preferences.js
index ad166eb..b14309d 100644
--- a/src/chrome/content/preferences.js
+++ b/src/chrome/content/preferences.js
@@ -14,7 +14,6 @@ function torbutton_prefs_init(doc) {
 
     // Privacy and security settings
     doc.getElementById('torbutton_resistFingerprinting').checked = 
o_torprefs.getBoolPref('resist_fingerprinting');
-    doc.getElementById('torbutton_restrictThirdParty').checked = 
o_torprefs.getBoolPref('restrict_thirdparty');
     let sec_slider = doc.getElementById('torbutton_sec_slider');
     let sec_custom = doc.getElementById('torbutton_sec_custom');
     let custom_values = o_torprefs.getBoolPref('security_custom');
@@ -46,7 +45,6 @@ function torbutton_prefs_save(doc) {
     // Privacy and Security Settings
 
     o_torprefs.setBoolPref('resist_fingerprinting', 
doc.getElementById('torbutton_resistFingerprinting').checked);
-    o_torprefs.setBoolPref('restrict_thirdparty', 
doc.getElementById('torbutton_restrictThirdParty').checked);
     o_torprefs.setBoolPref('security_custom',
                            doc.getElementById('torbutton_sec_custom').checked);
     o_torprefs.setIntPref('security_slider',
diff --git a/src/chrome/content/preferences.xul 
b/src/chrome/content/preferences.xul
index 1f64d09..b54d799 100644
--- a/src/chrome/content/preferences.xul
+++ b/src/chrome/content/preferences.xul
@@ -23,9 +23,6 @@
         <groupbox>
           <caption label="&torbutton.prefs.priv_caption;"
                    tooltiptext="&torbutton.prefs.priv_caption_tooltip;"/>
-          <checkbox id="torbutton_restrictThirdParty"
-                    label="&torbutton.prefs.restrict_thirdparty;"
-                    
tooltiptext="&torbutton.prefs.restrict_thirdparty_tooltip;"/>
           <checkbox id="torbutton_resistFingerprinting"
                     label="&torbutton.prefs.resist_fingerprinting;"
                     
tooltiptext="&torbutton.prefs.resist_fingerprinting_tooltip;"/>
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 9151b8a..d768a9f 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -96,6 +96,7 @@ var torbutton_unique_pref_observer =
         this._branch.addObserver("mathml", this, false);
         this._branch.addObserver("svg", this, false);
         this._branch.addObserver("plugin.disable", this, false);
+        this._branch.addObserver("privacy.thirdparty.isolate", this, false);
 
         // We observe xpcom-category-entry-added for plugins w/ 
Gecko-Content-Viewers
         var observerService = Cc["@mozilla.org/observer-service;1"].
@@ -156,11 +157,11 @@ var torbutton_unique_pref_observer =
         switch (data) {
             case "network.cookie.cookieBehavior":
                 var val = 
m_tb_prefs.getIntPref("network.cookie.cookieBehavior");
-                var block_thirdparty = 
m_tb_prefs.getBoolPref("extensions.torbutton.restrict_thirdparty");
+                var block_thirdparty = 
m_tb_prefs.getIntPref("privacy.thirdparty.isolate") !== 0;
                 if (val == 0 && block_thirdparty) // Allow all cookies
-                  
m_tb_prefs.setBoolPref("extensions.torbutton.restrict_thirdparty", false);
+                  m_tb_prefs.setIntPref("privacy.thirdparty.isolate", 0);
                 else if (val == 1 && !block_thirdparty) // Block third party 
cookies
-                  
m_tb_prefs.setBoolPref("extensions.torbutton.restrict_thirdparty", true);
+                  m_tb_prefs.setIntPref("privacy.thirdparty.isolate", 2);
                 break;
 
             case "plugin.disable":
@@ -177,7 +178,7 @@ var torbutton_unique_pref_observer =
             case "extensions.torbutton.spoof_english":
                 torbutton_update_fingerprinting_prefs();
                 break;
-            case "extensions.torbutton.restrict_thirdparty":
+            case "privacy.thirdparty.isolate":
                 torbutton_update_thirdparty_prefs();
                 break;
             case "extensions.torbutton.hide_sync_ui":
@@ -1803,24 +1804,16 @@ function torbutton_update_fingerprinting_prefs() {
 }
 
 function torbutton_update_thirdparty_prefs() {
-    var mode = 
m_tb_prefs.getBoolPref("extensions.torbutton.restrict_thirdparty");
+    let isolate = m_tb_prefs.getIntPref("privacy.thirdparty.isolate") !== 0;
 
-    try {
-        if (mode) {
-            m_tb_prefs.setIntPref("privacy.thirdparty.isolate", 2);
-        } else {
-            m_tb_prefs.setIntPref("privacy.thirdparty.isolate", 0);
-        }
-    } catch(e) {}
-
-    if (mode) {
+    if (isolate) {
       m_tb_prefs.setIntPref("network.cookie.cookieBehavior", 1);
     } else {
       m_tb_prefs.setIntPref("network.cookie.cookieBehavior", 0);
     }
 
-    m_tb_prefs.setBoolPref("dom.workers.sharedWorkers.enabled", !mode);
-    m_tb_prefs.setBoolPref("security.enable_tls_session_tickets", !mode);
+    m_tb_prefs.setBoolPref("dom.workers.sharedWorkers.enabled", !isolate);
+    m_tb_prefs.setBoolPref("security.enable_tls_session_tickets", !isolate);
 
     // Force prefs to be synced to disk
     var prefService = Components.classes["@mozilla.org/preferences-service;1"]
diff --git a/src/defaults/preferences/preferences.js 
b/src/defaults/preferences/preferences.js
index 5d056f4..b9a6584 100644
--- a/src/defaults/preferences/preferences.js
+++ b/src/defaults/preferences/preferences.js
@@ -45,7 +45,6 @@ pref("extensions.torbutton.launch_warning",true);
 pref("extensions.torbut...@torproject.org.getAddons.cache.enabled", false);
 
 pref("extensions.torbutton.resist_fingerprinting", true);
-pref("extensions.torbutton.restrict_thirdparty", true);
 
 // Security Slider
 pref("extensions.torbutton.security_slider", 4);



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

Reply via email to