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

gitolite role git at cupani.torproject.org
Tue Apr 26 15:28:49 UTC 2022


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 at gmail.com>
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.


More information about the tor-commits mailing list