diff --git a/browser/base/content/browser-social.js b/browser/base/content/browser-social.js index 659592d6afa1..894a28a22a0a 100644 --- a/browser/base/content/browser-social.js +++ b/browser/base/content/browser-social.js @@ -1366,6 +1366,7 @@ SocialSidebar = { // Make sure the right sidebar URL is loaded if (sbrowser.getAttribute("src") != Social.provider.sidebarURL) { sbrowser.setAttribute("src", Social.provider.sidebarURL); + PopupNotifications.locationChange(sbrowser); } // if the document has not loaded, delay until it is diff --git a/toolkit/modules/PopupNotifications.jsm b/toolkit/modules/PopupNotifications.jsm index 54a23d6ae112..dcae3b1fc0ca 100644 --- a/toolkit/modules/PopupNotifications.jsm +++ b/toolkit/modules/PopupNotifications.jsm @@ -21,6 +21,18 @@ const PREF_SECURITY_DELAY = "security.notification_enable_delay"; let popupNotificationsMap = new WeakMap(); let gNotificationParents = new WeakMap; +function getAnchorFromBrowser(aBrowser) { + let anchor = aBrowser.getAttribute("popupnotificationanchor") || + aBrowser.popupnotificationanchor; + if (anchor) { + if (anchor instanceof Ci.nsIDOMXULElement) { + return anchor; + } + return aBrowser.ownerDocument.getElementById(anchor); + } + return null; +} + /** * Notification object describes a single popup notification. * @@ -60,16 +72,7 @@ Notification.prototype = { get anchorElement() { let iconBox = this.owner.iconBox; - let anchorElement = null; - let anchor = this.browser.getAttribute("popupnotificationanchor") || - this.browser.popupnotificationanchor; - if (anchor) { - if (anchor instanceof Ci.nsIDOMXULElement) { - anchorElement = anchor; - } else { - anchorElement = this.browser.ownerDocument.getElementById(anchor); - } - } + let anchorElement = getAnchorFromBrowser(this.browser); if (!iconBox) return anchorElement; @@ -344,8 +347,15 @@ PopupNotifications.prototype = { this._setNotificationsForBrowser(aBrowser, notifications); - if (aBrowser.docShell.isActive) - this._update(notifications); + if (aBrowser.docShell.isActive) { + // get the anchor element if the browser has defined one so it will + // _update will handle both the tabs iconBox and non-tab permission + // anchors. + let anchorElement = notifications.length > 0 ? notifications[0].anchorElement : null; + if (!anchorElement) + anchorElement = getAnchorFromBrowser(aBrowser); + this._update(notifications, anchorElement); + } }, /**