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

[tor-commits] [tor-browser] 129/311: Bug 1691202 - do not dismiss persistent CFR popups when navigating, r=Mardak, a=RyanVM



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit f6cdc29a289c53717f4a47ea54215ff9c2026721
Author: Gijs Kruitbosch <gijskruitbosch@xxxxxxxxx>
AuthorDate: Mon Mar 14 17:34:58 2022 +0000

    Bug 1691202 - do not dismiss persistent CFR popups when navigating, r=Mardak, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D140983
---
 browser/components/newtab/lib/CFRPageActions.jsm   | 25 ++++++++++++----------
 .../test/unit/asrouter/CFRPageActions.test.js      |  1 +
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/browser/components/newtab/lib/CFRPageActions.jsm b/browser/components/newtab/lib/CFRPageActions.jsm
index e5d79b41ba599..9e3f35a7cb23f 100644
--- a/browser/components/newtab/lib/CFRPageActions.jsm
+++ b/browser/components/newtab/lib/CFRPageActions.jsm
@@ -551,7 +551,8 @@ class PageAction {
     );
     const { primary, secondary } = content.buttons;
     let primaryActionCallback;
-    let options = { persistent: !!content.persistent_doorhanger };
+    let persistent = !!content.persistent_doorhanger;
+    let options = { persistent, persistWhileVisible: persistent };
     let panelTitle;
 
     headerLabel.value = await this.getStrings(content.heading_text);
@@ -851,16 +852,18 @@ const CFRPageActions = {
         // The browser has a recommendation specified with this host, so show
         // the page action
         pageAction.showAddressBarNotifier(recommendation);
-      } else if (recommendation.retain) {
-        // Keep the recommendation first time the user navigates away just in
-        // case they will go back to the previous page
-        pageAction.hideAddressBarNotifier();
-        recommendation.retain = false;
-      } else {
-        // The user has navigated away from the specified host in the given
-        // browser, so the recommendation is no longer valid and should be removed
-        RecommendationMap.delete(browser);
-        pageAction.hideAddressBarNotifier();
+      } else if (!recommendation.content.persistent_doorhanger) {
+        if (recommendation.retain) {
+          // Keep the recommendation first time the user navigates away just in
+          // case they will go back to the previous page
+          pageAction.hideAddressBarNotifier();
+          recommendation.retain = false;
+        } else {
+          // The user has navigated away from the specified host in the given
+          // browser, so the recommendation is no longer valid and should be removed
+          RecommendationMap.delete(browser);
+          pageAction.hideAddressBarNotifier();
+        }
       }
     } else {
       // There's no recommendation specified for this browser, so hide the page action
diff --git a/browser/components/newtab/test/unit/asrouter/CFRPageActions.test.js b/browser/components/newtab/test/unit/asrouter/CFRPageActions.test.js
index 5dbc855aaed4a..f44a259be8aed 100644
--- a/browser/components/newtab/test/unit/asrouter/CFRPageActions.test.js
+++ b/browser/components/newtab/test/unit/asrouter/CFRPageActions.test.js
@@ -727,6 +727,7 @@ describe("CFRPageActions", () => {
             hideClose: true,
             eventCallback: pageAction._popupStateChange,
             persistent: false,
+            persistWhileVisible: false,
           }
         );
       });

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits