[tor-commits] [torbutton/maint-1.9.5] Bug 19906: "Maximizing Tor Browser" Notification can exist multiple times

gk at torproject.org gk at torproject.org
Mon Aug 15 09:50:06 UTC 2016


commit 6e88f9cd13bd70e1626a912c789b146f07e88f33
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 9f6233c..3256335 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -3371,6 +3371,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();
@@ -3392,7 +3398,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,
@@ -3409,9 +3414,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 tor-commits mailing list