[tbb-commits] [torbutton/master] Bug 31598: Disable warning on window resize if letterboxing is enabled

gk at torproject.org gk at torproject.org
Thu Sep 5 07:14:31 UTC 2019


commit 1edfec57049a76052fda8eb17b6e3b8f281e3361
Author: Alex Catarineu <acat at torproject.org>
Date:   Wed Sep 4 11:38:45 2019 +0200

    Bug 31598: Disable warning on window resize if letterboxing is enabled
---
 chrome/content/torbutton.js         | 14 ++++++++------
 defaults/preferences/preferences.js |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/chrome/content/torbutton.js b/chrome/content/torbutton.js
index 6209b6b8..9d6a5c48 100644
--- a/chrome/content/torbutton.js
+++ b/chrome/content/torbutton.js
@@ -92,6 +92,7 @@ var torbutton_unique_pref_observer =
         m_tb_prefs.addObserver("plugin.disable", this, false);
         m_tb_prefs.addObserver("privacy.firstparty.isolate", this, false);
         m_tb_prefs.addObserver("privacy.resistFingerprinting", this, false);
+        m_tb_prefs.addObserver("privacy.resistFingerprinting.letterboxing", this, false);
 
         // We observe xpcom-category-entry-added for plugins w/ Gecko-Content-Viewers
         var observerService = Services.obs;
@@ -107,6 +108,7 @@ var torbutton_unique_pref_observer =
         m_tb_prefs.removeObserver("plugin.disable", this);
         m_tb_prefs.removeObserver("privacy.firstparty.isolate", this);
         m_tb_prefs.removeObserver("privacy.resistFingerprinting", this);
+        m_tb_prefs.removeObserver("privacy.resistFingerprinting.letterboxing", this);
 
         var observerService = Services.obs;
         observerService.removeObserver(this, "xpcom-category-entry-added");
@@ -156,6 +158,7 @@ var torbutton_unique_pref_observer =
                 torbutton_use_nontor_proxy();
                 break;
             case "privacy.resistFingerprinting":
+            case "privacy.resistFingerprinting.letterboxing":
                 torbutton_update_fingerprinting_prefs();
                 break;
             case "privacy.firstparty.isolate":
@@ -1508,14 +1511,14 @@ function torbutton_update_disk_prefs() {
 
 function torbutton_update_fingerprinting_prefs() {
     var mode = m_tb_prefs.getBoolPref("privacy.resistFingerprinting");
+    var letterboxing = m_tb_prefs.getBoolPref("privacy.resistFingerprinting.letterboxing", false);
 
     m_tb_prefs.setBoolPref("webgl.disable-extensions", mode);
     m_tb_prefs.setBoolPref("dom.network.enabled", !mode);
     m_tb_prefs.setBoolPref("dom.enable_performance", !mode);
     m_tb_prefs.setBoolPref("plugin.expose_full_path", !mode);
     m_tb_prefs.setBoolPref("browser.zoom.siteSpecific", !mode);
-
-    m_tb_prefs.setBoolPref("extensions.torbutton.resize_new_windows", mode);
+    m_tb_prefs.setBoolPref("extensions.torbutton.resize_new_windows", mode && !letterboxing);
 
     // Force prefs to be synced to disk
     Services.prefs.savePrefFile(null);
@@ -1915,8 +1918,7 @@ function torbutton_new_window(event)
     let progress = Cc["@mozilla.org/docloaderservice;1"]
                      .getService(Ci.nsIWebProgress);
 
-    if (m_tb_prefs.getBoolPref("extensions.torbutton.resize_new_windows")
-            && torbutton_is_windowed(window)) {
+    if (torbutton_is_windowed(window)) {
       progress.addProgressListener(torbutton_resizelistener,
                                    Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
     }
@@ -1999,8 +2001,8 @@ var torbutton_resizelistener =
         await new Promise(resolve => setTimeout(resolve, 0));
         if (window.windowState === window.STATE_MAXIMIZED ||
             window.windowState === window.STATE_FULLSCREEN) {
-          if (m_tb_prefs.
-              getIntPref("extensions.torbutton.maximize_warnings_remaining") > 0) {
+          if (m_tb_prefs.getBoolPref("extensions.torbutton.resize_new_windows") &&
+              m_tb_prefs.getIntPref("extensions.torbutton.maximize_warnings_remaining") > 0) {
 
             // Do not add another notification if one is already showing.
             const kNotificationName = "torbutton-maximize-notification";
diff --git a/defaults/preferences/preferences.js b/defaults/preferences/preferences.js
index e5d66d55..acea0a3d 100644
--- a/defaults/preferences/preferences.js
+++ b/defaults/preferences/preferences.js
@@ -30,7 +30,7 @@ pref("extensions.torbutton.cookie_protections",true);
 pref("extensions.torbutton.cookie_auto_protect",false);
 pref("extensions.torbutton.clear_http_auth",true);
 pref("extensions.torbutton.close_newnym",true);
-pref("extensions.torbutton.resize_new_windows",true);
+pref("extensions.torbutton.resize_new_windows",false);
 pref("extensions.torbutton.startup_state", 2); // 0=non-tor, 1=tor, 2=last
 pref("extensions.torbutton.tor_memory_jar",false);
 pref("extensions.torbutton.nontor_memory_jar",false);



More information about the tbb-commits mailing list