Bug 1162863 - part 1: rename originHost to displayOrigin. r=paolo sr=gavin

This commit is contained in:
Dão Gottwald 2015-05-15 14:34:50 +02:00
parent c89ca85784
commit 3cb74afdb0
7 changed files with 18 additions and 17 deletions

View File

@ -49,7 +49,7 @@ const gXPInstallObserver = {
};
try {
options.originHost = installInfo.originatingURI.host;
options.displayOrigin = installInfo.originatingURI.host;
} catch (e) {
// originatingURI might be missing or 'host' might throw for non-nsStandardURL nsIURIs.
}
@ -78,7 +78,7 @@ const gXPInstallObserver = {
action, null, options);
break; }
case "addon-install-blocked": {
if (!options.originHost) {
if (!options.displayOrigin) {
// Need to deal with missing originatingURI and with about:/data: URIs more gracefully,
// see bug 1063418 - but for now, bail:
return;
@ -138,7 +138,7 @@ const gXPInstallObserver = {
case "addon-install-failed": {
// TODO This isn't terribly ideal for the multiple failure case
for (let install of installInfo.installs) {
let host = options.originHost;
let host = options.displayOrigin;
if (!host)
host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
install.sourceURI.host;

View File

@ -205,7 +205,7 @@ function test_blocked_install() {
wait_for_notification("addon-install-blocked", function(aPanel) {
let notification = aPanel.childNodes[0];
is(notification.button.label, "Allow", "Should have seen the right button");
is(notification.getAttribute("originhost"), "example.com",
is(notification.getAttribute("origin"), "example.com",
"Should have seen the right origin host");
is(notification.getAttribute("label"),
gApp + " prevented this site from asking you to install software on your computer.",

View File

@ -478,8 +478,8 @@
<xul:vbox>
<xul:hbox align="start">
<xul:vbox flex="1">
<xul:label class="popup-notification-originHost header"
xbl:inherits="value=originhost"
<xul:label class="popup-notification-origin header"
xbl:inherits="value=origin"
crop="end"/>
<xul:description class="popup-notification-description"
xbl:inherits="xbl:text=label,popupid"/>

View File

@ -270,8 +270,9 @@ PopupNotifications.prototype = {
* A string URL. Setting this property will make the
* prompt display a "Learn More" link that, when clicked,
* opens the URL in a new tab.
* originHost: The host name of the page the notification came from.
* If present, this will be displayed above the message.
* displayOrigin:
* The host name or file path of the page the notification came
* from. If present, this will be displayed above the message.
* @returns the Notification object corresponding to the added notification.
*/
show: function PopupNotifications_show(browser, id, message, anchorID,
@ -567,10 +568,10 @@ PopupNotifications.prototype = {
else
popupnotification.removeAttribute("learnmoreurl");
if (n.options.originHost)
popupnotification.setAttribute("originhost", n.options.originHost);
if (n.options.displayOrigin)
popupnotification.setAttribute("origin", n.options.displayOrigin);
else
popupnotification.removeAttribute("originhost");
popupnotification.removeAttribute("origin");
popupnotification.notification = n;

View File

@ -67,12 +67,12 @@ notification[type="critical"] {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
}

View File

@ -105,12 +105,12 @@ notification[type="info"]:not([value="translation"]) .close-icon:not(:hover) {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
-moz-margin-start: 0 !important; /* override default label margin to match description margin */
}

View File

@ -62,12 +62,12 @@ notification[type="critical"] {
max-width: 24em;
}
.popup-notification-originHost:not([value]),
.popup-notification-origin:not([value]),
.popup-notification-learnmore-link:not([href]) {
display: none;
}
.popup-notification-originHost {
.popup-notification-origin {
margin-bottom: .3em !important;
}