Open Bug 1491840 Opened 6 years ago Updated 10 months ago

PopupNotifications doesn't handle anchors outside the iconbox very well

Categories

(Toolkit :: PopupNotifications and Notification Bars, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: nhnt11, Unassigned)

References

Details

(Whiteboard: [doorhanger])

Attachments

(1 file, 2 obsolete files)

Basic support for this was added in bug 1130356 (which I've set this bug to block). While trying to implement a popup notification that anchors to a page-action item, I ran into some problems with the way the anchor/notifications are updated - the anchor doesn't get hidden properly when switching tabs.
getAnchorFromBrowser is completely unnecessary as far as I can tell, there are no existing consumers of its specialties. I've removed it in this patch.

This patch also fixes the way _update() handles icons - previously, it ONLY hid the icon box icons (before re-showing the relevant ones) IFF none of the currentNotifications had an anchor outside it. This means that if there was a notification with an anchor elsewhere, irrelevant icons would remain visible.

Now, icons are hidden in the TabSelect event handler, since that's the only place where we actually need to do it and where we have information about which icons we need to hide. _update() simply handles the *newly* selected tab's notifications.

https://treeherder.mozilla.org/#/jobs?repo=try&revision=fea0caa6fec970651c90b421f744c1ffb9d063c3
Attachment #9009660 - Attachment is obsolete: true
Attachment #9009964 - Attachment is obsolete: true
Comment on attachment 9009994 [details] [diff] [review]
Simplify anchorElement getter; hide previous tab's icons reliably

Review of attachment 9009994 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/modules/PopupNotifications.jsm
@@ -39,5 @@
>  
> -function getAnchorFromBrowser(aBrowser, aAnchorID) {
> -  let attrPrefix = aAnchorID ? aAnchorID.replace("notification-icon", "") : "";
> -  let anchor = aBrowser.getAttribute(attrPrefix + ICON_ANCHOR_ATTRIBUTE) ||
> -               aBrowser[attrPrefix + ICON_ANCHOR_ATTRIBUTE] ||

This is used by contextual feature recommender now.
Priority: -- → P3
Whiteboard: [doorhanger]

I've lost context.

Assignee: nhnt11 → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
Component: Notifications and Alerts → PopupNotifications and Notification Bars
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: