This actually isn't a duplicate, and it's not fixed by `persistent_doorhanger`. I think this is actually a bug in PopupNotifications, because [it says](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#424-428) `persistent` "will always persist even across tab and app changes", yet it does not. The reason being that [it calls _update on TabSelect events](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#792), and that method [checks which notifications to show](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#1382) - [based on the current browser](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#812). And since the notification is initialized for only one specific browser (the tab that was selected when the cookiebannerdetected event fired), that check will produce an empty array when the tab is changed. Which means `persistent` is a misnomer, it does not persist across tab changes.
Bug 1815708 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
This actually isn't a duplicate, and it's not fixed by `persistent_doorhanger`. I think this is actually a bug in PopupNotifications, because [it says](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#424-428) `persistent` "will always persist even across tab and app changes", yet it does not. The reason being that [it calls _update on TabSelect events](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#792), and that method [checks which notifications to show](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#1382) - [based on the current browser](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/toolkit/modules/PopupNotifications.sys.mjs#812). And since the notification is initialized for only one specific browser (the tab that was selected when the cookiebannerdetected event fired), that check will produce an empty array when the tab is changed. Which means `persistent` is a misnomer, it does not persist across tab changes. Edit: Okay, I think I figured out what's going on. When it says "persistent," it doesn't mean that the panel will stay open. It means the panel will close but will reopen when the mapped browser is selected again. If you do this in the browser console, you can see what I mean: ```js PopupNotifications.show( gBrowser.selectedBrowser, "addon-install-confirmation", "firefox", gUnifiedExtensions.getPopupAnchorID(gBrowser.selectedBrowser, window), { label: gNavigatorBundle.getString("addonInstall.acceptButton2.label"), accessKey: gNavigatorBundle.getString( "addonInstall.acceptButton2.accesskey" ), callback: () => {}, }, [], { persistent: true, hideClose: true, popupOptions: { position: "bottomright topright", }, } ) ``` But in this case, it's not getting reopened, because [we remove the notification](https://searchfox.org/mozilla-central/rev/d85572c1963f72e8bef2787d900e0a8ffd8e6728/browser/components/newtab/lib/CFRPageActions.jsm#190) on location changes without checking if it's persistent. So one issue is that we're basically making CFRs non-persistent on our own, by removing them on tab/location changes. And a simple fix for that would be to leave persistent notifications alone until they are removed by PageActions. Basically, we would not call PopupNotifications.remove, we'd let it remove notifications when they're dismissed, and remove them from the notification map when that happens. But that doesn't really fix this issue, because comment 0 says these doorhangers should stay open across tab switches. So, we don't really want persistence as it's currently implemented in PopupNotifications. We want doorhangers that are simply never closed. But I think this is difficult to implement with the PopupNotifications system, because it stores notifications in a structure like `Map<browser, notification>`. I think if we want popups that aren't tied to any particular tab, it's probably better to do this with a different messaging surface.