mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 615318 - Add a "not now" choice to all doorhanger notification split buttons. r=gavin, a=blocking-beta9
--HG-- extra : rebase_source : 8b350d4d9c5ce5c8a5c6b75c3d0ad45fd5abc2ec
This commit is contained in:
parent
bcbf8e92d5
commit
3624c54d2e
@ -527,6 +527,22 @@ var tests = [
|
|||||||
"geo anchor should be visible");
|
"geo anchor should be visible");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// Test notification "Not Now" menu item
|
||||||
|
{ // Test #17
|
||||||
|
run: function () {
|
||||||
|
this.notifyObj = new basicNotification(),
|
||||||
|
this.notification = showNotification(this.notifyObj);
|
||||||
|
},
|
||||||
|
onShown: function (popup) {
|
||||||
|
checkPopup(popup, this.notifyObj);
|
||||||
|
triggerSecondaryCommand(popup, 1);
|
||||||
|
},
|
||||||
|
onHidden: function (popup) {
|
||||||
|
ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
|
||||||
|
this.notification.remove();
|
||||||
|
ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function showNotification(notifyObj) {
|
function showNotification(notifyObj) {
|
||||||
@ -558,7 +574,13 @@ function checkPopup(popup, notificationObj) {
|
|||||||
}
|
}
|
||||||
let actualSecondaryActions = notification.childNodes;
|
let actualSecondaryActions = notification.childNodes;
|
||||||
let secondaryActions = notificationObj.secondaryActions || [];
|
let secondaryActions = notificationObj.secondaryActions || [];
|
||||||
is(actualSecondaryActions.length, secondaryActions.length, actualSecondaryActions.length + " secondary actions");
|
let actualSecondaryActionsCount = actualSecondaryActions.length;
|
||||||
|
if (secondaryActions.length) {
|
||||||
|
let lastChild = actualSecondaryActions.item(actualSecondaryActions.length - 1);
|
||||||
|
is(lastChild.tagName, "menuseparator", "menuseparator exists");
|
||||||
|
actualSecondaryActionsCount--;
|
||||||
|
}
|
||||||
|
is(actualSecondaryActionsCount, secondaryActions.length, actualSecondaryActions.length + " secondary actions");
|
||||||
secondaryActions.forEach(function (a, i) {
|
secondaryActions.forEach(function (a, i) {
|
||||||
is(actualSecondaryActions[i].getAttribute("label"), a.label, "label for secondary action " + i + " matches");
|
is(actualSecondaryActions[i].getAttribute("label"), a.label, "label for secondary action " + i + " matches");
|
||||||
is(actualSecondaryActions[i].getAttribute("accesskey"), a.accessKey, "accessKey for secondary action " + i + " matches");
|
is(actualSecondaryActions[i].getAttribute("accesskey"), a.accessKey, "accessKey for secondary action " + i + " matches");
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
#
|
#
|
||||||
# ***** END LICENSE BLOCK *****
|
# ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
|
<!DOCTYPE bindings [
|
||||||
|
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
|
||||||
|
%notificationDTD;
|
||||||
|
]>
|
||||||
|
|
||||||
<bindings id="urlbarBindings" xmlns="http://www.mozilla.org/xbl"
|
<bindings id="urlbarBindings" xmlns="http://www.mozilla.org/xbl"
|
||||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
@ -1045,11 +1050,15 @@
|
|||||||
<xul:label anonid="learnmore" class="text-link geolocation-text-link"/>
|
<xul:label anonid="learnmore" class="text-link geolocation-text-link"/>
|
||||||
<xul:spacer flex="1"/>
|
<xul:spacer flex="1"/>
|
||||||
<xul:button anonid="button"
|
<xul:button anonid="button"
|
||||||
|
type="menu-button"
|
||||||
class="popup-notification-menubutton"
|
class="popup-notification-menubutton"
|
||||||
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey,type=buttontype">
|
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey">
|
||||||
<xul:menupopup anonid="menupopup"
|
<xul:menupopup anonid="menupopup"
|
||||||
xbl:inherits="oncommand=menucommand">
|
xbl:inherits="oncommand=menucommand">
|
||||||
<children/>
|
<children/>
|
||||||
|
<xul:menuitem class="menuitem-iconic popup-notification-closeitem"
|
||||||
|
label="&closeNotificationItem.label;"
|
||||||
|
xbl:inherits="oncommand=closeitemcommand"/>
|
||||||
</xul:menupopup>
|
</xul:menupopup>
|
||||||
</xul:button>
|
</xul:button>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
|
@ -339,6 +339,13 @@ PopupNotifications.prototype = {
|
|||||||
notifications.splice(index, 1);
|
notifications.splice(index, 1);
|
||||||
this._fireCallback(notification, "removed");
|
this._fireCallback(notification, "removed");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dismisses the notification without removing it.
|
||||||
|
*/
|
||||||
|
_dismiss: function PopupNotifications_dismiss() {
|
||||||
|
this.panel.hidePopup();
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the notification popup.
|
* Hides the notification popup.
|
||||||
@ -370,15 +377,11 @@ PopupNotifications.prototype = {
|
|||||||
popupnotification.setAttribute("buttonlabel", n.mainAction.label);
|
popupnotification.setAttribute("buttonlabel", n.mainAction.label);
|
||||||
popupnotification.setAttribute("buttonaccesskey", n.mainAction.accessKey);
|
popupnotification.setAttribute("buttonaccesskey", n.mainAction.accessKey);
|
||||||
popupnotification.setAttribute("buttoncommand", "PopupNotifications._onButtonCommand(event);");
|
popupnotification.setAttribute("buttoncommand", "PopupNotifications._onButtonCommand(event);");
|
||||||
if (n.secondaryActions.length) {
|
popupnotification.setAttribute("menucommand", "PopupNotifications._onMenuCommand(event);");
|
||||||
popupnotification.setAttribute("buttontype", "menu-button");
|
popupnotification.setAttribute("closeitemcommand", "PopupNotifications._dismiss();event.stopPropagation();");
|
||||||
popupnotification.setAttribute("menucommand", "PopupNotifications._onMenuCommand(event);");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
popupnotification.notification = n;
|
popupnotification.notification = n;
|
||||||
|
|
||||||
this.panel.appendChild(popupnotification);
|
|
||||||
|
|
||||||
if (n.secondaryActions) {
|
if (n.secondaryActions) {
|
||||||
n.secondaryActions.forEach(function (a) {
|
n.secondaryActions.forEach(function (a) {
|
||||||
let item = doc.createElementNS(XUL_NS, "menuitem");
|
let item = doc.createElementNS(XUL_NS, "menuitem");
|
||||||
@ -389,7 +392,14 @@ PopupNotifications.prototype = {
|
|||||||
|
|
||||||
popupnotification.appendChild(item);
|
popupnotification.appendChild(item);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
if (n.secondaryActions.length) {
|
||||||
|
let closeItemSeparator = doc.createElementNS(XUL_NS, "menuseparator");
|
||||||
|
popupnotification.appendChild(closeItemSeparator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.panel.appendChild(popupnotification);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -429,10 +429,14 @@
|
|||||||
<xul:hbox pack="end">
|
<xul:hbox pack="end">
|
||||||
<xul:button anonid="button"
|
<xul:button anonid="button"
|
||||||
class="popup-notification-menubutton"
|
class="popup-notification-menubutton"
|
||||||
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey,type=buttontype">
|
type="menu-button"
|
||||||
|
xbl:inherits="oncommand=buttoncommand,label=buttonlabel,accesskey=buttonaccesskey">
|
||||||
<xul:menupopup anonid="menupopup"
|
<xul:menupopup anonid="menupopup"
|
||||||
xbl:inherits="oncommand=menucommand">
|
xbl:inherits="oncommand=menucommand">
|
||||||
<children/>
|
<children/>
|
||||||
|
<xul:menuitem class="menuitem-iconic popup-notification-closeitem"
|
||||||
|
label="&closeNotificationItem.label;"
|
||||||
|
xbl:inherits="oncommand=closeitemcommand"/>
|
||||||
</xul:menupopup>
|
</xul:menupopup>
|
||||||
</xul:button>
|
</xul:button>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
|
@ -1 +1,3 @@
|
|||||||
<!ENTITY closeNotification.tooltip "Close this message">
|
<!ENTITY closeNotification.tooltip "Close this message">
|
||||||
|
|
||||||
|
<!ENTITY closeNotificationItem.label "Not Now">
|
||||||
|
@ -58,3 +58,7 @@ notification[type="critical"] .messageImage {
|
|||||||
.popup-notification-description {
|
.popup-notification-description {
|
||||||
max-width: 248px;
|
max-width: 248px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popup-notification-closeitem {
|
||||||
|
list-style-image: url("moz-icon://stock/gtk-close?size=menu");
|
||||||
|
}
|
||||||
|
@ -154,3 +154,7 @@ notification[type="critical"] .messageImage {
|
|||||||
inset 0 1px 7px rgba(0,0,0,.4),
|
inset 0 1px 7px rgba(0,0,0,.4),
|
||||||
0 1px 0 rgba(255,255,255,.1);
|
0 1px 0 rgba(255,255,255,.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popup-notification-closeitem > .menu-iconic-left {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@ -151,3 +151,8 @@ notification[type="critical"] .messageImage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
.popup-notification-closeitem {
|
||||||
|
list-style-image: url("chrome://global/skin/icons/close.png");
|
||||||
|
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user