Bug 1329942 - Fix alignment of webextensions permissions doorhanger r?florian
MozReview-Commit-ID: K0YM26lgOY5
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -21,16 +21,17 @@
# All DTD information is stored in a separate file so that it can be shared by
# hiddenWindow.xul.
#include browser-doctype.inc
<window id="main-window"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="gBrowserInit.onLoad()" onunload="gBrowserInit.onUnload()" onclose="return WindowIsClosing();"
title="&mainWindow.title;"
title_normal="&mainWindow.title;"
#ifdef XP_MACOSX
title_privatebrowsing="&mainWindow.title;&mainWindow.titlemodifiermenuseparator;&mainWindow.titlePrivateBrowsingSuffix;"
titledefault="&mainWindow.title;"
titlemodifier=""
--- a/browser/base/content/popup-notifications.inc
+++ b/browser/base/content/popup-notifications.inc
@@ -69,17 +69,16 @@
</popupnotification>
<popupnotification id="addon-install-confirmation-notification" hidden="true">
<popupnotificationcontent id="addon-install-confirmation-content" orient="vertical"/>
</popupnotification>
<popupnotification id="addon-webext-permissions-notification" hidden="true">
<popupnotificationcontent orient="vertical">
- <description id="addon-webext-perm-header" class="addon-webext-perm-header"/>
<description id="addon-webext-perm-text" class="addon-webext-perm-text"/>
<label id="addon-webext-perm-intro" class="addon-webext-perm-text"/>
<html:ul id="addon-webext-perm-list" class="addon-webext-perm-list"/>
</popupnotificationcontent>
</popupnotification>
<popupnotification id="addon-installed-notification" hidden="true">
<popupnotificationcontent orient="vertical">
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
@@ -155,16 +155,33 @@ var tests = [
yield shown;
let notification = popup.childNodes[0];
let checkbox = notification.checkbox;
checkCheckbox(checkbox, "This is a checkbox", true);
checkMainAction(notification, true);
gNotification.remove();
}
},
+
+ // Test no checkbox hides warning label
+ { id: "no_checkbox",
+ run() {
+ this.notifyObj = new BasicNotification(this.id);
+ this.notifyObj.options.checkbox = null;
+ gNotification = showNotification(this.notifyObj);
+ },
+ onShown(popup) {
+ checkPopup(popup, this.notifyObj);
+ let notification = popup.childNodes[0];
+ checkCheckbox(notification.checkbox, "", false, true);
+ checkMainAction(notification);
+ triggerMainCommand(popup);
+ },
+ onHidden() { },
+ },
];
// Test checkbox disabling the main action in different combinations
["checkedState", "uncheckedState"].forEach(function(state) {
[true, false].forEach(function(checked) {
tests.push(
{ id: `checkbox_disableMainAction_${state}_${checked ? "checked" : "unchecked"}`,
run() {
--- a/browser/modules/ExtensionsUI.jsm
+++ b/browser/modules/ExtensionsUI.jsm
@@ -336,20 +336,21 @@ this.ExtensionsUI = {
result.acceptKey = bundle.GetStringFromName("webextPerms.updateAccept.accessKey");
}
return result;
},
showPermissionsPrompt(browser, strings, icon, histkey) {
function eventCallback(topic) {
- if (topic == "showing") {
- let doc = this.browser.ownerDocument;
- doc.getElementById("addon-webext-perm-header").innerHTML = strings.header;
-
+ let doc = this.browser.ownerDocument;
+ if (topic == "shown") {
+ doc.getElementById("addon-webext-permissions-notification")
+ .description.innerHTML = strings.header;
+ } else if (topic == "showing") {
let textEl = doc.getElementById("addon-webext-perm-text");
textEl.innerHTML = strings.text;
textEl.hidden = !strings.text;
let listIntroEl = doc.getElementById("addon-webext-perm-intro");
listIntroEl.value = strings.listIntro;
listIntroEl.hidden = (strings.msgs.length == 0);
@@ -392,17 +393,22 @@ this.ExtensionsUI = {
accessKey: strings.cancelKey,
callback: () => {
this.histogram.add(histkey + "Rejected");
resolve(false);
},
},
];
- win.PopupNotifications.show(browser, "addon-webext-permissions", "",
+ // Get the text value of strings.header to pre-populate the header. This will get
+ // overwritten with the HTML version later.
+ let escapeHeader = browser.ownerDocument.createElement("div");
+ escapeHeader.innerHTML = strings.header;
+ win.PopupNotifications.show(browser, "addon-webext-permissions",
+ escapeHeader.textContent,
"addons-notification-icon",
action, secondaryActions, popupOptions);
});
},
showInstallNotification(target, addon) {
let win = target.ownerGlobal;
let popups = win.PopupNotifications;
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -788,18 +788,28 @@ menuitem.bookmark-item {
width: 28em;
max-width: 28em;
}
.addon-install-confirmation-name {
font-weight: bold;
}
-.addon-webext-perm-header {
- font-size: 1.3em;
+html|*.addon-webext-perm-list {
+ margin-block-end: 0;
+ padding-inline-start: 10px;
+}
+
+.addon-webext-perm-text {
+ margin-inline-start: 0;
+}
+
+.popup-notification-description[popupid="addon-webext-permissions"] {
+ margin: 0;
+ padding: 0;
}
.addon-webext-name {
display: inline;
font-weight: bold;
margin: 0;
}
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -3026,18 +3026,28 @@ menulist.translate-infobar-element > .me
width: 28em;
max-width: 28em;
}
.addon-install-confirmation-name {
font-weight: bold;
}
-.addon-webext-perm-header {
- font-size: 1.3em;
+html|*.addon-webext-perm-list {
+ margin-block-end: 0;
+ padding-inline-start: 10px;
+}
+
+.addon-webext-perm-text {
+ margin-inline-start: 0;
+}
+
+.popup-notification-description[popupid="addon-webext-permissions"] {
+ margin: 0;
+ padding: 0;
}
.addon-webext-name {
display: inline;
font-weight: bold;
margin: 0;
}
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -2069,18 +2069,28 @@ toolbarbutton.bookmark-item[dragover="tr
width: 28em;
max-width: 28em;
}
.addon-install-confirmation-name {
font-weight: bold;
}
-.addon-webext-perm-header {
- font-size: 1.3em;
+html|*.addon-webext-perm-list {
+ margin-block-end: 0;
+ padding-inline-start: 10px;
+}
+
+.addon-webext-perm-text {
+ margin-inline-start: 0;
+}
+
+.popup-notification-description[popupid="addon-webext-permissions"] {
+ margin: 0;
+ padding: 0;
}
.addon-webext-name {
display: inline;
font-weight: bold;
margin: 0;
}
--- a/toolkit/content/widgets/notification.xml
+++ b/toolkit/content/widgets/notification.xml
@@ -488,17 +488,18 @@
xbl:inherits="popupid,src=icon,class=iconclass"/>
<xul:vbox flex="1" pack="start"
class="popup-notification-body" xbl:inherits="popupid">
<xul:hbox align="start">
<xul:vbox flex="1">
<xul:label class="popup-notification-origin header"
xbl:inherits="value=origin,tooltiptext=origin"
crop="center"/>
- <xul:description class="popup-notification-description"
+ <xul:description anonid="description"
+ class="popup-notification-description"
xbl:inherits="xbl:text=label,popupid"/>
</xul:vbox>
<xul:toolbarbutton anonid="closebutton"
class="messageCloseButton close-icon popup-notification-closebutton tabbable"
xbl:inherits="oncommand=closebuttoncommand,hidden=closebuttonhidden"
tooltiptext="&closeNotification.tooltip;"/>
</xul:hbox>
<children includes="popupnotificationcontent"/>
@@ -538,16 +539,19 @@
</resources>
<implementation>
<field name="checkbox" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "checkbox");
</field>
<field name="closebutton" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "closebutton");
</field>
+ <field name="description">
+ document.getAnonymousElementByAttribute(this, "anonid", "description");
+ </field>
<field name="button" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "button");
</field>
<field name="secondaryButton" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "secondarybutton");
</field>
<field name="menubutton" readonly="true">
document.getAnonymousElementByAttribute(this, "anonid", "menubutton");
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -843,16 +843,17 @@ PopupNotifications.prototype = {
if (checked) {
this._setNotificationUIState(popupnotification, checkbox.checkedState);
} else {
this._setNotificationUIState(popupnotification, checkbox.uncheckedState);
}
} else {
popupnotification.setAttribute("checkboxhidden", "true");
+ popupnotification.setAttribute("warninghidden", "true");
}
this.panel.appendChild(popupnotification);
// The popupnotification may be hidden if we got it from the chrome
// document rather than creating it ad hoc.
popupnotification.hidden = false;
}, this);