[tbb-commits] [torbutton/master] Bug 19906: "Maximizing Tor Browser" Notification can exist multiple times

gk at torproject.org gk at torproject.org
Mon Aug 15 09:49:11 UTC 2016


commit 808ed83b2fa89ea7865b5bad6a2f287922e88702
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Fri Aug 12 09:44:59 2016 -0400

    Bug 19906: "Maximizing Tor Browser" Notification can exist multiple times
    
    Do not add another notification if one is already visible.
---
 src/chrome/content/torbutton.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 7160deb..81f5a23 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -3280,6 +3280,12 @@ var torbutton_resizelistener =
           if (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";
+            let box = gBrowser.getNotificationBox();
+            if (box.getNotificationWithValue(kNotificationName))
+              return;
+
             // Rate-limit showing our notification if needed.
             if (m_tb_resize_date === null) {
               m_tb_resize_date = Date.now();
@@ -3301,7 +3307,6 @@ var torbutton_resizelistener =
             let bundle = sbSvc.
               createBundle("chrome://global/locale/commonDialogs.properties");
             let button_label = bundle.GetStringFromName("OK");
-            let box = gBrowser.getNotificationBox();
 
             let buttons = [{
               label: button_label,
@@ -3318,9 +3323,8 @@ var torbutton_resizelistener =
             let message =
               torbutton_get_property_string("torbutton.maximize_warning");
 
-            box.appendNotification(message, 'new-menu-notification', null,
+            box.appendNotification(message, kNotificationName, null,
                                    priority, buttons);
-
             return;
           }
           // This is for some weird OS-specific behavior on start-up where,



More information about the tbb-commits mailing list