Bug 617553 - Doorhanger for add-on installation failures inside the AOM has no parent with chrome hidden [r=gavin, a=blocking]

This commit is contained in:
Margaret Leibovic 2011-01-18 14:57:40 -08:00
parent df3448dcd1
commit c85bd89f91
7 changed files with 54 additions and 1 deletions

View File

@ -480,6 +480,9 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
-moz-user-focus: normal;
}
/* We use the iconBox as the notification anchor when a popup notification is
created with a null anchorID, so in that case use a default anchor icon. */
#notification-popup-box[anchorid="notification-popup-box"] > #default-notification-icon,
#notification-popup-box[anchorid="geo-notification-icon"] > #geo-notification-icon,
#notification-popup-box[anchorid="indexedDB-notification-icon"] > #indexedDB-notification-icon,
#notification-popup-box[anchorid="addons-notification-icon"] > #addons-notification-icon,

View File

@ -543,6 +543,7 @@
onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
onblur="setTimeout(function() document.getElementById('identity-box').style.MozUserFocus = '', 0);">
<box id="notification-popup-box" hidden="true" align="center">
<image id="default-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="geo-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="addons-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="indexedDB-notification-icon" class="notification-anchor-icon" role="button"/>

View File

@ -22,6 +22,7 @@
* Gavin Sharp <gavin@gavinsharp.com>
* Sylvain Pasche <sylvain.pasche@gmail.com>
* Drew Willcoxon <adw@mozilla.com>
* Margaret Leibovic <margaret.leibovic@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -583,6 +584,32 @@ var tests = [
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
}
},
// Test notification when chrome is hidden
{ // Test #18
run: function () {
this.oldSelectedTab = gBrowser.selectedTab;
gBrowser.selectedTab = gBrowser.addTab("about:blank");
let self = this;
loadURI("about:addons", function() {
self.notifyObj = new basicNotification();
self.notification = showNotification(self.notifyObj);
});
},
onShown: function (popup) {
checkPopup(popup, this.notifyObj);
is(popup.anchorNode.className, "tabbrowser-tab", "notification anchored to tab");
dismissNotification(popup);
},
onHidden: function (popup) {
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
this.notification.remove();
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
gBrowser.removeTab(gBrowser.selectedTab);
gBrowser.selectedTab = this.oldSelectedTab;
}
},
];
function showNotification(notifyObj) {
@ -604,8 +631,10 @@ function checkPopup(popup, notificationObj) {
is(notifications.length, 1, "only one notification displayed");
let notification = notifications[0];
let icon = document.getAnonymousElementByAttribute(notification, "class", "popup-notification-icon");
if (notificationObj.id == "geolocation")
if (notificationObj.id == "geolocation") {
isnot(icon.boxObject.width, 0, "icon for geo displayed");
is(popup.anchorNode.className, "notification-anchor-icon", "notification anchored to icon");
}
is(notification.getAttribute("label"), notificationObj.message, "message matches");
is(notification.id, notificationObj.id + "-notification", "id matches");
if (notificationObj.mainAction) {

View File

@ -1201,6 +1201,10 @@ toolbar[iconsize="small"] #feed-button {
outline: 1px dotted -moz-DialogText;
}
#default-notification-icon {
list-style-image: url(chrome://global/skin/icons/information-16.png);
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

View File

@ -2067,6 +2067,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
0 0 3px 2px -moz-mac-focusring;
}
#default-notification-icon {
list-style-image: url(chrome://global/skin/icons/information-16.png);
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

View File

@ -2023,6 +2023,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
outline-offset: -3px;
}
#default-notification-icon {
list-style-image: url(chrome://global/skin/icons/information-16.png);
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

View File

@ -20,6 +20,7 @@
*
* Contributor(s):
* Gavin Sharp <gavin@gavinsharp.com> (Original Author)
* Margaret Leibovic <margaret.leibovic@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -418,6 +419,13 @@ PopupNotifications.prototype = {
// safe to call even if the panel is already hidden.)
this._hidePanel();
// If the anchor element is hidden, use the tab as the anchor. We only ever
// show notifications for the current browser, so we can just use the
// current tab.
let bo = anchorElement.boxObject;
if (bo.height == 0 && bo.width == 0)
anchorElement = this.tabbrowser.selectedTab;
this._currentAnchorElement = anchorElement;
this.panel.openPopup(anchorElement, "bottomcenter topleft");