Backed out 2 changesets (bug 1596897) for mochitest failures at browser_setIgnoreCertificateErrors.js. CLOSED TREE

Backed out changeset 00c45a405129 (bug 1596897)
Backed out changeset 61304ccbaada (bug 1596897)
This commit is contained in:
Brindusan Cristian 2021-01-28 21:53:46 +02:00
Родитель 681a1c23e1
Коммит e117dc4695
49 изменённых файлов: 1358 добавлений и 1608 удалений

Просмотреть файл

@ -145,7 +145,7 @@ add_task(async () => {
is(rootChildCount(), 5, "Root has 5 children");
// Open site identity popup
document.getElementById("identity-icon-box").click();
document.getElementById("identity-box").click();
const identityPopup = document.getElementById("identity-popup");
await BrowserTestUtils.waitForPopupEvent(identityPopup, "shown");

Просмотреть файл

@ -206,12 +206,6 @@ var gIdentityHandler = {
delete this._identityBox;
return (this._identityBox = document.getElementById("identity-box"));
},
get _identityIconBox() {
delete this._identityIconBox;
return (this._identityIconBox = document.getElementById(
"identity-icon-box"
));
},
get _identityPopupMultiView() {
delete this._identityPopupMultiView;
return (this._identityPopupMultiView = document.getElementById(
@ -301,6 +295,30 @@ var gIdentityHandler = {
delete this._identityIcon;
return (this._identityIcon = document.getElementById("identity-icon"));
},
get _permissionList() {
delete this._permissionList;
return (this._permissionList = document.getElementById(
"identity-popup-permission-list"
));
},
get _defaultPermissionAnchor() {
delete this._defaultPermissionAnchor;
return (this._defaultPermissionAnchor = document.getElementById(
"identity-popup-permission-list-default-anchor"
));
},
get _permissionEmptyHint() {
delete this._permissionEmptyHint;
return (this._permissionEmptyHint = document.getElementById(
"identity-popup-permission-empty-hint"
));
},
get _permissionReloadHint() {
delete this._permissionReloadHint;
return (this._permissionReloadHint = document.getElementById(
"identity-popup-permission-reload-hint"
));
},
get _popupExpander() {
delete this._popupExpander;
return (this._popupExpander = document.getElementById(
@ -313,6 +331,32 @@ var gIdentityHandler = {
"identity-popup-clear-sitedata-footer"
));
},
get _permissionAnchors() {
delete this._permissionAnchors;
let permissionAnchors = {};
for (let anchor of document.getElementById("blocked-permissions-container")
.children) {
permissionAnchors[anchor.getAttribute("data-permission-id")] = anchor;
}
return (this._permissionAnchors = permissionAnchors);
},
get _geoSharingIcon() {
delete this._geoSharingIcon;
return (this._geoSharingIcon = document.getElementById("geo-sharing-icon"));
},
get _xrSharingIcon() {
delete this._xrSharingIcon;
return (this._xrSharingIcon = document.getElementById("xr-sharing-icon"));
},
get _webRTCSharingIcon() {
delete this._webRTCSharingIcon;
return (this._webRTCSharingIcon = document.getElementById(
"webrtc-sharing-icon"
));
},
get _insecureConnectionIconEnabled() {
delete this._insecureConnectionIconEnabled;
@ -421,6 +465,10 @@ var gIdentityHandler = {
event.stopPropagation();
},
openPermissionPreferences() {
openPreferences("privacy-permissions");
},
/**
* Handler for mouseclicks on the "More Information" button in the
* "identity-popup" panel.
@ -651,9 +699,8 @@ var gIdentityHandler = {
this.refreshIdentityBlock();
// Handle a location change while the Control Center is focused
// by closing the popup (bug 1207542)
if (shouldHidePopup) {
this.hidePopup();
gPermissionPanel.hidePopup();
if (shouldHidePopup && this._popupInitialized) {
PanelMultiView.hidePopup(this._identityPopup);
}
// NOTE: We do NOT update the identity popup (the control center) when
@ -686,6 +733,46 @@ var gIdentityHandler = {
}
},
updateSharingIndicator() {
let tab = gBrowser.selectedTab;
this._sharingState = tab._sharingState;
this._webRTCSharingIcon.removeAttribute("paused");
this._webRTCSharingIcon.removeAttribute("sharing");
this._geoSharingIcon.removeAttribute("sharing");
this._xrSharingIcon.removeAttribute("sharing");
if (this._sharingState) {
if (
this._sharingState &&
this._sharingState.webRTC &&
this._sharingState.webRTC.sharing
) {
this._webRTCSharingIcon.setAttribute(
"sharing",
this._sharingState.webRTC.sharing
);
if (this._sharingState.webRTC.paused) {
this._webRTCSharingIcon.setAttribute("paused", "true");
}
}
if (this._sharingState.geo) {
this._geoSharingIcon.setAttribute("sharing", this._sharingState.geo);
}
if (this._sharingState.xr) {
this._xrSharingIcon.setAttribute("sharing", this._sharingState.xr);
}
}
if (this._popupInitialized && this._identityPopup.state != "closed") {
this.updateSitePermissions();
PanelView.forNode(
this._identityPopupMainView
).descriptionHeightWorkaround();
}
},
/**
* Attempt to provide proper IDN treatment for host names
*/
@ -899,6 +986,50 @@ var gIdentityHandler = {
this._identityIconLabel.collapsed = !icon_label;
},
/**
* Updates the permissions block in the identity block.
*/
_refreshPermissionIcons() {
let permissionAnchors = this._permissionAnchors;
// hide all permission icons
for (let icon of Object.values(permissionAnchors)) {
icon.removeAttribute("showing");
}
// keeps track if we should show an indicator that there are active permissions
let hasGrantedPermissions = false;
// show permission icons
let permissions = SitePermissions.getAllForBrowser(
gBrowser.selectedBrowser
);
for (let permission of permissions) {
if (
permission.state == SitePermissions.BLOCK ||
permission.state == SitePermissions.AUTOPLAY_BLOCKED_ALL
) {
let icon = permissionAnchors[permission.id];
if (icon) {
icon.setAttribute("showing", "true");
}
} else if (permission.state != SitePermissions.UNKNOWN) {
hasGrantedPermissions = true;
}
}
if (hasGrantedPermissions) {
this._identityBox.classList.add("grantedPermissions");
}
// Show blocked popup icon in the identity-box if popups are blocked
// irrespective of popup permission capability value.
if (gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount()) {
let icon = permissionAnchors.popup;
icon.setAttribute("showing", "true");
}
},
/**
* Updates the identity block user interface with the data from this object.
*/
@ -914,13 +1045,12 @@ var gIdentityHandler = {
// This will also filter out intermediate about:blank loads to avoid
// flickering the identity block and doing unnecessary work.
if (this._hasInvalidPageProxyState()) {
gPermissionPanel.hidePermissionIcons();
return;
}
this._refreshIdentityIcons();
gPermissionPanel.refreshPermissionIcons();
this._refreshPermissionIcons();
// Hide the shield icon if it is a chrome page.
gProtectionsHandler._trackingProtectionIconContainer.classList.toggle(
@ -1122,6 +1252,9 @@ var gIdentityHandler = {
this._identityPopupContentOwner.textContent = owner;
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;
// Update per-site permissions section.
this.updateSitePermissions();
},
setURI(uri) {
@ -1176,11 +1309,39 @@ var gIdentityHandler = {
return; // Left click, space or enter only
}
// Don't allow left click, space or enter if the location has been modified.
if (gURLBar.getAttribute("pageproxystate") != "valid") {
// Don't allow left click, space or enter if the location has been modified,
// so long as we're not sharing any devices.
// If we are sharing a device, the identity block is prevented by CSS from
// being focused (and therefore, interacted with) by the user. However, we
// want to allow opening the identity popup from the device control menu,
// which calls click() on the identity button, so we don't return early.
if (
!this._sharingState &&
gURLBar.getAttribute("pageproxystate") != "valid"
) {
return;
}
// If we are in DOM full-screen, exit it before showing the identity popup
// (see bug 1557041)
if (document.fullscreen) {
// Open the identity popup after DOM full-screen exit
// We need to wait for the exit event and after that wait for the fullscreen exit transition to complete
// If we call _openPopup before the full-screen transition ends it can get cancelled
// Only waiting for painted is not sufficient because we could still be in the full-screen enter transition.
this._exitedEventReceived = false;
this._event = event;
Services.obs.addObserver(this, "fullscreen-painted");
window.addEventListener(
"MozDOMFullscreen:Exited",
() => {
this._exitedEventReceived = true;
},
{ once: true }
);
document.exitFullscreen();
return;
}
this._openPopup(event);
},
@ -1188,11 +1349,14 @@ var gIdentityHandler = {
// Make the popup available.
this._initializePopup();
// Remove the reload hint that we show after a user has cleared a permission.
this._permissionReloadHint.setAttribute("hidden", "true");
// Update the popup strings
this.refreshIdentityPopup();
// Add the "open" attribute to the identity box for styling
this._identityIconBox.setAttribute("open", "true");
this._identityBox.setAttribute("open", "true");
// Check the panel state of other panels. Hide them if needed.
let openPanels = Array.from(document.querySelectorAll("panel[openpanel]"));
@ -1201,7 +1365,7 @@ var gIdentityHandler = {
}
// Now open the popup, anchored off the primary chrome element
PanelMultiView.openPopup(this._identityPopup, this._identityIconBox, {
PanelMultiView.openPopup(this._identityPopup, this._identityIcon, {
position: "bottomcenter topleft",
triggerEvent: event,
}).catch(Cu.reportError);
@ -1216,7 +1380,7 @@ var gIdentityHandler = {
onPopupHidden(event) {
if (event.target == this._identityPopup) {
window.removeEventListener("focus", this, true);
this._identityIconBox.removeAttribute("open");
this._identityBox.removeAttribute("open");
}
},
@ -1252,6 +1416,15 @@ var gIdentityHandler = {
}
break;
}
case "fullscreen-painted": {
if (subject != window || !this._exitedEventReceived) {
return;
}
Services.obs.removeObserver(this, "fullscreen-painted");
this._openPopup(this._event);
delete this._event;
break;
}
}
},
@ -1327,6 +1500,16 @@ var gIdentityHandler = {
gURLBar.view.close();
},
onLocationChange() {
if (this._popupInitialized && this._identityPopup.state != "closed") {
this._permissionReloadHint.setAttribute("hidden", "true");
if (this._isPermissionListEmpty()) {
this._permissionEmptyHint.removeAttribute("hidden");
}
}
},
_updateAttribute(elem, attr, value) {
if (value) {
elem.setAttribute(attr, value);
@ -1334,4 +1517,598 @@ var gIdentityHandler = {
elem.removeAttribute(attr);
}
},
_isPermissionListEmpty() {
return !this._permissionList.querySelectorAll(
".identity-popup-permission-item"
).length;
},
updateSitePermissions() {
let permissionItemSelector = [
".identity-popup-permission-item, .identity-popup-permission-item-container",
];
this._permissionList
.querySelectorAll(permissionItemSelector)
.forEach(e => e.remove());
let permissions = SitePermissions.getAllPermissionDetailsForBrowser(
gBrowser.selectedBrowser
);
if (this._sharingState && this._sharingState.geo) {
let geoPermission = permissions.find(perm => perm.id === "geo");
if (geoPermission) {
geoPermission.sharingState = true;
} else {
permissions.push({
id: "geo",
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: true,
});
}
}
if (this._sharingState && this._sharingState.xr) {
let xrPermission = permissions.find(perm => perm.id === "xr");
if (xrPermission) {
xrPermission.sharingState = true;
} else {
permissions.push({
id: "xr",
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: true,
});
}
}
if (this._sharingState && this._sharingState.webRTC) {
let webrtcState = this._sharingState.webRTC;
// If WebRTC device or screen permissions are in use, we need to find
// the associated permission item to set the sharingState field.
for (let id of ["camera", "microphone", "screen"]) {
if (webrtcState[id]) {
let found = false;
for (let permission of permissions) {
if (permission.id != id) {
continue;
}
found = true;
permission.sharingState = webrtcState[id];
break;
}
if (!found) {
// If the permission item we were looking for doesn't exist,
// the user has temporarily allowed sharing and we need to add
// an item in the permissions array to reflect this.
permissions.push({
id,
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: webrtcState[id],
});
}
}
}
}
let totalBlockedPopups = gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount();
let hasBlockedPopupIndicator = false;
for (let permission of permissions) {
let [id, key] = permission.id.split(SitePermissions.PERM_KEY_DELIMITER);
if (id == "storage-access") {
// Ignore storage access permissions here, they are made visible inside
// the Content Blocking UI.
continue;
}
let item;
let anchor =
this._permissionList.querySelector(`[anchorfor="${id}"]`) ||
this._defaultPermissionAnchor;
if (id == "open-protocol-handler") {
let permContainer = this._createProtocolHandlerPermissionItem(
permission,
key
);
if (permContainer) {
anchor.appendChild(permContainer);
}
} else {
item = this._createPermissionItem({
permission,
isContainer: id == "geo" || id == "xr",
nowrapLabel: id == "3rdPartyStorage",
});
if (!item) {
continue;
}
anchor.appendChild(item);
}
if (id == "popup" && totalBlockedPopups) {
this._createBlockedPopupIndicator(totalBlockedPopups);
hasBlockedPopupIndicator = true;
} else if (id == "geo" && permission.state === SitePermissions.ALLOW) {
this._createGeoLocationLastAccessIndicator();
}
}
if (totalBlockedPopups && !hasBlockedPopupIndicator) {
let permission = {
id: "popup",
state: SitePermissions.getDefault("popup"),
scope: SitePermissions.SCOPE_PERSISTENT,
};
let item = this._createPermissionItem({ permission });
this._defaultPermissionAnchor.appendChild(item);
this._createBlockedPopupIndicator(totalBlockedPopups);
}
// Show a placeholder text if there's no permission and no reload hint.
if (
this._isPermissionListEmpty() &&
this._permissionReloadHint.hasAttribute("hidden")
) {
this._permissionEmptyHint.removeAttribute("hidden");
} else {
this._permissionEmptyHint.setAttribute("hidden", "true");
}
},
/**
* Creates a permission item based on the supplied options and returns it.
* It is up to the caller to actually insert the element somewhere.
*
* @param permission - An object containing information representing the
* permission, typically obtained via SitePermissions.jsm
* @param isContainer - If true, the permission item will be added to a vbox
* and the vbox will be returned.
* @param permClearButton - Whether to show an "x" button to clear the permission
* @param showStateLabel - Whether to show a label indicating the current status
* of the permission e.g. "Temporary Allowed"
* @param idNoSuffix - Some permission types have additional information suffixed
* to the ID - callers can pass the unsuffixed ID via this
* parameter to indicate the permission type manually.
* @param nowrapLabel - Whether to prevent the permission item's label from
* wrapping its text content. This allows styling text-overflow
* and is useful for e.g. 3rdPartyStorage permissions whose
* labels are origins - which could be of any length.
*/
_createPermissionItem({
permission,
isContainer = false,
permClearButton = true,
showStateLabel = true,
idNoSuffix = permission.id,
nowrapLabel = false,
}) {
let container = document.createXULElement("hbox");
container.setAttribute("class", "identity-popup-permission-item");
container.setAttribute("align", "center");
container.setAttribute("role", "group");
let img = document.createXULElement("image");
img.classList.add("identity-popup-permission-icon", idNoSuffix + "-icon");
if (
permission.state == SitePermissions.BLOCK ||
permission.state == SitePermissions.AUTOPLAY_BLOCKED_ALL
) {
img.classList.add("blocked-permission-icon");
}
if (
permission.sharingState ==
Ci.nsIMediaManagerService.STATE_CAPTURE_ENABLED ||
(idNoSuffix == "screen" &&
permission.sharingState &&
!permission.sharingState.includes("Paused"))
) {
img.classList.add("in-use");
// Synchronize control center and identity block blinking animations.
window
.promiseDocumentFlushed(() => {
let sharingIconBlink = this._webRTCSharingIcon.getAnimations()[0];
let imgBlink = img.getAnimations()[0];
return [sharingIconBlink, imgBlink];
})
.then(([sharingIconBlink, imgBlink]) => {
if (sharingIconBlink && imgBlink) {
imgBlink.startTime = sharingIconBlink.startTime;
}
});
}
let nameLabel = document.createXULElement("label");
nameLabel.setAttribute("flex", "1");
nameLabel.setAttribute("class", "identity-popup-permission-label");
let label = SitePermissions.getPermissionLabel(idNoSuffix);
if (label === null) {
return null;
}
if (nowrapLabel) {
nameLabel.setAttribute("value", label);
nameLabel.setAttribute("tooltiptext", label);
nameLabel.setAttribute("crop", "end");
} else {
nameLabel.textContent = label;
}
let nameLabelId = "identity-popup-permission-label-" + idNoSuffix;
nameLabel.setAttribute("id", nameLabelId);
let isPolicyPermission = [
SitePermissions.SCOPE_POLICY,
SitePermissions.SCOPE_GLOBAL,
].includes(permission.scope);
if (
(idNoSuffix == "popup" && !isPolicyPermission) ||
idNoSuffix == "autoplay-media"
) {
let menulist = document.createXULElement("menulist");
let menupopup = document.createXULElement("menupopup");
let block = document.createXULElement("vbox");
block.setAttribute("id", "identity-popup-popup-container");
block.setAttribute("class", "identity-popup-permission-item-container");
menulist.setAttribute("sizetopopup", "none");
menulist.setAttribute("id", "identity-popup-popup-menulist");
for (let state of SitePermissions.getAvailableStates(idNoSuffix)) {
let menuitem = document.createXULElement("menuitem");
// We need to correctly display the default/unknown state, which has its
// own integer value (0) but represents one of the other states.
if (state == SitePermissions.getDefault(idNoSuffix)) {
menuitem.setAttribute("value", "0");
} else {
menuitem.setAttribute("value", state);
}
menuitem.setAttribute(
"label",
SitePermissions.getMultichoiceStateLabel(idNoSuffix, state)
);
menupopup.appendChild(menuitem);
}
menulist.appendChild(menupopup);
if (permission.state == SitePermissions.getDefault(idNoSuffix)) {
menulist.value = "0";
} else {
menulist.value = permission.state;
}
// Avoiding listening to the "select" event on purpose. See Bug 1404262.
menulist.addEventListener("command", () => {
SitePermissions.setForPrincipal(
gBrowser.contentPrincipal,
idNoSuffix,
menulist.selectedItem.value
);
});
container.appendChild(img);
container.appendChild(nameLabel);
container.appendChild(menulist);
container.setAttribute("aria-labelledby", nameLabelId);
block.appendChild(container);
return block;
}
container.appendChild(img);
container.appendChild(nameLabel);
let labelledBy = nameLabelId;
if (showStateLabel) {
let stateLabel = this._createStateLabel(permission, idNoSuffix);
container.appendChild(stateLabel);
labelledBy += " " + stateLabel.id;
}
container.setAttribute("aria-labelledby", labelledBy);
/* We return the permission item here without a remove button if the permission is a
SCOPE_POLICY or SCOPE_GLOBAL permission. Policy permissions cannot be
removed/changed for the duration of the browser session. */
if (isPolicyPermission) {
return container;
}
if (isContainer) {
let block = document.createXULElement("vbox");
block.setAttribute("id", "identity-popup-" + idNoSuffix + "-container");
block.setAttribute("class", "identity-popup-permission-item-container");
if (permClearButton) {
let button = this._createPermissionClearButton(permission, block);
container.appendChild(button);
}
block.appendChild(container);
return block;
}
if (permClearButton) {
let button = this._createPermissionClearButton(permission, container);
container.appendChild(button);
}
return container;
},
_createStateLabel(aPermission, idNoSuffix) {
let label = document.createXULElement("label");
label.setAttribute("flex", "1");
label.setAttribute("class", "identity-popup-permission-state-label");
let labelId = "identity-popup-permission-state-label-" + idNoSuffix;
label.setAttribute("id", labelId);
let { state, scope } = aPermission;
// If the user did not permanently allow this device but it is currently
// used, set the variables to display a "temporarily allowed" info.
if (state != SitePermissions.ALLOW && aPermission.sharingState) {
state = SitePermissions.ALLOW;
scope = SitePermissions.SCOPE_REQUEST;
}
label.textContent = SitePermissions.getCurrentStateLabel(
state,
idNoSuffix,
scope
);
return label;
},
_removePermPersistentAllow(principal, id) {
let perm = SitePermissions.getForPrincipal(principal, id);
if (
perm.state == SitePermissions.ALLOW &&
perm.scope == SitePermissions.SCOPE_PERSISTENT
) {
SitePermissions.removeFromPrincipal(principal, id);
}
},
_createPermissionClearButton(
aPermission,
container,
clearCallback = () => {}
) {
let button = document.createXULElement("button");
button.setAttribute("class", "identity-popup-permission-remove-button");
let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
button.setAttribute("tooltiptext", tooltiptext);
button.addEventListener("command", () => {
let browser = gBrowser.selectedBrowser;
container.remove();
if (aPermission.sharingState) {
if (aPermission.id === "geo" || aPermission.id === "xr") {
let origins = browser.getDevicePermissionOrigins(aPermission.id);
for (let origin of origins) {
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
origin
);
this._removePermPersistentAllow(principal, aPermission.id);
}
origins.clear();
} else if (
["camera", "microphone", "screen"].includes(aPermission.id)
) {
let windowId = this._sharingState.webRTC.windowId;
if (aPermission.id == "screen") {
windowId = "screen:" + windowId;
} else {
// If we set persistent permissions or the sharing has
// started due to existing persistent permissions, we need
// to handle removing these even for frames with different hostnames.
let origins = browser.getDevicePermissionOrigins("webrtc");
for (let origin of origins) {
// It's not possible to stop sharing one of camera/microphone
// without the other.
let principal;
for (let id of ["camera", "microphone"]) {
if (this._sharingState.webRTC[id]) {
if (!principal) {
principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
origin
);
}
this._removePermPersistentAllow(principal, id);
}
}
}
}
let bc = this._sharingState.webRTC.browsingContext;
bc.currentWindowGlobal
.getActor("WebRTC")
.sendAsyncMessage("webrtc:StopSharing", windowId);
webrtcUI.forgetActivePermissionsFromBrowser(gBrowser.selectedBrowser);
}
}
SitePermissions.removeFromPrincipal(
gBrowser.contentPrincipal,
aPermission.id,
browser
);
this._permissionReloadHint.removeAttribute("hidden");
PanelView.forNode(
this._identityPopupMainView
).descriptionHeightWorkaround();
if (aPermission.id === "geo") {
gBrowser.updateBrowserSharing(browser, { geo: false });
} else if (aPermission.id === "xr") {
gBrowser.updateBrowserSharing(browser, { xr: false });
}
clearCallback();
});
return button;
},
_getGeoLocationLastAccess() {
return new Promise(resolve => {
let lastAccess = null;
ContentPrefService2.getByDomainAndName(
gBrowser.currentURI.spec,
"permissions.geoLocation.lastAccess",
gBrowser.selectedBrowser.loadContext,
{
handleResult(pref) {
lastAccess = pref.value;
},
handleCompletion() {
resolve(lastAccess);
},
}
);
});
},
async _createGeoLocationLastAccessIndicator() {
let lastAccessStr = await this._getGeoLocationLastAccess();
let geoContainer = document.getElementById("identity-popup-geo-container");
// Check whether geoContainer still exists.
// We are async, the identity popup could have been closed already.
// Also check if it is already populated with a time label.
// This can happen if we update the permission panel multiple times in a
// short timeframe.
if (
lastAccessStr == null ||
!geoContainer ||
document.getElementById("geo-access-indicator-item")
) {
return;
}
let lastAccess = new Date(lastAccessStr);
if (isNaN(lastAccess)) {
Cu.reportError("Invalid timestamp for last geolocation access");
return;
}
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem");
let indicator = document.createXULElement("hbox");
indicator.setAttribute("class", "identity-popup-permission-item");
indicator.setAttribute("align", "center");
indicator.setAttribute("id", "geo-access-indicator-item");
let timeFormat = new Services.intl.RelativeTimeFormat(undefined, {});
let text = document.createXULElement("label");
text.setAttribute("flex", "1");
text.setAttribute("class", "identity-popup-permission-label");
text.textContent = gNavigatorBundle.getFormattedString(
"geolocationLastAccessIndicatorText",
[timeFormat.formatBestUnit(lastAccess)]
);
indicator.appendChild(icon);
indicator.appendChild(text);
geoContainer.appendChild(indicator);
},
_createProtocolHandlerPermissionItem(permission, key) {
let container = document.getElementById(
"identity-popup-open-protocol-handler-container"
);
let initialCall;
if (!container) {
// First open-protocol-handler permission, create container.
container = this._createPermissionItem({
permission,
isContainer: true,
permClearButton: false,
showStateLabel: false,
idNoSuffix: "open-protocol-handler",
});
initialCall = true;
}
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem-no-arrow");
let item = document.createXULElement("hbox");
item.setAttribute("class", "identity-popup-permission-item");
item.setAttribute("align", "center");
let text = document.createXULElement("label");
text.setAttribute("flex", "1");
text.setAttribute("class", "identity-popup-permission-label-subitem");
text.textContent = gNavigatorBundle.getFormattedString(
"openProtocolHandlerPermissionEntryLabel",
[key]
);
let stateLabel = this._createStateLabel(
permission,
"open-protocol-handler"
);
item.appendChild(text);
item.appendChild(stateLabel);
let button = this._createPermissionClearButton(permission, item, () => {
// When we're clearing the last open-protocol-handler permission, clean up
// the empty container.
// (<= 1 because the heading item is also a child of the container)
if (container.childElementCount <= 1) {
container.remove();
}
});
item.appendChild(button);
container.appendChild(item);
// If container already exists in permission list, don't return it again.
return initialCall && container;
},
_createBlockedPopupIndicator(aTotalBlockedPopups) {
let indicator = document.createXULElement("hbox");
indicator.setAttribute("class", "identity-popup-permission-item");
indicator.setAttribute("align", "center");
indicator.setAttribute("id", "blocked-popup-indicator-item");
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem");
let text = document.createXULElement("label", { is: "text-link" });
text.setAttribute("flex", "1");
text.setAttribute("class", "identity-popup-permission-label");
let messageBase = gNavigatorBundle.getString(
"popupShowBlockedPopupsIndicatorText"
);
let message = PluralForm.get(aTotalBlockedPopups, messageBase).replace(
"#1",
aTotalBlockedPopups
);
text.textContent = message;
text.addEventListener("click", () => {
gBrowser.selectedBrowser.popupBlocker.unblockAllPopups();
});
indicator.appendChild(icon);
indicator.appendChild(text);
document
.getElementById("identity-popup-popup-container")
.appendChild(indicator);
},
};

Просмотреть файл

@ -1,958 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/browser-window */
/**
* Utility object to handle manipulations of the identity permission indicators
* in the UI.
*/
var gPermissionPanel = {
_popupInitialized: false,
_initializePopup() {
if (!this._popupInitialized) {
let wrapper = document.getElementById("template-permission-popup");
wrapper.replaceWith(wrapper.content);
this._popupInitialized = true;
}
},
hidePopup() {
if (this._popupInitialized) {
PanelMultiView.hidePopup(this._permissionPopup);
}
},
// smart getters
get _identityPermissionBox() {
delete this._identityPermissionBox;
return (this._identityPermissionBox = document.getElementById(
"identity-permission-box"
));
},
get _permissionGrantedIcon() {
delete this._permissionGrantedIcon;
return (this._permissionGrantedIcon = document.getElementById(
"permissions-granted-icon"
));
},
get _permissionPopup() {
if (!this._popupInitialized) {
return null;
}
delete this._permissionPopup;
return (this._permissionPopup = document.getElementById(
"permission-popup"
));
},
get _permissionPopupMainView() {
delete this._permissionPopupPopupMainView;
return (this._permissionPopupPopupMainView = document.getElementById(
"permission-popup-mainView"
));
},
get _permissionPopupMainViewHeaderLabel() {
delete this._permissionPopupMainViewHeaderLabel;
return (this._permissionPopupMainViewHeaderLabel = document.getElementById(
"permission-popup-mainView-panel-header-span"
));
},
get _permissionList() {
delete this._permissionList;
return (this._permissionList = document.getElementById(
"permission-popup-permission-list"
));
},
get _defaultPermissionAnchor() {
delete this._defaultPermissionAnchor;
return (this._defaultPermissionAnchor = document.getElementById(
"permission-popup-permission-list-default-anchor"
));
},
get _permissionReloadHint() {
delete this._permissionReloadHint;
return (this._permissionReloadHint = document.getElementById(
"permission-popup-permission-reload-hint"
));
},
get _permissionAnchors() {
delete this._permissionAnchors;
let permissionAnchors = {};
for (let anchor of document.getElementById("blocked-permissions-container")
.children) {
permissionAnchors[anchor.getAttribute("data-permission-id")] = anchor;
}
return (this._permissionAnchors = permissionAnchors);
},
get _geoSharingIcon() {
delete this._geoSharingIcon;
return (this._geoSharingIcon = document.getElementById("geo-sharing-icon"));
},
get _xrSharingIcon() {
delete this._xrSharingIcon;
return (this._xrSharingIcon = document.getElementById("xr-sharing-icon"));
},
get _webRTCSharingIcon() {
delete this._webRTCSharingIcon;
return (this._webRTCSharingIcon = document.getElementById(
"webrtc-sharing-icon"
));
},
/**
* Refresh the contents of the permission popup. This includes the headline
* and the list of permissions.
*/
_refreshPermissionPopup() {
let host = gIdentityHandler.getHostForDisplay();
// Update header label
this._permissionPopupMainViewHeaderLabel.textContent = gNavigatorBundle.getFormattedString(
"permissions.header",
[host]
);
// Refresh the permission list
this.updateSitePermissions();
},
/**
* Called by gIdentityHandler to hide permission icons for invalid proxy
* state.
*/
hidePermissionIcons() {
this._identityPermissionBox.removeAttribute("hasGrantedPermissions");
this._identityPermissionBox.removeAttribute("hasPermissionIcon");
},
/**
* Updates the permissions icons in the identity block.
* We show icons for blocked permissions / popups.
*/
refreshPermissionIcons() {
let permissionAnchors = this._permissionAnchors;
// hide all permission icons
for (let icon of Object.values(permissionAnchors)) {
icon.removeAttribute("showing");
}
// keeps track if we should show an indicator that there are active permissions
let hasGrantedPermissions = false;
let hasPermissionIcon = false;
// show permission icons
let permissions = SitePermissions.getAllForBrowser(
gBrowser.selectedBrowser
);
for (let permission of permissions) {
if (
permission.state == SitePermissions.BLOCK ||
permission.state == SitePermissions.AUTOPLAY_BLOCKED_ALL
) {
let icon = permissionAnchors[permission.id];
if (icon) {
icon.setAttribute("showing", "true");
hasPermissionIcon = true;
}
} else if (permission.state != SitePermissions.UNKNOWN) {
hasGrantedPermissions = true;
}
}
// Show blocked popup icon in the identity-box if popups are blocked
// irrespective of popup permission capability value.
if (gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount()) {
let icon = permissionAnchors.popup;
icon.setAttribute("showing", "true");
hasPermissionIcon = true;
}
this._identityPermissionBox.toggleAttribute(
"hasGrantedPermissions",
hasGrantedPermissions
);
this._identityPermissionBox.toggleAttribute(
"hasPermissionIcon",
hasPermissionIcon
);
},
/**
* Shows the permission popup.
* @param {Event} event - Event which caused the popup to show.
*/
_openPopup(event) {
// Make the popup available.
this._initializePopup();
// Remove the reload hint that we show after a user has cleared a permission.
this._permissionReloadHint.setAttribute("hidden", "true");
// Update the popup strings
this._refreshPermissionPopup();
// Add the "open" attribute to the button in the identity box for styling
this._identityPermissionBox.setAttribute("open", "true");
// Check the panel state of other panels. Hide them if needed.
let openPanels = Array.from(document.querySelectorAll("panel[openpanel]"));
for (let panel of openPanels) {
PanelMultiView.hidePopup(panel);
}
// Now open the popup, anchored off the primary chrome element
PanelMultiView.openPopup(
this._permissionPopup,
this._identityPermissionBox,
{
position: "bottomcenter topleft",
triggerEvent: event,
}
).catch(Cu.reportError);
},
/**
* Update identity permission indicators based on sharing state of the
* selected tab. This should be called externally whenever the sharing state
* of the selected tab changes.
*/
updateSharingIndicator() {
let tab = gBrowser.selectedTab;
this._sharingState = tab._sharingState;
this._webRTCSharingIcon.removeAttribute("paused");
this._webRTCSharingIcon.removeAttribute("sharing");
this._geoSharingIcon.removeAttribute("sharing");
this._xrSharingIcon.removeAttribute("sharing");
let hasSharingIcon = false;
if (this._sharingState) {
if (this._sharingState.webRTC?.sharing) {
this._webRTCSharingIcon.setAttribute(
"sharing",
this._sharingState.webRTC.sharing
);
hasSharingIcon = true;
if (this._sharingState.webRTC?.paused) {
this._webRTCSharingIcon.setAttribute("paused", "true");
}
}
if (this._sharingState.geo) {
this._geoSharingIcon.setAttribute("sharing", this._sharingState.geo);
hasSharingIcon = true;
}
if (this._sharingState.xr) {
this._xrSharingIcon.setAttribute("sharing", this._sharingState.xr);
hasSharingIcon = true;
}
}
this._identityPermissionBox.toggleAttribute(
"hasSharingIcon",
hasSharingIcon
);
if (this._popupInitialized && this._permissionPopup.state != "closed") {
this.updateSitePermissions();
}
},
/**
* Click handler for the permission-box element in primary chrome.
*/
handleIdentityButtonEvent(event) {
event.stopPropagation();
if (
(event.type == "click" && event.button != 0) ||
(event.type == "keypress" &&
event.charCode != KeyEvent.DOM_VK_SPACE &&
event.keyCode != KeyEvent.DOM_VK_RETURN)
) {
return; // Left click, space or enter only
}
// Don't allow left click, space or enter if the location has been modified,
// so long as we're not sharing any devices.
// If we are sharing a device, the identity block is prevented by CSS from
// being focused (and therefore, interacted with) by the user. However, we
// want to allow opening the identity popup from the device control menu,
// which calls click() on the identity button, so we don't return early.
if (
!this._sharingState &&
gURLBar.getAttribute("pageproxystate") != "valid"
) {
return;
}
// If we are in DOM fullscreen, exit it before showing the permission popup
// (see bug 1557041)
if (document.fullscreen) {
// Open the identity popup after DOM fullscreen exit
// We need to wait for the exit event and after that wait for the fullscreen exit transition to complete
// If we call _openPopup before the fullscreen transition ends it can get cancelled
// Only waiting for painted is not sufficient because we could still be in the fullscreen enter transition.
this._exitedEventReceived = false;
this._event = event;
Services.obs.addObserver(this, "fullscreen-painted");
window.addEventListener(
"MozDOMFullscreen:Exited",
() => {
this._exitedEventReceived = true;
},
{ once: true }
);
document.exitFullscreen();
return;
}
this._openPopup(event);
},
onPopupShown(event) {
if (event.target == this._permissionPopup) {
window.addEventListener("focus", this, true);
}
},
onPopupHidden(event) {
if (event.target == this._permissionPopup) {
window.removeEventListener("focus", this, true);
this._identityPermissionBox.removeAttribute("open");
}
},
handleEvent(event) {
let elem = document.activeElement;
let position = elem.compareDocumentPosition(this._permissionPopup);
if (
!(
position &
(Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_CONTAINED_BY)
) &&
!this._permissionPopup.hasAttribute("noautohide")
) {
// Hide the panel when focusing an element that is
// neither an ancestor nor descendant unless the panel has
// @noautohide (e.g. for a tour).
PanelMultiView.hidePopup(this._permissionPopup);
}
},
observe(subject, topic, data) {
switch (topic) {
case "fullscreen-painted": {
if (subject != window || !this._exitedEventReceived) {
return;
}
Services.obs.removeObserver(this, "fullscreen-painted");
this._openPopup(this._event);
delete this._event;
break;
}
}
},
onLocationChange() {
if (this._popupInitialized && this._permissionPopup.state != "closed") {
this._permissionReloadHint.setAttribute("hidden", "true");
}
},
/**
* Updates the permission list in the permissions popup.
*/
updateSitePermissions() {
let permissionItemSelector = [
".permission-popup-permission-item, .permission-popup-permission-item-container",
];
this._permissionList
.querySelectorAll(permissionItemSelector)
.forEach(e => e.remove());
let permissions = SitePermissions.getAllPermissionDetailsForBrowser(
gBrowser.selectedBrowser
);
this._sharingState = gBrowser.selectedTab._sharingState;
if (this._sharingState?.geo) {
let geoPermission = permissions.find(perm => perm.id === "geo");
if (geoPermission) {
geoPermission.sharingState = true;
} else {
permissions.push({
id: "geo",
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: true,
});
}
}
if (this._sharingState?.xr) {
let xrPermission = permissions.find(perm => perm.id === "xr");
if (xrPermission) {
xrPermission.sharingState = true;
} else {
permissions.push({
id: "xr",
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: true,
});
}
}
if (this._sharingState?.webRTC) {
let webrtcState = this._sharingState.webRTC;
// If WebRTC device or screen permissions are in use, we need to find
// the associated permission item to set the sharingState field.
for (let id of ["camera", "microphone", "screen"]) {
if (webrtcState[id]) {
let found = false;
for (let permission of permissions) {
if (permission.id != id) {
continue;
}
found = true;
permission.sharingState = webrtcState[id];
break;
}
if (!found) {
// If the permission item we were looking for doesn't exist,
// the user has temporarily allowed sharing and we need to add
// an item in the permissions array to reflect this.
permissions.push({
id,
state: SitePermissions.ALLOW,
scope: SitePermissions.SCOPE_REQUEST,
sharingState: webrtcState[id],
});
}
}
}
}
let totalBlockedPopups = gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount();
let hasBlockedPopupIndicator = false;
for (let permission of permissions) {
let [id, key] = permission.id.split(SitePermissions.PERM_KEY_DELIMITER);
if (id == "storage-access") {
// Ignore storage access permissions here, they are made visible inside
// the Content Blocking UI.
continue;
}
let item;
let anchor =
this._permissionList.querySelector(`[anchorfor="${id}"]`) ||
this._defaultPermissionAnchor;
if (id == "open-protocol-handler") {
let permContainer = this._createProtocolHandlerPermissionItem(
permission,
key
);
if (permContainer) {
anchor.appendChild(permContainer);
}
} else {
item = this._createPermissionItem({
permission,
isContainer: id == "geo" || id == "xr",
nowrapLabel: id == "3rdPartyStorage",
});
if (!item) {
continue;
}
anchor.appendChild(item);
}
if (id == "popup" && totalBlockedPopups) {
this._createBlockedPopupIndicator(totalBlockedPopups);
hasBlockedPopupIndicator = true;
} else if (id == "geo" && permission.state === SitePermissions.ALLOW) {
this._createGeoLocationLastAccessIndicator();
}
}
if (totalBlockedPopups && !hasBlockedPopupIndicator) {
let permission = {
id: "popup",
state: SitePermissions.getDefault("popup"),
scope: SitePermissions.SCOPE_PERSISTENT,
};
let item = this._createPermissionItem({ permission });
this._defaultPermissionAnchor.appendChild(item);
this._createBlockedPopupIndicator(totalBlockedPopups);
}
PanelView.forNode(
this._permissionPopupMainView
).descriptionHeightWorkaround();
},
/**
* Creates a permission item based on the supplied options and returns it.
* It is up to the caller to actually insert the element somewhere.
*
* @param permission - An object containing information representing the
* permission, typically obtained via SitePermissions.jsm
* @param isContainer - If true, the permission item will be added to a vbox
* and the vbox will be returned.
* @param permClearButton - Whether to show an "x" button to clear the permission
* @param showStateLabel - Whether to show a label indicating the current status
* of the permission e.g. "Temporary Allowed"
* @param idNoSuffix - Some permission types have additional information suffixed
* to the ID - callers can pass the unsuffixed ID via this
* parameter to indicate the permission type manually.
* @param nowrapLabel - Whether to prevent the permission item's label from
* wrapping its text content. This allows styling text-overflow
* and is useful for e.g. 3rdPartyStorage permissions whose
* labels are origins - which could be of any length.
*/
_createPermissionItem({
permission,
isContainer = false,
permClearButton = true,
showStateLabel = true,
idNoSuffix = permission.id,
nowrapLabel = false,
}) {
let container = document.createXULElement("hbox");
container.setAttribute("class", "permission-popup-permission-item");
container.setAttribute("align", "center");
container.setAttribute("role", "group");
let img = document.createXULElement("image");
img.classList.add("permission-popup-permission-icon", idNoSuffix + "-icon");
if (
permission.state == SitePermissions.BLOCK ||
permission.state == SitePermissions.AUTOPLAY_BLOCKED_ALL
) {
img.classList.add("blocked-permission-icon");
}
if (
permission.sharingState ==
Ci.nsIMediaManagerService.STATE_CAPTURE_ENABLED ||
(idNoSuffix == "screen" &&
permission.sharingState &&
!permission.sharingState.includes("Paused"))
) {
img.classList.add("in-use");
// Synchronize permission panel and identity block blinking animations.
window
.promiseDocumentFlushed(() => {
let sharingIconBlink = this._webRTCSharingIcon.getAnimations()[0];
let imgBlink = img.getAnimations()[0];
return [sharingIconBlink, imgBlink];
})
.then(([sharingIconBlink, imgBlink]) => {
if (sharingIconBlink && imgBlink) {
imgBlink.startTime = sharingIconBlink.startTime;
}
});
}
let nameLabel = document.createXULElement("label");
nameLabel.setAttribute("flex", "1");
nameLabel.setAttribute("class", "permission-popup-permission-label");
let label = SitePermissions.getPermissionLabel(idNoSuffix);
if (label === null) {
return null;
}
if (nowrapLabel) {
nameLabel.setAttribute("value", label);
nameLabel.setAttribute("tooltiptext", label);
nameLabel.setAttribute("crop", "end");
} else {
nameLabel.textContent = label;
}
let nameLabelId = "permission-popup-permission-label-" + idNoSuffix;
nameLabel.setAttribute("id", nameLabelId);
let isPolicyPermission = [
SitePermissions.SCOPE_POLICY,
SitePermissions.SCOPE_GLOBAL,
].includes(permission.scope);
if (
(idNoSuffix == "popup" && !isPolicyPermission) ||
idNoSuffix == "autoplay-media"
) {
let menulist = document.createXULElement("menulist");
let menupopup = document.createXULElement("menupopup");
let block = document.createXULElement("vbox");
block.setAttribute("id", "permission-popup-container");
block.setAttribute("class", "permission-popup-permission-item-container");
menulist.setAttribute("sizetopopup", "none");
menulist.setAttribute("id", "permission-popup-menulist");
for (let state of SitePermissions.getAvailableStates(idNoSuffix)) {
let menuitem = document.createXULElement("menuitem");
// We need to correctly display the default/unknown state, which has its
// own integer value (0) but represents one of the other states.
if (state == SitePermissions.getDefault(idNoSuffix)) {
menuitem.setAttribute("value", "0");
} else {
menuitem.setAttribute("value", state);
}
menuitem.setAttribute(
"label",
SitePermissions.getMultichoiceStateLabel(idNoSuffix, state)
);
menupopup.appendChild(menuitem);
}
menulist.appendChild(menupopup);
if (permission.state == SitePermissions.getDefault(idNoSuffix)) {
menulist.value = "0";
} else {
menulist.value = permission.state;
}
// Avoiding listening to the "select" event on purpose. See Bug 1404262.
menulist.addEventListener("command", () => {
SitePermissions.setForPrincipal(
gBrowser.contentPrincipal,
idNoSuffix,
menulist.selectedItem.value
);
});
container.appendChild(img);
container.appendChild(nameLabel);
container.appendChild(menulist);
container.setAttribute("aria-labelledby", nameLabelId);
block.appendChild(container);
return block;
}
container.appendChild(img);
container.appendChild(nameLabel);
let labelledBy = nameLabelId;
if (showStateLabel) {
let stateLabel = this._createStateLabel(permission, idNoSuffix);
container.appendChild(stateLabel);
labelledBy += " " + stateLabel.id;
}
container.setAttribute("aria-labelledby", labelledBy);
/* We return the permission item here without a remove button if the permission is a
SCOPE_POLICY or SCOPE_GLOBAL permission. Policy permissions cannot be
removed/changed for the duration of the browser session. */
if (isPolicyPermission) {
return container;
}
if (isContainer) {
let block = document.createXULElement("vbox");
block.setAttribute("id", "permission-popup-" + idNoSuffix + "-container");
block.setAttribute("class", "permission-popup-permission-item-container");
if (permClearButton) {
let button = this._createPermissionClearButton(permission, block);
container.appendChild(button);
}
block.appendChild(container);
return block;
}
if (permClearButton) {
let button = this._createPermissionClearButton(permission, container);
container.appendChild(button);
}
return container;
},
_createStateLabel(aPermission, idNoSuffix) {
let label = document.createXULElement("label");
label.setAttribute("flex", "1");
label.setAttribute("class", "permission-popup-permission-state-label");
let labelId = "permission-popup-permission-state-label-" + idNoSuffix;
label.setAttribute("id", labelId);
let { state, scope } = aPermission;
// If the user did not permanently allow this device but it is currently
// used, set the variables to display a "temporarily allowed" info.
if (state != SitePermissions.ALLOW && aPermission.sharingState) {
state = SitePermissions.ALLOW;
scope = SitePermissions.SCOPE_REQUEST;
}
label.textContent = SitePermissions.getCurrentStateLabel(
state,
idNoSuffix,
scope
);
return label;
},
_removePermPersistentAllow(principal, id) {
let perm = SitePermissions.getForPrincipal(principal, id);
if (
perm.state == SitePermissions.ALLOW &&
perm.scope == SitePermissions.SCOPE_PERSISTENT
) {
SitePermissions.removeFromPrincipal(principal, id);
}
},
_createPermissionClearButton(
aPermission,
container,
clearCallback = () => {}
) {
let button = document.createXULElement("button");
button.setAttribute("class", "permission-popup-permission-remove-button");
let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
button.setAttribute("tooltiptext", tooltiptext);
button.addEventListener("command", () => {
let browser = gBrowser.selectedBrowser;
container.remove();
if (aPermission.sharingState) {
if (aPermission.id === "geo" || aPermission.id === "xr") {
let origins = browser.getDevicePermissionOrigins(aPermission.id);
for (let origin of origins) {
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
origin
);
this._removePermPersistentAllow(principal, aPermission.id);
}
origins.clear();
} else if (
["camera", "microphone", "screen"].includes(aPermission.id)
) {
let windowId = this._sharingState.webRTC.windowId;
if (aPermission.id == "screen") {
windowId = "screen:" + windowId;
} else {
// If we set persistent permissions or the sharing has
// started due to existing persistent permissions, we need
// to handle removing these even for frames with different hostnames.
let origins = browser.getDevicePermissionOrigins("webrtc");
for (let origin of origins) {
// It's not possible to stop sharing one of camera/microphone
// without the other.
let principal;
for (let id of ["camera", "microphone"]) {
if (this._sharingState.webRTC[id]) {
if (!principal) {
principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
origin
);
}
this._removePermPersistentAllow(principal, id);
}
}
}
}
let bc = this._sharingState.webRTC.browsingContext;
bc.currentWindowGlobal
.getActor("WebRTC")
.sendAsyncMessage("webrtc:StopSharing", windowId);
webrtcUI.forgetActivePermissionsFromBrowser(gBrowser.selectedBrowser);
}
}
SitePermissions.removeFromPrincipal(
gBrowser.contentPrincipal,
aPermission.id,
browser
);
this._permissionReloadHint.removeAttribute("hidden");
PanelView.forNode(
this._permissionPopupMainView
).descriptionHeightWorkaround();
if (aPermission.id === "geo") {
gBrowser.updateBrowserSharing(browser, { geo: false });
} else if (aPermission.id === "xr") {
gBrowser.updateBrowserSharing(browser, { xr: false });
}
clearCallback();
});
return button;
},
_getGeoLocationLastAccess() {
return new Promise(resolve => {
let lastAccess = null;
ContentPrefService2.getByDomainAndName(
gBrowser.currentURI.spec,
"permissions.geoLocation.lastAccess",
gBrowser.selectedBrowser.loadContext,
{
handleResult(pref) {
lastAccess = pref.value;
},
handleCompletion() {
resolve(lastAccess);
},
}
);
});
},
async _createGeoLocationLastAccessIndicator() {
let lastAccessStr = await this._getGeoLocationLastAccess();
let geoContainer = document.getElementById(
"permission-popup-geo-container"
);
// Check whether geoContainer still exists.
// We are async, the identity popup could have been closed already.
// Also check if it is already populated with a time label.
// This can happen if we update the permission panel multiple times in a
// short timeframe.
if (
lastAccessStr == null ||
!geoContainer ||
document.getElementById("geo-access-indicator-item")
) {
return;
}
let lastAccess = new Date(lastAccessStr);
if (isNaN(lastAccess)) {
Cu.reportError("Invalid timestamp for last geolocation access");
return;
}
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem");
let indicator = document.createXULElement("hbox");
indicator.setAttribute("class", "permission-popup-permission-item");
indicator.setAttribute("align", "center");
indicator.setAttribute("id", "geo-access-indicator-item");
let timeFormat = new Services.intl.RelativeTimeFormat(undefined, {});
let text = document.createXULElement("label");
text.setAttribute("flex", "1");
text.setAttribute("class", "permission-popup-permission-label");
text.textContent = gNavigatorBundle.getFormattedString(
"geolocationLastAccessIndicatorText",
[timeFormat.formatBestUnit(lastAccess)]
);
indicator.appendChild(icon);
indicator.appendChild(text);
geoContainer.appendChild(indicator);
},
_createProtocolHandlerPermissionItem(permission, key) {
let container = document.getElementById(
"permission-popup-open-protocol-handler-container"
);
let initialCall;
if (!container) {
// First open-protocol-handler permission, create container.
container = this._createPermissionItem({
permission,
isContainer: true,
permClearButton: false,
showStateLabel: false,
idNoSuffix: "open-protocol-handler",
});
initialCall = true;
}
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem-no-arrow");
let item = document.createXULElement("hbox");
item.setAttribute("class", "permission-popup-permission-item");
item.setAttribute("align", "center");
let text = document.createXULElement("label");
text.setAttribute("flex", "1");
text.setAttribute("class", "permission-popup-permission-label-subitem");
text.textContent = gNavigatorBundle.getFormattedString(
"openProtocolHandlerPermissionEntryLabel",
[key]
);
let stateLabel = this._createStateLabel(
permission,
"open-protocol-handler"
);
item.appendChild(text);
item.appendChild(stateLabel);
let button = this._createPermissionClearButton(permission, item, () => {
// When we're clearing the last open-protocol-handler permission, clean up
// the empty container.
// (<= 1 because the heading item is also a child of the container)
if (container.childElementCount <= 1) {
container.remove();
}
});
item.appendChild(button);
container.appendChild(item);
// If container already exists in permission list, don't return it again.
return initialCall && container;
},
_createBlockedPopupIndicator(aTotalBlockedPopups) {
let indicator = document.createXULElement("hbox");
indicator.setAttribute("class", "permission-popup-permission-item");
indicator.setAttribute("align", "center");
indicator.setAttribute("id", "blocked-popup-indicator-item");
let icon = document.createXULElement("image");
icon.setAttribute("class", "popup-subitem");
let text = document.createXULElement("label", { is: "text-link" });
text.setAttribute("flex", "1");
text.setAttribute("class", "permission-popup-permission-label");
let messageBase = gNavigatorBundle.getString(
"popupShowBlockedPopupsIndicatorText"
);
let message = PluralForm.get(aTotalBlockedPopups, messageBase).replace(
"#1",
aTotalBlockedPopups
);
text.textContent = message;
text.addEventListener("click", () => {
gBrowser.selectedBrowser.popupBlocker.unblockAllPopups();
});
indicator.appendChild(icon);
indicator.appendChild(text);
document
.getElementById("permission-popup-container")
.appendChild(indicator);
},
};

Просмотреть файл

@ -999,7 +999,7 @@ var ThirdPartyCookies = {
}
let removeException = document.createXULElement("button");
removeException.className = "permission-popup-permission-remove-button";
removeException.className = "identity-popup-permission-remove-button";
removeException.tooltipText = gNavigatorBundle.getFormattedString(
"contentBlocking.cookiesView.removeButton.tooltip",
[origin]

Просмотреть файл

@ -738,7 +738,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
min-width: 280px;
}
#identity-icon-box {
#identity-box {
max-width: calc(30px + 10em);
}
@ -752,7 +752,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
:root[customizing] #urlbar-container {
min-width: 245px;
}
#identity-icon-box {
#identity-box {
max-width: 80px;
}
/* Contenxtual identity labels are user-customizable and can be very long,
@ -779,7 +779,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
#nav-bar[downloadsbuttonshown] #urlbar-container {
min-width: 225px;
}
#identity-icon-box {
#identity-box {
max-width: 70px;
}
#urlbar-zoom-button {

Просмотреть файл

@ -165,11 +165,6 @@ XPCOMUtils.defineLazyScriptGetter(
"gIdentityHandler",
"chrome://browser/content/browser-siteIdentity.js"
);
XPCOMUtils.defineLazyScriptGetter(
this,
"gPermissionPanel",
"chrome://browser/content/browser-sitePermissionPanel.js"
);
XPCOMUtils.defineLazyScriptGetter(
this,
"gProtectionsHandler",
@ -1041,7 +1036,7 @@ var gPopupBlockerObserver = {
return;
}
gPermissionPanel.refreshPermissionIcons();
gIdentityHandler.refreshIdentityBlock();
let popupCount = gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount();
@ -3485,7 +3480,6 @@ function BrowserReloadWithFlags(reloadFlags) {
delete tab.linkedBrowser.authPromptAbuseCounter;
}
gIdentityHandler.hidePopup();
gPermissionPanel.hidePopup();
let handlingUserInput = window.windowUtils.isHandlingUserInput;
@ -5156,7 +5150,7 @@ var XULBrowserWindow = {
);
}
gPermissionPanel.onLocationChange();
gIdentityHandler.onLocationChange();
gProtectionsHandler.onLocationChange();

Просмотреть файл

@ -632,7 +632,6 @@
#include ../../components/customizableui/content/panelUI.inc.xhtml
#include ../../components/controlcenter/content/identityPanel.inc.xhtml
#include ../../components/controlcenter/content/permissionPanel.inc.xhtml
#include ../../components/controlcenter/content/protectionsPanel.inc.xhtml
#include ../../components/downloads/content/downloadsPanel.inc.xhtml
#include ../../../devtools/startup/enableDevToolsPopup.inc.xhtml
@ -1865,63 +1864,53 @@
<description id="tracking-protection-icon-tooltip-label" class="tooltip-label"/>
</tooltip>
</box>
<box id="identity-box"
<box id="identity-box" role="button"
align="center"
data-l10n-id="urlbar-identity-button"
pageproxystate="invalid"
onclick="gIdentityHandler.handleIdentityButtonEvent(event);"
onkeypress="gIdentityHandler.handleIdentityButtonEvent(event);"
ondragstart="gIdentityHandler.onDragStart(event);">
<box id="identity-icon-box"
role="button"
align="center"
data-l10n-id="urlbar-identity-button"
class="identity-box-button"
onclick="gIdentityHandler.handleIdentityButtonEvent(event); PageProxyClickHandler(event);"
onkeypress="gIdentityHandler.handleIdentityButtonEvent(event);">
<image id="identity-icon"/>
<image id="remote-control-icon"
data-l10n-id="urlbar-remote-control-notification-anchor"/>
<label id="identity-icon-label" class="plain" crop="center" flex="1"/>
<image id="identity-icon"
consumeanchor="identity-box"
onclick="PageProxyClickHandler(event);"/>
<image id="permissions-granted-icon"
data-l10n-id="urlbar-permissions-granted"/>
<box style="pointer-events: none;">
<image class="sharing-icon" id="webrtc-sharing-icon"/>
<image class="sharing-icon geo-icon" id="geo-sharing-icon"/>
<image class="sharing-icon xr-icon" id="xr-sharing-icon"/>
</box>
<box id="identity-permission-box"
data-l10n-id="urlbar-permissions-granted"
role="button"
align="center"
class="identity-box-button"
onclick="gPermissionPanel.handleIdentityButtonEvent(event); PageProxyClickHandler(event);"
onkeypress="gPermissionPanel.handleIdentityButtonEvent(event);">
<image id="permissions-granted-icon"/>
<box style="pointer-events: none;">
<image class="sharing-icon" id="webrtc-sharing-icon"/>
<image class="sharing-icon geo-icon" id="geo-sharing-icon"/>
<image class="sharing-icon xr-icon" id="xr-sharing-icon"/>
</box>
<box id="blocked-permissions-container" align="center">
<image data-permission-id="geo" class="blocked-permission-icon geo-icon" role="button"
data-l10n-id="urlbar-geolocation-blocked"/>
<image data-permission-id="xr" class="blocked-permission-icon xr-icon" role="button"
data-l10n-id="urlbar-xr-blocked"/>
<image data-permission-id="desktop-notification" class="blocked-permission-icon desktop-notification-icon" role="button"
data-l10n-id="urlbar-web-notifications-blocked"/>
<image data-permission-id="camera" class="blocked-permission-icon camera-icon" role="button"
data-l10n-id="urlbar-camera-blocked"/>
<image data-permission-id="microphone" class="blocked-permission-icon microphone-icon" role="button"
data-l10n-id="urlbar-microphone-blocked"/>
<image data-permission-id="screen" class="blocked-permission-icon screen-icon" role="button"
data-l10n-id="urlbar-screen-blocked"/>
<image data-permission-id="persistent-storage" class="blocked-permission-icon persistent-storage-icon" role="button"
data-l10n-id="urlbar-persistent-storage-blocked"/>
<image data-permission-id="popup" class="blocked-permission-icon popup-icon" role="button"
data-l10n-id="urlbar-popup-blocked"/>
<image data-permission-id="autoplay-media" class="blocked-permission-icon autoplay-media-icon" role="button"
data-l10n-id="urlbar-autoplay-media-blocked"/>
<image data-permission-id="canvas" class="blocked-permission-icon canvas-icon" role="button"
data-l10n-id="urlbar-canvas-blocked"/>
<image data-permission-id="midi" class="blocked-permission-icon midi-icon" role="button"
data-l10n-id="urlbar-midi-blocked"/>
<image data-permission-id="install" class="blocked-permission-icon install-icon" role="button"
data-l10n-id="urlbar-install-blocked"/>
</box>
<box id="blocked-permissions-container" align="center">
<image data-permission-id="geo" class="blocked-permission-icon geo-icon" role="button"
data-l10n-id="urlbar-geolocation-blocked"/>
<image data-permission-id="xr" class="blocked-permission-icon xr-icon" role="button"
data-l10n-id="urlbar-xr-blocked"/>
<image data-permission-id="desktop-notification" class="blocked-permission-icon desktop-notification-icon" role="button"
data-l10n-id="urlbar-web-notifications-blocked"/>
<image data-permission-id="camera" class="blocked-permission-icon camera-icon" role="button"
data-l10n-id="urlbar-camera-blocked"/>
<image data-permission-id="microphone" class="blocked-permission-icon microphone-icon" role="button"
data-l10n-id="urlbar-microphone-blocked"/>
<image data-permission-id="screen" class="blocked-permission-icon screen-icon" role="button"
data-l10n-id="urlbar-screen-blocked"/>
<image data-permission-id="persistent-storage" class="blocked-permission-icon persistent-storage-icon" role="button"
data-l10n-id="urlbar-persistent-storage-blocked"/>
<image data-permission-id="popup" class="blocked-permission-icon popup-icon" role="button"
data-l10n-id="urlbar-popup-blocked"/>
<image data-permission-id="autoplay-media" class="blocked-permission-icon autoplay-media-icon" role="button"
data-l10n-id="urlbar-autoplay-media-blocked"/>
<image data-permission-id="canvas" class="blocked-permission-icon canvas-icon" role="button"
data-l10n-id="urlbar-canvas-blocked"/>
<image data-permission-id="midi" class="blocked-permission-icon midi-icon" role="button"
data-l10n-id="urlbar-midi-blocked"/>
<image data-permission-id="install" class="blocked-permission-icon install-icon" role="button"
data-l10n-id="urlbar-install-blocked"/>
</box>
<box id="notification-popup-box"
hidden="true"
onmouseover="document.getElementById('identity-box').classList.add('no-hover');"
onmouseout="document.getElementById('identity-box').classList.remove('no-hover');"
align="center">
<image id="default-notification-icon" class="notification-anchor-icon" role="button"
data-l10n-id="urlbar-default-notification-anchor"/>
@ -1968,6 +1957,9 @@
<image id="storage-access-notification-icon" class="notification-anchor-icon storage-access-icon" role="button"
data-l10n-id="urlbar-storage-access-anchor"/>
</box>
<image id="remote-control-icon"
data-l10n-id="urlbar-remote-control-notification-anchor"/>
<label id="identity-icon-label" class="plain" crop="center" flex="1"/>
</box>
<box id="urlbar-label-box" align="center">
<label id="urlbar-label-switchtab" class="urlbar-label" data-l10n-id="urlbar-switch-to-tab"/>

Просмотреть файл

@ -1227,7 +1227,7 @@
}
updateUserContextUIIndicator();
gPermissionPanel.updateSharingIndicator();
gIdentityHandler.updateSharingIndicator();
// Enable touch events to start a native dragging
// session to allow the user to easily drag the selected tab.
@ -1402,7 +1402,7 @@
tab.removeAttribute("sharing");
this._tabAttrModified(tab, ["sharing"]);
if (aBrowser == this.selectedBrowser) {
gPermissionPanel.updateSharingIndicator();
gIdentityHandler.updateSharingIndicator();
}
},
@ -1431,7 +1431,7 @@
}
if (aBrowser == this.selectedBrowser) {
gPermissionPanel.updateSharingIndicator();
gIdentityHandler.updateSharingIndicator();
}
},
@ -4187,7 +4187,6 @@
// Also reset DOS mitigations for the basic auth prompt on reload.
delete browser.authPromptAbuseCounter;
gIdentityHandler.hidePopup();
gPermissionPanel.hidePopup();
browser.reload();
},

Просмотреть файл

@ -21,9 +21,7 @@ add_task(async function test_identityPopupCausesFSExit() {
BrowserTestUtils.loadURI(browser, url);
await loaded;
let identityPermissionBox = document.getElementById(
"identity-permission-box"
);
let identityBox = document.getElementById("identity-box");
info("Entering DOM fullscreen");
await changeFullscreen(browser, true);
@ -32,16 +30,16 @@ add_task(async function test_identityPopupCausesFSExit() {
window,
"popupshown",
true,
event => event.target == document.getElementById("permission-popup")
event => event.target == document.getElementById("identity-popup")
);
let fsExit = waitForFullScreenState(browser, false);
identityPermissionBox.click();
identityBox.click();
info("Waiting for fullscreen exit and permission popup to show");
info("Waiting for fullscreen exit and identity popup to show");
await Promise.all([fsExit, popupShown]);
let identityPopup = document.getElementById("permission-popup");
let identityPopup = document.getElementById("identity-popup");
ok(
identityPopup.hasAttribute("panelopen"),
"Identity popup should be open"

Просмотреть файл

@ -20,7 +20,7 @@ add_task(async function() {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let promiseViewShown = BrowserTestUtils.waitForEvent(

Просмотреть файл

@ -353,25 +353,18 @@ add_task(async function testPanelCloseRestoresFocus() {
// Test that the arrow key works in the group of the
// 'tracking-protection-icon-container' and the 'identity-box'.
add_task(async function testArrowKeyForTPIconContainerandIdentityBox() {
await BrowserTestUtils.withNewTab("https://example.com", async function(
browser
) {
// Simulate geo sharing so the permission box shows
gBrowser.updateBrowserSharing(browser, { geo: true });
await BrowserTestUtils.withNewTab("https://example.com", async function() {
await waitUntilReloadEnabled();
startFromUrlBar();
await expectFocusAfterKey(
"Shift+Tab",
"tracking-protection-icon-container"
);
await expectFocusAfterKey("ArrowRight", "identity-icon-box");
await expectFocusAfterKey("ArrowRight", "identity-permission-box");
await expectFocusAfterKey("ArrowLeft", "identity-icon-box");
await expectFocusAfterKey("ArrowRight", "identity-box");
await expectFocusAfterKey(
"ArrowLeft",
"tracking-protection-icon-container"
);
gBrowser.updateBrowserSharing(browser, { geo: false });
});
});

Просмотреть файл

@ -29,23 +29,23 @@ const EMPTY_PAGE =
const AUTOPLAY_PREF = "media.autoplay.default";
const AUTOPLAY_PERM = "autoplay-media";
function openPermissionPopup() {
function openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
gBrowser.ownerGlobal,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
gIdentityHandler._identityBox.click();
return promise;
}
function closePermissionPopup() {
function closeIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
gPermissionPanel._permissionPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
@ -58,7 +58,7 @@ function autoplayBlockedIcon() {
function permissionListBlockedIcons() {
return document.querySelectorAll(
"image.permission-popup-permission-icon.blocked-permission-icon"
"image.identity-popup-permission-icon.blocked-permission-icon"
);
}
@ -79,20 +79,6 @@ async function blockedIconHidden() {
}, "Blocked icon is hidden");
}
function testPermListHasEntries(expectEntries) {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
);
let listEntryCount = permissionsList.querySelectorAll(
".permission-popup-permission-item"
).length;
if (expectEntries) {
ok(listEntryCount, "List of permissions is not empty");
return;
}
ok(!listEntryCount, "List of permissions is empty");
}
add_task(async function setup() {
registerCleanupFunction(() => {
Services.perms.removeAll();
@ -104,36 +90,44 @@ add_task(async function testMainViewVisible() {
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.ALLOWED);
await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function() {
let permissionsList = document.getElementById(
"identity-popup-permission-list"
);
let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
ok(
BrowserTestUtils.is_hidden(autoplayBlockedIcon()),
"Blocked icon not shown"
);
await openPermissionPopup();
testPermListHasEntries(false);
await closePermissionPopup();
await openIdentityPopup();
ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
await closeIdentityPopup();
});
Services.prefs.setIntPref(AUTOPLAY_PREF, Ci.nsIAutoplay.BLOCKED);
await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function(browser) {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
await blockedIconShown();
await openPermissionPopup();
testPermListHasEntries(true);
await openIdentityPopup();
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
let labelText = SitePermissions.getPermissionLabel(AUTOPLAY_PERM);
let labels = permissionsList.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in main view");
is(labels[0].textContent, labelText, "Correct value");
let menulist = document.getElementById("permission-popup-menulist");
let menulist = document.getElementById("identity-popup-popup-menulist");
Assert.equal(menulist.label, "Block Audio");
await EventUtils.synthesizeMouseAtCenter(menulist, { type: "mousedown" });
@ -149,7 +143,7 @@ add_task(async function testMainViewVisible() {
menuitem.click();
menulist.menupopup.hidePopup();
await closePermissionPopup();
await closeIdentityPopup();
let uri = Services.io.newURI(AUTOPLAY_PAGE);
let state = PermissionTestUtils.getPermissionObject(uri, AUTOPLAY_PERM)
@ -317,7 +311,7 @@ add_task(async function testBlockedAll() {
BrowserTestUtils.loadURI(browser, MUTED_AUTOPLAY_PAGE);
await blockedIconShown();
await openPermissionPopup();
await openIdentityPopup();
Assert.equal(
permissionListBlockedIcons().length,
@ -325,7 +319,7 @@ add_task(async function testBlockedAll() {
"Blocked icon is shown"
);
let menulist = document.getElementById("permission-popup-menulist");
let menulist = document.getElementById("identity-popup-popup-menulist");
await EventUtils.synthesizeMouseAtCenter(menulist, { type: "mousedown" });
await TestUtils.waitForCondition(() => {
return (
@ -336,7 +330,7 @@ add_task(async function testBlockedAll() {
let menuitem = menulist.getElementsByTagName("menuitem")[0];
menuitem.click();
menulist.menupopup.hidePopup();
await closePermissionPopup();
await closeIdentityPopup();
gBrowser.reload();
await blockedIconHidden();
});

Просмотреть файл

@ -11,50 +11,37 @@ const kStrictKeyPressEvents = SpecialPowers.getBoolPref(
"dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content"
);
function openPermissionPopup() {
function openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
window,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
gIdentityHandler._identityBox.click();
return promise;
}
function closePermissionPopup() {
function closeIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
gPermissionPanel._permissionPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
function testPermListHasEntries(expectEntries) {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
);
let listEntryCount = permissionsList.querySelectorAll(
".permission-popup-permission-item"
).length;
if (expectEntries) {
ok(listEntryCount, "List of permissions is not empty");
return;
}
ok(!listEntryCount, "List of permissions is empty");
}
add_task(async function testMainViewVisible() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function() {
await openPermissionPopup();
await openIdentityPopup();
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
testPermListHasEntries(false);
let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.add(
gBrowser.currentURI,
@ -62,32 +49,35 @@ add_task(async function testMainViewVisible() {
Services.perms.ALLOW_ACTION
);
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(true);
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
let labelText = SitePermissions.getPermissionLabel("camera");
let labels = permissionsList.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in main view");
is(labels[0].textContent, labelText, "Correct value");
let img = permissionsList.querySelector(
"image.permission-popup-permission-icon"
"image.identity-popup-permission-icon"
);
ok(img, "There is an image for the permissions");
ok(img.classList.contains("camera-icon"), "proper class is in image class");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.remove(gBrowser.currentURI, "camera");
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(false);
ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
await closePermissionPopup();
await closeIdentityPopup();
});
});
@ -100,18 +90,14 @@ add_task(async function testIdentityIcon() {
);
ok(
gPermissionPanel._identityPermissionBox.hasAttribute(
"hasGrantedPermissions"
),
gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions"
);
PermissionTestUtils.remove(gBrowser.currentURI, "geo");
ok(
!gPermissionPanel._identityPermissionBox.hasAttribute(
"hasGrantedPermissions"
),
!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions"
);
@ -122,9 +108,7 @@ add_task(async function testIdentityIcon() {
);
ok(
!gPermissionPanel._identityPermissionBox.hasAttribute(
"hasGrantedPermissions"
),
!gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box doesn't signal granted permissions"
);
@ -135,9 +119,7 @@ add_task(async function testIdentityIcon() {
);
ok(
gPermissionPanel._identityPermissionBox.hasAttribute(
"hasGrantedPermissions"
),
gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions"
);
@ -150,8 +132,9 @@ add_task(async function testIdentityIcon() {
add_task(async function testCancelPermission() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function() {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
PermissionTestUtils.add(
gBrowser.currentURI,
@ -164,50 +147,57 @@ add_task(async function testCancelPermission() {
Services.perms.DENY_ACTION
);
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(true);
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
permissionsList
.querySelector(".permission-popup-permission-remove-button")
.querySelector(".identity-popup-permission-remove-button")
.click();
is(
permissionsList.querySelectorAll(".permission-popup-permission-label")
permissionsList.querySelectorAll(".identity-popup-permission-label")
.length,
1,
"First permission should be removed"
);
permissionsList
.querySelector(".permission-popup-permission-remove-button")
.querySelector(".identity-popup-permission-remove-button")
.click();
is(
permissionsList.querySelectorAll(".permission-popup-permission-label")
permissionsList.querySelectorAll(".identity-popup-permission-label")
.length,
0,
"Second permission should be removed"
);
await closePermissionPopup();
await closeIdentityPopup();
});
});
add_task(async function testPermissionHints() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
let emptyHint = document.getElementById(
"identity-popup-permission-empty-hint"
);
let reloadHint = document.getElementById(
"permission-popup-permission-reload-hint"
"identity-popup-permission-reload-hint"
);
await openPermissionPopup();
await openIdentityPopup();
ok(!BrowserTestUtils.is_hidden(emptyHint), "Empty hint is visible");
ok(BrowserTestUtils.is_hidden(reloadHint), "Reload hint is hidden");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.add(
gBrowser.currentURI,
@ -220,33 +210,40 @@ add_task(async function testPermissionHints() {
Services.perms.DENY_ACTION
);
await openPermissionPopup();
await openIdentityPopup();
ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
ok(BrowserTestUtils.is_hidden(reloadHint), "Reload hint is hidden");
let cancelButtons = permissionsList.querySelectorAll(
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
PermissionTestUtils.remove(gBrowser.currentURI, "camera");
cancelButtons[0].click();
ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
ok(!BrowserTestUtils.is_hidden(reloadHint), "Reload hint is visible");
cancelButtons[1].click();
ok(BrowserTestUtils.is_hidden(emptyHint), "Empty hint is hidden");
ok(!BrowserTestUtils.is_hidden(reloadHint), "Reload hint is visible");
await closePermissionPopup();
await closeIdentityPopup();
let loaded = BrowserTestUtils.browserLoaded(browser);
BrowserTestUtils.loadURI(browser, PERMISSIONS_PAGE);
await loaded;
await openPermissionPopup();
await openIdentityPopup();
ok(
!BrowserTestUtils.is_hidden(emptyHint),
"Empty hint is visible after reloading"
);
ok(
BrowserTestUtils.is_hidden(reloadHint),
"Reload hint is hidden after reloading"
);
await closePermissionPopup();
await closeIdentityPopup();
});
});
@ -263,12 +260,12 @@ add_task(async function testPermissionIcons() {
Services.perms.DENY_ACTION
);
let geoIcon = gPermissionPanel._identityPermissionBox.querySelector(
let geoIcon = gIdentityHandler._identityBox.querySelector(
".blocked-permission-icon[data-permission-id='geo']"
);
ok(geoIcon.hasAttribute("showing"), "blocked permission icon is shown");
let cameraIcon = gPermissionPanel._identityPermissionBox.querySelector(
let cameraIcon = gIdentityHandler._identityBox.querySelector(
".blocked-permission-icon[data-permission-id='camera']"
);
ok(
@ -377,7 +374,7 @@ add_task(async function testPolicyPermission() {
});
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
PermissionTestUtils.add(
gBrowser.currentURI,
@ -386,20 +383,18 @@ add_task(async function testPolicyPermission() {
Services.perms.EXPIRE_POLICY
);
await openPermissionPopup();
await openIdentityPopup();
// Check if the icon, nameLabel and stateLabel are visible.
let img, labelText, labels;
img = permissionsList.querySelector(
"image.permission-popup-permission-icon"
);
img = permissionsList.querySelector("image.identity-popup-permission-icon");
ok(img, "There is an image for the popup permission");
ok(img.classList.contains("popup-icon"), "proper class is in image class");
labelText = SitePermissions.getPermissionLabel("popup");
labels = permissionsList.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in main view");
is(labels[0].textContent, labelText, "Correct name label value");
@ -409,36 +404,36 @@ add_task(async function testPolicyPermission() {
SitePermissions.SCOPE_POLICY
);
labels = permissionsList.querySelectorAll(
".permission-popup-permission-state-label"
".identity-popup-permission-state-label"
);
is(labels[0].textContent, labelText, "Correct state label value");
// Check if the menulist and the remove button are hidden.
// The menulist is specific to the "popup" permission.
let menulist = document.getElementById("permission-popup-menulist");
let menulist = document.getElementById("identity-popup-popup-menulist");
ok(menulist == null, "The popup permission menulist is not visible");
let removeButton = permissionsList.querySelector(
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
ok(removeButton == null, "The permission remove button is not visible");
Services.perms.removeAll();
await closePermissionPopup();
await closeIdentityPopup();
});
});
add_task(async function testHiddenAfterRefresh() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
ok(
BrowserTestUtils.is_hidden(gPermissionPanel._permissionPopup),
BrowserTestUtils.is_hidden(gIdentityHandler._identityPopup),
"Popup is hidden"
);
await openPermissionPopup();
await openIdentityPopup();
ok(
!BrowserTestUtils.is_hidden(gPermissionPanel._permissionPopup),
!BrowserTestUtils.is_hidden(gIdentityHandler._identityPopup),
"Popup is shown"
);
@ -451,7 +446,7 @@ add_task(async function testHiddenAfterRefresh() {
await reloaded;
ok(
BrowserTestUtils.is_hidden(gPermissionPanel._permissionPopup),
BrowserTestUtils.is_hidden(gIdentityHandler._identityPopup),
"Popup is hidden"
);
});
@ -467,23 +462,22 @@ add_task(async function test3rdPartyStoragePermission() {
});
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(browser) {
await openPermissionPopup();
await openIdentityPopup();
let permissionsList = document.getElementById(
"permission-popup-permission-list"
"identity-popup-permission-list"
);
let storagePermissionAnchor = permissionsList.querySelector(
`.permission-popup-permission-list-anchor[anchorfor="3rdPartyStorage"]`
`.identity-popup-permission-list-anchor[anchorfor="3rdPartyStorage"]`
);
testPermListHasEntries(false);
let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
ok(
BrowserTestUtils.is_hidden(storagePermissionAnchor.firstElementChild),
"Anchor header is hidden"
);
await closePermissionPopup();
await closeIdentityPopup();
let storagePermissionID = "3rdPartyStorage^example2.com";
PermissionTestUtils.add(
@ -492,9 +486,12 @@ add_task(async function test3rdPartyStoragePermission() {
Services.perms.ALLOW_ACTION
);
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(true);
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
ok(
BrowserTestUtils.is_visible(storagePermissionAnchor.firstElementChild),
"Anchor header is visible"
@ -502,7 +499,7 @@ add_task(async function test3rdPartyStoragePermission() {
let labelText = SitePermissions.getPermissionLabel(storagePermissionID);
let labels = storagePermissionAnchor.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in 3rdPartyStorage anchor");
is(
@ -511,7 +508,7 @@ add_task(async function test3rdPartyStoragePermission() {
"Permission label has the correct value"
);
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.add(
browser.currentURI,
@ -519,29 +516,32 @@ add_task(async function test3rdPartyStoragePermission() {
Services.perms.ALLOW_ACTION
);
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(true);
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
ok(
BrowserTestUtils.is_visible(storagePermissionAnchor.firstElementChild),
"Anchor header is visible"
);
labels = permissionsList.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 2, "Two permissions visible in main view");
labels = storagePermissionAnchor.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in 3rdPartyStorage anchor");
storagePermissionAnchor
.querySelector(".permission-popup-permission-remove-button")
.querySelector(".identity-popup-permission-remove-button")
.click();
is(
storagePermissionAnchor.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
).length,
0,
"Permission item should be removed"
@ -555,33 +555,36 @@ add_task(async function test3rdPartyStoragePermission() {
"Permission removed from permission manager"
);
await closePermissionPopup();
await closeIdentityPopup();
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(true);
ok(
BrowserTestUtils.is_hidden(emptyLabel),
"List of permissions is not empty"
);
ok(
BrowserTestUtils.is_hidden(storagePermissionAnchor.firstElementChild),
"Anchor header is hidden"
);
labels = permissionsList.querySelectorAll(
".permission-popup-permission-label"
".identity-popup-permission-label"
);
is(labels.length, 1, "One permission visible in main view");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.remove(browser.currentURI, "camera");
await openPermissionPopup();
await openIdentityPopup();
testPermListHasEntries(false);
ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
ok(
BrowserTestUtils.is_hidden(storagePermissionAnchor.firstElementChild),
"Anchor header is hidden"
);
await closePermissionPopup();
await closeIdentityPopup();
});
});

Просмотреть файл

@ -44,7 +44,7 @@ add_task(async function testTempPermissionRequestAfterExpiry() {
await BrowserTestUtils.withNewTab(PERMISSIONS_PAGE, async function(
browser
) {
let blockedIcon = gPermissionPanel._identityPermissionBox.querySelector(
let blockedIcon = gIdentityHandler._identityBox.querySelector(
`.blocked-permission-icon[data-permission-id='${id}']`
);

Просмотреть файл

@ -22,23 +22,23 @@ const PRINCIPAL = Services.scriptSecurityManager.createContentPrincipal(
{}
);
function openPermissionPopup() {
function openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
window,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
gIdentityHandler._identityBox.click();
return promise;
}
function closePermissionPopup() {
function closeIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
gPermissionPanel._permissionPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
@ -56,12 +56,12 @@ add_task(async function check_blocked_popup_indicator() {
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, URL);
// Blocked popup indicator should not exist in the identity popup when there are no blocked popups.
await openPermissionPopup();
await openIdentityPopup();
Assert.equal(document.getElementById("blocked-popup-indicator-item"), null);
await closePermissionPopup();
await closeIdentityPopup();
// Blocked popup notification icon should be hidden in the identity block when no popups are blocked.
let icon = gPermissionPanel._identityPermissionBox.querySelector(
let icon = gIdentityHandler._identityBox.querySelector(
".blocked-permission-icon[data-permission-id='popup']"
);
Assert.equal(icon.hasAttribute("showing"), false);
@ -77,18 +77,18 @@ add_task(async function check_blocked_popup_indicator() {
);
// Check if blocked popup indicator text is visible in the identity popup. It should be visible.
document.getElementById("identity-permission-box").click();
await openPermissionPopup();
document.getElementById("identity-icon").click();
await openIdentityPopup();
await TestUtils.waitForCondition(
() => document.getElementById("blocked-popup-indicator-item") !== null
);
// Check that the default state is correctly set to "Block".
let menulist = document.getElementById("permission-popup-menulist");
let menulist = document.getElementById("identity-popup-popup-menulist");
Assert.equal(menulist.value, "0");
Assert.equal(menulist.label, "Block");
await closePermissionPopup();
await closeIdentityPopup();
// Check if blocked popup icon is visible in the identity block.
Assert.equal(icon.getAttribute("showing"), "true");
@ -118,7 +118,7 @@ add_task(async function check_popup_showing() {
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen);
// Open identity popup and click on "Show blocked popups".
await openPermissionPopup();
await openIdentityPopup();
let e = document.getElementById("blocked-popup-indicator-item");
let text = e.getElementsByTagName("label")[0];
text.click();
@ -159,12 +159,12 @@ add_task(async function check_permission_state_change() {
);
// Open identity popup and change permission state to allow.
await openPermissionPopup();
let menulist = document.getElementById("permission-popup-menulist");
await openIdentityPopup();
let menulist = document.getElementById("identity-popup-popup-menulist");
menulist.menupopup.openPopup(); // Open the allow/block menu
let menuitem = menulist.getElementsByTagName("menuitem")[0];
menuitem.click();
await closePermissionPopup();
await closeIdentityPopup();
state = SitePermissions.getForPrincipal(PRINCIPAL, "popup", gBrowser).state;
Assert.equal(state, SitePermissions.ALLOW);
@ -198,12 +198,12 @@ add_task(async function check_permission_state_change() {
gBrowser.removeTab(popup);
// Open identity popup and change permission state to block.
await openPermissionPopup();
menulist = document.getElementById("permission-popup-menulist");
await openIdentityPopup();
menulist = document.getElementById("identity-popup-popup-menulist");
menulist.menupopup.openPopup(); // Open the allow/block menu
menuitem = menulist.getElementsByTagName("menuitem")[1];
menuitem.click();
await closePermissionPopup();
await closeIdentityPopup();
// Clicking on the "Block" menuitem should remove the permission object(same behavior as UNKNOWN state).
// We have already confirmed that popups are blocked when the permission state is BLOCK.
@ -222,19 +222,19 @@ add_task(async function check_explicit_default_permission() {
// since SitePermissions.jsm considers setting default permissions to be removal.
PermissionTestUtils.add(URI, "popup", Ci.nsIPermissionManager.DENY_ACTION);
await openPermissionPopup();
let menulist = document.getElementById("permission-popup-menulist");
await openIdentityPopup();
let menulist = document.getElementById("identity-popup-popup-menulist");
Assert.equal(menulist.value, "0");
Assert.equal(menulist.label, "Block");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.add(URI, "popup", Services.perms.ALLOW_ACTION);
await openPermissionPopup();
menulist = document.getElementById("permission-popup-menulist");
await openIdentityPopup();
menulist = document.getElementById("identity-popup-popup-menulist");
Assert.equal(menulist.value, "1");
Assert.equal(menulist.label, "Allow");
await closePermissionPopup();
await closeIdentityPopup();
PermissionTestUtils.remove(URI, "popup");
gBrowser.removeTab(tab);

Просмотреть файл

@ -328,7 +328,7 @@ add_task(async function testCookiesSubViewAllowed() {
);
let button = listItem.querySelector(
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
ok(
BrowserTestUtils.is_visible(button),
@ -431,7 +431,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
);
let button = listItem.querySelector(
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
ok(
BrowserTestUtils.is_visible(button),
@ -501,7 +501,7 @@ add_task(async function testCookiesSubViewBlockedDoublyNested() {
);
let button = listItem.querySelector(
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
ok(!button, "Permission remove button doesn't exist");

Просмотреть файл

@ -20,14 +20,14 @@ function getIdentityMode(aWindow = window) {
function getConnectionState() {
// Prevents items that are being lazy loaded causing issues
document.getElementById("identity-icon-box").click();
document.getElementById("identity-box").click();
gIdentityHandler.refreshIdentityPopup();
return document.getElementById("identity-popup").getAttribute("connection");
}
function getSecurityConnectionBG() {
// Get the background image of the security connection.
document.getElementById("identity-icon-box").click();
document.getElementById("identity-box").click();
gIdentityHandler.refreshIdentityPopup();
return gBrowser.ownerGlobal
.getComputedStyle(
@ -40,7 +40,7 @@ function getSecurityConnectionBG() {
function getReaderModeURL() {
// Gets the reader mode URL from "identity-popup mainView panel header span"
document.getElementById("identity-icon-box").click();
document.getElementById("identity-box").click();
gIdentityHandler.refreshIdentityPopup();
return document.getElementById("identity-popup-mainView-panel-header-span")
.innerHTML;

Просмотреть файл

@ -64,7 +64,7 @@ async function checkForDOMElement(state, id) {
return el;
}
async function testPermissionPopupGeoContainer(
async function testIdentityPopupGeoContainer(
containerVisible,
timestampVisible
) {
@ -74,14 +74,14 @@ async function testPermissionPopupGeoContainer(
ok(false, "Can't have timestamp without container");
}
// Only call openPermissionPopup if popup is closed, otherwise it does not resolve
if (!gPermissionPanel._identityPermissionBox.hasAttribute("open")) {
await openPermissionPopup();
// Only call openIdentityPopup if popup is closed, otherwise it does not resolve
if (!gIdentityHandler._identityBox.hasAttribute("open")) {
await openIdentityPopup();
}
let checkContainer = checkForDOMElement(
containerVisible,
"permission-popup-geo-container"
"identity-popup-geo-container"
);
if (containerVisible && timestampVisible) {
@ -90,11 +90,11 @@ async function testPermissionPopupGeoContainer(
let container = await checkContainer;
await BrowserTestUtils.waitForCondition(
() => container.childElementCount == 2,
"permission-popup-geo-container should have two elements."
"identity-popup-geo-container should have two elements."
);
is(
container.childNodes[0].classList[0],
"permission-popup-permission-item",
"identity-popup-permission-item",
"Geo container should have permission item."
);
is(
@ -249,14 +249,14 @@ async function testIndicatorExplicitAllow(persistent) {
await Promise.all([
testGeoSharingIconVisible(true),
testPermissionPopupGeoContainer(true, true),
testIdentityPopupGeoContainer(true, true),
testGeoLocationLastAccessSet(tab.linkedBrowser),
]);
await cleanup(tab);
}
// Indicator and permission popup entry shown after explicit PermissionUI geolocation allow
// Indicator and identity popup entry shown after explicit PermissionUI geolocation allow
add_task(function test_indicator_and_timestamp_after_explicit_allow() {
return testIndicatorExplicitAllow(false);
});
@ -264,7 +264,7 @@ add_task(function test_indicator_and_timestamp_after_explicit_allow_remember() {
return testIndicatorExplicitAllow(true);
});
// Indicator and permission popup entry shown after auto PermissionUI geolocation allow
// Indicator and identity popup entry shown after auto PermissionUI geolocation allow
add_task(async function test_indicator_and_timestamp_after_implicit_allow() {
PermissionTestUtils.add(
EXAMPLE_PAGE_URI,
@ -278,7 +278,7 @@ add_task(async function test_indicator_and_timestamp_after_implicit_allow() {
await Promise.all([
testGeoSharingIconVisible(true),
testPermissionPopupGeoContainer(true, true),
testIdentityPopupGeoContainer(true, true),
testGeoLocationLastAccessSet(tab.linkedBrowser),
]);
@ -295,8 +295,8 @@ add_task(function test_indicator_sharing_state_inactive() {
return testIndicatorGeoSharingState(false);
});
// Permission popup shows permission if geo permission is set to persistent allow
add_task(async function test_permission_popup_permission_scope_permanent() {
// Identity popup shows permission if geo permission is set to persistent allow
add_task(async function test_identity_popup_permission_scope_permanent() {
PermissionTestUtils.add(
EXAMPLE_PAGE_URI,
"geo",
@ -305,35 +305,35 @@ add_task(async function test_permission_popup_permission_scope_permanent() {
);
let tab = await openExamplePage();
await testPermissionPopupGeoContainer(true, false); // Expect permission to be visible, but not lastAccess indicator
await testIdentityPopupGeoContainer(true, false); // Expect permission to be visible, but not lastAccess indicator
await cleanup(tab);
});
// Sharing state set, but no permission
add_task(async function test_permission_popup_permission_sharing_state() {
add_task(async function test_identity_popup_permission_sharing_state() {
let tab = await openExamplePage();
gBrowser.updateBrowserSharing(tab.linkedBrowser, { geo: true });
await testPermissionPopupGeoContainer(true, false);
await testIdentityPopupGeoContainer(true, false);
await cleanup(tab);
});
// Permission popup has correct state if sharing state and last geo access timestamp are set
// Identity popup has correct state if sharing state and last geo access timestamp are set
add_task(
async function test_permission_popup_permission_sharing_state_timestamp() {
async function test_identity_popup_permission_sharing_state_timestamp() {
let tab = await openExamplePage();
gBrowser.updateBrowserSharing(tab.linkedBrowser, { geo: true });
await setGeoLastAccess(tab.linkedBrowser, true);
await testPermissionPopupGeoContainer(true, true);
await testIdentityPopupGeoContainer(true, true);
await cleanup(tab);
}
);
// Clicking permission clear button clears permission and resets geo sharing state
add_task(async function test_permission_popup_permission_clear() {
add_task(async function test_identity_popup_permission_clear() {
PermissionTestUtils.add(
EXAMPLE_PAGE_URI,
"geo",
@ -343,17 +343,17 @@ add_task(async function test_permission_popup_permission_clear() {
let tab = await openExamplePage();
gBrowser.updateBrowserSharing(tab.linkedBrowser, { geo: true });
await openPermissionPopup();
await openIdentityPopup();
let clearButton = document.querySelector(
"#permission-popup-geo-container button"
"#identity-popup-geo-container button"
);
ok(clearButton, "Clear button is visible");
clearButton.click();
await Promise.all([
testGeoSharingIconVisible(false),
testPermissionPopupGeoContainer(false, false),
testIdentityPopupGeoContainer(false, false),
BrowserTestUtils.waitForCondition(() => {
let sharingState = tab._sharingState;
return (
@ -370,12 +370,12 @@ add_task(async function test_permission_popup_permission_clear() {
* Tests that we only show the last access label once when the sharing
* state is updated multiple times while the popup is open.
*/
add_task(async function test_permission_no_duplicate_last_access_label() {
add_task(async function test_identity_no_duplicate_last_access_label() {
let tab = await openExamplePage();
await setGeoLastAccess(tab.linkedBrowser, true);
await openPermissionPopup();
await openIdentityPopup();
gBrowser.updateBrowserSharing(tab.linkedBrowser, { geo: true });
gBrowser.updateBrowserSharing(tab.linkedBrowser, { geo: true });
await testPermissionPopupGeoContainer(true, true);
await testIdentityPopupGeoContainer(true, true);
await cleanup(tab);
});

Просмотреть файл

@ -68,12 +68,12 @@ add_task(async function testWithNotifications() {
"tracking protection icon container should be focused"
);
await synthesizeKeyAndWaitForFocus(
gIdentityHandler._identityIconBox,
gIdentityHandler._identityBox,
"ArrowRight"
);
is(
document.activeElement,
gIdentityHandler._identityIconBox,
gIdentityHandler._identityBox,
"identity block should be focused"
);
let geoIcon = document.getElementById("geo-notification-icon");

Просмотреть файл

@ -86,7 +86,7 @@ async function runTest(options) {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
// Check if the HTTPS-Only UI is visible

Просмотреть файл

@ -56,7 +56,7 @@ async function testClearing(
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let clearFooter = document.getElementById(
@ -139,7 +139,7 @@ async function testClearing(
gIdentityHandler._identityPopup,
"popupshown"
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
// Wait for a second to see if the button is shown.

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function test_https() {
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let customRootWarning = document.getElementById(
"identity-popup-security-decription-custom-root"
@ -55,7 +55,7 @@ add_task(async function test_http() {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let customRootWarning = document.getElementById(
"identity-popup-security-decription-custom-root"

Просмотреть файл

@ -6,7 +6,7 @@ async function focusIdentityBox() {
gURLBar.inputField.focus();
is(document.activeElement, gURLBar.inputField, "urlbar should be focused");
const focused = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityIconBox,
gIdentityHandler._identityBox,
"focus"
);
EventUtils.synthesizeKey("VK_TAB", { shiftKey: true });
@ -24,7 +24,7 @@ add_task(async function testIdentityPopupFocusClick() {
true,
event => event.target == gIdentityHandler._identityPopup
);
EventUtils.synthesizeMouseAtCenter(gIdentityHandler._identityIconBox, {});
EventUtils.synthesizeMouseAtCenter(gIdentityHandler._identityBox, {});
await shown;
isnot(
Services.focus.focusedElement,

Просмотреть файл

@ -138,7 +138,7 @@ async function runTest(i, forward) {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
info("Waiting for the Control Center to be shown");
await popupShown;
ok(

Просмотреть файл

@ -6,15 +6,7 @@ function openIdentityPopup() {
gIdentityHandler._initializePopup();
let mainView = document.getElementById("identity-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
gIdentityHandler._identityIconBox.click();
return viewShown;
}
function openPermissionPopup() {
gPermissionPanel._initializePopup();
let mainView = document.getElementById("permission-popup-mainView");
let viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
gPermissionPanel._openPopup();
gIdentityHandler._identityBox.click();
return viewShown;
}
@ -255,7 +247,7 @@ async function assertMixedContentBlockingState(tabbrowser, states = {}) {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
await promisePanelOpen;
let popupAttr = doc
.getElementById("identity-popup")

Просмотреть файл

@ -85,25 +85,21 @@ add_task(async function test_old_modal_ui() {
window,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
gIdentityHandler._identityBox.click();
await shown;
let labelText = SitePermissions.getPermissionLabel("focus-tab-by-prompt");
let permissionsList = document.getElementById(
"permission-popup-permission-list"
);
let label = permissionsList.querySelector(
".permission-popup-permission-label"
"identity-popup-permission-list"
);
let label = permissionsList.querySelector(".identity-popup-permission-label");
is(label.textContent, labelText);
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
// Check if the identity icon signals granted permission.
ok(
gPermissionPanel._identityPermissionBox.hasAttribute(
"hasGrantedPermissions"
),
gIdentityHandler._identityBox.classList.contains("grantedPermissions"),
"identity-box signals granted permissions"
);

Просмотреть файл

@ -715,10 +715,10 @@ var gTests = [
},
{
desc: "test showPermissionPanel",
run: async function checkShowPermissionPanel() {
desc: "test showControlCenter",
run: async function checkShowControlCenter() {
if (!USING_LEGACY_INDICATOR) {
// The indicator only links to the permission panel for the
// The indicator only links to the control center for the
// legacy indicator.
return;
}
@ -749,7 +749,7 @@ var gTests = [
await indicator;
await checkSharingUI({ video: true });
ok(permissionPopupHidden(), "permission panel should be hidden");
ok(identityPopupHidden(), "control center should be hidden");
if (IS_MAC) {
let activeStreams = webrtcUI.getActiveStreams(true, false, false);
webrtcUI.showSharingDoorhanger(activeStreams[0]);
@ -763,12 +763,12 @@ var gTests = [
}
await TestUtils.waitForCondition(
() => !permissionPopupHidden(),
"wait for permission panel to open"
() => !identityPopupHidden(),
"wait for control center to open"
);
ok(!permissionPopupHidden(), "permission panel should be open");
ok(!identityPopupHidden(), "control center should be open");
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
await closeStream();
},

Просмотреть файл

@ -158,7 +158,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED,
"video should be disabled"
);
@ -177,7 +177,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -196,7 +196,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -258,9 +258,9 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED &&
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_DISABLED,
"video and audio should be disabled"
);
@ -279,7 +279,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -298,7 +298,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -362,7 +362,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.screen == "ScreenPaused",
window.gIdentityHandler._sharingState.webRTC.screen == "ScreenPaused",
"screen should be disabled"
);
await observerPromise;
@ -374,7 +374,7 @@ var gTests = [
await setTrackEnabled(null, true);
await BrowserTestUtils.waitForCondition(
() => window.gPermissionPanel._sharingState.webRTC.screen == "Screen",
() => window.gIdentityHandler._sharingState.webRTC.screen == "Screen",
"screen should be enabled"
);
await observerPromise;
@ -428,7 +428,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED,
"video should be muted"
);
@ -449,7 +449,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -516,7 +516,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_DISABLED,
"audio should be muted"
);
@ -537,7 +537,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -605,7 +605,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED,
"video should be disabled"
);
@ -631,7 +631,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_DISABLED,
"audio should be disabled"
);
@ -656,7 +656,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -677,7 +677,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -703,7 +703,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED,
"video should be disabled"
);
@ -729,7 +729,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -754,7 +754,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -823,7 +823,7 @@ var gTests = [
// Wait for capture state to propagate to the UI asynchronously.
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_DISABLED,
"audio should be disabled"
);
@ -849,7 +849,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_DISABLED,
"camera should be disabled"
);
@ -874,7 +874,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -895,7 +895,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);
@ -921,7 +921,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_DISABLED,
"audio should be disabled"
);
@ -947,7 +947,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.camera ==
window.gIdentityHandler._sharingState.webRTC.camera ==
STATE_CAPTURE_ENABLED,
"video should be enabled"
);
@ -972,7 +972,7 @@ var gTests = [
await BrowserTestUtils.waitForCondition(
() =>
window.gPermissionPanel._sharingState.webRTC.microphone ==
window.gIdentityHandler._sharingState.webRTC.microphone ==
STATE_CAPTURE_ENABLED,
"audio should be enabled"
);

Просмотреть файл

@ -664,7 +664,7 @@ var gTests = [
await indicator;
await checkSharingUI({ screen: "Screen" });
ok(permissionPopupHidden(), "control center should be hidden");
ok(identityPopupHidden(), "control center should be hidden");
if (IS_MAC) {
let activeStreams = webrtcUI.getActiveStreams(false, false, true);
webrtcUI.showSharingDoorhanger(activeStreams[0]);
@ -676,12 +676,12 @@ var gTests = [
EventUtils.synthesizeMouseAtCenter(elt, {}, win);
}
await TestUtils.waitForCondition(
() => !permissionPopupHidden(),
() => !identityPopupHidden(),
"wait for control center to open"
);
ok(!permissionPopupHidden(), "control center should be open");
ok(!identityPopupHidden(), "control center should be open");
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
await closeStream();
},

Просмотреть файл

@ -48,21 +48,21 @@ var gTests = [
// Clicking the global sharing indicator should open the control center in
// the second window.
ok(permissionPopupHidden(win), "control center should be hidden");
ok(identityPopupHidden(win), "control center should be hidden");
let activeStreams = webrtcUI.getActiveStreams(true, false, false);
webrtcUI.showSharingDoorhanger(activeStreams[0], "Devices");
// If the popup gets hidden before being shown, by stray focus/activate
// events, don't bother failing the test. It's enough to know that we
// started showing the popup.
let popup = win.gPermissionPanel._permissionPopup;
let popup = win.gIdentityHandler._identityPopup;
let hiddenEvent = BrowserTestUtils.waitForEvent(popup, "popuphidden");
let shownEvent = BrowserTestUtils.waitForEvent(popup, "popupshown");
let ev = await Promise.race([hiddenEvent, shownEvent]);
ok(ev.type, "Tried to show popup");
win.gPermissionPanel._permissionPopup.hidePopup();
win.gIdentityHandler._identityPopup.hidePopup();
ok(
permissionPopupHidden(window),
identityPopupHidden(window),
"control center should be hidden in the first window"
);

Просмотреть файл

@ -552,8 +552,8 @@ async function stopSharing(
1,
aFrameBC
);
aWindow.gPermissionPanel._identityPermissionBox.click();
let popup = aWindow.gPermissionPanel._permissionPopup;
aWindow.gIdentityHandler._identityBox.click();
let popup = aWindow.gIdentityHandler._identityPopup;
// If the popup gets hidden before being shown, by stray focus/activate
// events, don't bother failing the test. It's enough to know that we
// started showing the popup.
@ -561,12 +561,12 @@ async function stopSharing(
let shownEvent = BrowserTestUtils.waitForEvent(popup, "popupshown");
await Promise.race([hiddenEvent, shownEvent]);
let doc = aWindow.document;
let permissions = doc.getElementById("permission-popup-permission-list");
let permissions = doc.getElementById("identity-popup-permission-list");
let cancelButton = permissions.querySelector(
".permission-popup-permission-icon." +
".identity-popup-permission-icon." +
aType +
"-icon ~ " +
".permission-popup-permission-remove-button"
".identity-popup-permission-remove-button"
);
let observerPromise1 = expectObserverCalled(
"getUserMedia:revoke",
@ -773,7 +773,7 @@ async function checkSharingUI(
let doc = aWin.document;
// First check the icon above the control center (i) icon.
let permissionBox = doc.getElementById("identity-permission-box");
let identityBox = doc.getElementById("identity-box");
let webrtcSharingIcon = doc.getElementById("webrtc-sharing-icon");
ok(webrtcSharingIcon.hasAttribute("sharing"), "sharing attribute is set");
let sharing = webrtcSharingIcon.getAttribute("sharing");
@ -796,16 +796,16 @@ async function checkSharingUI(
"sharing icon(s) should be in paused state when paused"
);
// Then check the sharing indicators inside the permission popup.
permissionBox.click();
let popup = aWin.gPermissionPanel._permissionPopup;
// Then check the sharing indicators inside the control center panel.
identityBox.click();
let popup = aWin.gIdentityHandler._identityPopup;
// If the popup gets hidden before being shown, by stray focus/activate
// events, don't bother failing the test. It's enough to know that we
// started showing the popup.
let hiddenEvent = BrowserTestUtils.waitForEvent(popup, "popuphidden");
let shownEvent = BrowserTestUtils.waitForEvent(popup, "popupshown");
await Promise.race([hiddenEvent, shownEvent]);
let permissions = doc.getElementById("permission-popup-permission-list");
let permissions = doc.getElementById("identity-popup-permission-list");
for (let id of ["microphone", "camera", "screen"]) {
let convertId = idToConvert => {
if (idToConvert == "camera") {
@ -818,22 +818,22 @@ async function checkSharingUI(
};
let expected = aExpected[convertId(id)];
is(
!!aWin.gPermissionPanel._sharingState.webRTC[id],
!!aWin.gIdentityHandler._sharingState.webRTC[id],
!!expected,
"sharing state for " + id + " as expected"
);
let icon = permissions.querySelectorAll(
".permission-popup-permission-icon." + id + "-icon"
".identity-popup-permission-icon." + id + "-icon"
);
if (expected) {
is(icon.length, 1, "should show " + id + " icon in permission panel");
is(icon.length, 1, "should show " + id + " icon in control center panel");
is(
icon[0].classList.contains("in-use"),
expected && !isPaused(expected),
"icon should have the in-use class, unless paused"
);
} else if (!icon.length) {
ok(true, "should not show " + id + " icon in the permission panel");
ok(true, "should not show " + id + " icon in the control center panel");
} else {
// This will happen if there are persistent permissions set.
ok(
@ -843,9 +843,9 @@ async function checkSharingUI(
is(icon.length, 1, "should not show more than 1 " + id + " icon");
}
}
aWin.gPermissionPanel._permissionPopup.hidePopup();
aWin.gIdentityHandler._identityPopup.hidePopup();
await TestUtils.waitForCondition(
() => permissionPopupHidden(aWin),
() => identityPopupHidden(aWin),
"identity popup should be hidden"
);
@ -967,8 +967,8 @@ async function disableObserverVerification() {
}
}
function permissionPopupHidden(win = window) {
let popup = win.gPermissionPanel._permissionPopup;
function identityPopupHidden(win = window) {
let popup = win.gIdentityHandler._identityPopup;
return !popup || popup.state == "closed";
}
@ -981,8 +981,8 @@ async function runTests(tests, options = {}) {
"should start the test without any prior popup notification"
);
ok(
permissionPopupHidden(),
"should start the test with the permission panel hidden"
identityPopupHidden(),
"should start the test with the control center hidden"
);
// Set prefs so that permissions prompts are shown and loopback devices

Просмотреть файл

@ -45,62 +45,61 @@ browser.jar:
content/browser/browser-development-helpers.js (content/browser-development-helpers.js)
#endif
content/browser/browser-fullScreenAndPointerLock.js (content/browser-fullScreenAndPointerLock.js)
content/browser/browser-fullZoom.js (content/browser-fullZoom.js)
content/browser/browser-gestureSupport.js (content/browser-gestureSupport.js)
content/browser/browser-pageActions.js (content/browser-pageActions.js)
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-siteIdentity.js (content/browser-siteIdentity.js)
content/browser/browser-sitePermissionPanel.js (content/browser-sitePermissionPanel.js)
content/browser/browser-siteProtections.js (content/browser-siteProtections.js)
content/browser/browser-sync.js (content/browser-sync.js)
content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar.js)
content/browser/browser-toolbarKeyNav.js (content/browser-toolbarKeyNav.js)
content/browser/browser-thumbnails.js (content/browser-thumbnails.js)
content/browser/browser-graphics-utils.js (content/browser-graphics-utils.js)
content/browser/browser-webrtc.js (content/browser-webrtc.js)
content/browser/browser-fxaSignout.xhtml (content/browser-fxaSignout.xhtml)
content/browser/browser-fxaSignout.js (content/browser-fxaSignout.js)
content/browser/tab-content.js (content/tab-content.js)
content/browser/defaultthemes/1.header.jpg (content/defaultthemes/1.header.jpg)
content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg)
content/browser/defaultthemes/1.preview.jpg (content/defaultthemes/1.preview.jpg)
content/browser/defaultthemes/2.header.jpg (content/defaultthemes/2.header.jpg)
content/browser/defaultthemes/2.icon.jpg (content/defaultthemes/2.icon.jpg)
content/browser/defaultthemes/2.preview.jpg (content/defaultthemes/2.preview.jpg)
content/browser/defaultthemes/3.header.png (content/defaultthemes/3.header.png)
content/browser/defaultthemes/3.icon.png (content/defaultthemes/3.icon.png)
content/browser/defaultthemes/3.preview.png (content/defaultthemes/3.preview.png)
content/browser/defaultthemes/4.header.png (content/defaultthemes/4.header.png)
content/browser/defaultthemes/4.icon.png (content/defaultthemes/4.icon.png)
content/browser/defaultthemes/4.preview.png (content/defaultthemes/4.preview.png)
content/browser/defaultthemes/5.header.png (content/defaultthemes/5.header.png)
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg)
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
content/browser/history-swipe-arrow.svg (content/history-swipe-arrow.svg)
* content/browser/pageinfo/pageInfo.xhtml (content/pageinfo/pageInfo.xhtml)
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)
content/browser/pageinfo/permissions.js (content/pageinfo/permissions.js)
content/browser/pageinfo/security.js (content/pageinfo/security.js)
content/browser/robot.ico (content/robot.ico)
content/browser/static-robot.png (content/static-robot.png)
content/browser/safeMode.css (content/safeMode.css)
content/browser/safeMode.js (content/safeMode.js)
content/browser/safeMode.xhtml (content/safeMode.xhtml)
content/browser/sanitize.xhtml (content/sanitize.xhtml)
content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
content/browser/tabbrowser.css (content/tabbrowser.css)
content/browser/tabbrowser.js (content/tabbrowser.js)
content/browser/tabbrowser-tab.js (content/tabbrowser-tab.js)
content/browser/tabbrowser-tabs.js (content/tabbrowser-tabs.js)
content/browser/utilityOverlay.js (content/utilityOverlay.js)
content/browser/webext-panels.js (content/webext-panels.js)
* content/browser/webext-panels.xhtml (content/webext-panels.xhtml)
content/browser/nsContextMenu.js (content/nsContextMenu.js)
content/browser/contentTheme.js (content/contentTheme.js)
content/browser/browser-fullZoom.js (content/browser-fullZoom.js)
content/browser/browser-gestureSupport.js (content/browser-gestureSupport.js)
content/browser/browser-pageActions.js (content/browser-pageActions.js)
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-siteIdentity.js (content/browser-siteIdentity.js)
content/browser/browser-siteProtections.js (content/browser-siteProtections.js)
content/browser/browser-sync.js (content/browser-sync.js)
content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar.js)
content/browser/browser-toolbarKeyNav.js (content/browser-toolbarKeyNav.js)
content/browser/browser-thumbnails.js (content/browser-thumbnails.js)
content/browser/browser-graphics-utils.js (content/browser-graphics-utils.js)
content/browser/browser-webrtc.js (content/browser-webrtc.js)
content/browser/browser-fxaSignout.xhtml (content/browser-fxaSignout.xhtml)
content/browser/browser-fxaSignout.js (content/browser-fxaSignout.js)
content/browser/tab-content.js (content/tab-content.js)
content/browser/defaultthemes/1.header.jpg (content/defaultthemes/1.header.jpg)
content/browser/defaultthemes/1.icon.jpg (content/defaultthemes/1.icon.jpg)
content/browser/defaultthemes/1.preview.jpg (content/defaultthemes/1.preview.jpg)
content/browser/defaultthemes/2.header.jpg (content/defaultthemes/2.header.jpg)
content/browser/defaultthemes/2.icon.jpg (content/defaultthemes/2.icon.jpg)
content/browser/defaultthemes/2.preview.jpg (content/defaultthemes/2.preview.jpg)
content/browser/defaultthemes/3.header.png (content/defaultthemes/3.header.png)
content/browser/defaultthemes/3.icon.png (content/defaultthemes/3.icon.png)
content/browser/defaultthemes/3.preview.png (content/defaultthemes/3.preview.png)
content/browser/defaultthemes/4.header.png (content/defaultthemes/4.header.png)
content/browser/defaultthemes/4.icon.png (content/defaultthemes/4.icon.png)
content/browser/defaultthemes/4.preview.png (content/defaultthemes/4.preview.png)
content/browser/defaultthemes/5.header.png (content/defaultthemes/5.header.png)
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg)
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
content/browser/history-swipe-arrow.svg (content/history-swipe-arrow.svg)
* content/browser/pageinfo/pageInfo.xhtml (content/pageinfo/pageInfo.xhtml)
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
content/browser/pageinfo/pageInfo.css (content/pageinfo/pageInfo.css)
content/browser/pageinfo/permissions.js (content/pageinfo/permissions.js)
content/browser/pageinfo/security.js (content/pageinfo/security.js)
content/browser/robot.ico (content/robot.ico)
content/browser/static-robot.png (content/static-robot.png)
content/browser/safeMode.css (content/safeMode.css)
content/browser/safeMode.js (content/safeMode.js)
content/browser/safeMode.xhtml (content/safeMode.xhtml)
content/browser/sanitize.xhtml (content/sanitize.xhtml)
content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
content/browser/tabbrowser.css (content/tabbrowser.css)
content/browser/tabbrowser.js (content/tabbrowser.js)
content/browser/tabbrowser-tab.js (content/tabbrowser-tab.js)
content/browser/tabbrowser-tabs.js (content/tabbrowser-tabs.js)
content/browser/utilityOverlay.js (content/utilityOverlay.js)
content/browser/webext-panels.js (content/webext-panels.js)
* content/browser/webext-panels.xhtml (content/webext-panels.xhtml)
content/browser/nsContextMenu.js (content/nsContextMenu.js)
content/browser/contentTheme.js (content/contentTheme.js)
#ifdef XP_MACOSX
# XXX: We should exclude this one as well (bug 71895)
* content/browser/hiddenWindowMac.xhtml (content/hiddenWindowMac.xhtml)

Просмотреть файл

@ -88,6 +88,33 @@
oncommand="gIdentityHandler.showSecuritySubView();"/>
</hbox>
<!-- Permissions Section -->
<hbox class="identity-popup-section"
when-connection="not-secure secure secure-ev secure-cert-user-overridden file extension cert-error-page https-only-error-page">
<vbox id="identity-popup-permissions-content" flex="1" role="group"
aria-labelledby="identity-popup-permissions-headline">
<hbox id="identity-popup-permissions-header" align="center">
<label id="identity-popup-permissions-headline"
role="heading" aria-level="2"
data-l10n-id="identity-permissions"/>
</hbox>
<vbox id="identity-popup-permission-list">
<vbox id="identity-popup-permission-list-default-anchor" class="identity-popup-permission-list-anchor"/>
<vbox class="identity-popup-permission-list-anchor" anchorfor="3rdPartyStorage">
<vbox id="identity-popup-storage-access-permission-list-header">
<hbox align="center" role="group">
<image class="identity-popup-permission-icon storage-access-icon"/>
<label data-l10n-id="identity-permissions-storage-access-header" class="identity-popup-permission-header-label"/>
</hbox>
<description id="identity-popup-storage-access-permission-list-hint" data-l10n-id="identity-permissions-storage-access-hint"></description>
</vbox>
</vbox>
</vbox>
<description id="identity-popup-permission-reload-hint" data-l10n-id="identity-permissions-reload-hint"></description>
<description id="identity-popup-permission-empty-hint" data-l10n-id="identity-permissions-empty"></description>
</vbox>
</hbox>
<!-- Clear Site Data Button -->
<vbox hidden="true"
id="identity-popup-clear-sitedata-footer"

Просмотреть файл

@ -1,45 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html:template id="template-permission-popup">
<panel id="permission-popup"
class="panel-no-padding"
type="arrow"
role="alertdialog"
noautofocus="true"
aria-labelledby="permission-popup-mainView-panel-header-span"
onpopupshown="gPermissionPanel.onPopupShown(event);"
onpopuphidden="gPermissionPanel.onPopupHidden(event);"
orient="vertical">
<panelmultiview id="permission-popup-multiView"
mainViewId="permission-popup-mainView">
<panelview id="permission-popup-mainView"
role="document"
descriptionheightworkaround="true">
<vbox id="permission-popup-mainView-panel-header">
<label>
<html:span id="permission-popup-mainView-panel-header-span" role="heading" aria-level="1"/>
</label>
</vbox>
<hbox class="permission-popup-section">
<vbox id="permission-popup-permissions-content" flex="1" role="group">
<vbox id="permission-popup-permission-list">
<vbox id="permission-popup-permission-list-default-anchor" class="permission-popup-permission-list-anchor"/>
<vbox class="permission-popup-permission-list-anchor" anchorfor="3rdPartyStorage">
<vbox id="permission-popup-storage-access-permission-list-header">
<hbox align="center" role="group">
<image class="permission-popup-permission-icon storage-access-icon"/>
<label data-l10n-id="identity-permissions-storage-access-header" class="permission-popup-permission-header-label"/>
</hbox>
<description id="permission-popup-storage-access-permission-list-hint" data-l10n-id="identity-permissions-storage-access-hint"></description>
</vbox>
</vbox>
</vbox>
<description id="permission-popup-permission-reload-hint" data-l10n-id="identity-permissions-reload-hint"></description>
</vbox>
</hbox>
</panelview>
</panelmultiview>
</panel>
</html:template>

Просмотреть файл

@ -6,62 +6,58 @@ const { PermissionTestUtils } = ChromeUtils.import(
"resource://testing-common/PermissionTestUtils.jsm"
);
function openPermissionPopup() {
function openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
window,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
gIdentityHandler._identityBox.click();
return promise;
}
function closePermissionPopup() {
function closeIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(
gPermissionPanel._permissionPopup,
gIdentityHandler._identityPopup,
"popuphidden"
);
gPermissionPanel._permissionPopup.hidePopup();
gIdentityHandler._identityPopup.hidePopup();
return promise;
}
async function testPermissionPopup({ expectPermissionHidden }) {
await openPermissionPopup();
async function testIdentityPopup({ expectPermissionHidden }) {
await openIdentityPopup();
if (expectPermissionHidden) {
let permissionsList = document.getElementById(
"permission-popup-permission-list"
);
is(
permissionsList.querySelectorAll(
".permission-popup-permission-label-persistent-storage"
).length,
0,
"Persistent storage Permission should be hidden"
);
}
await closePermissionPopup();
// We need to test this after the popup has been closed.
// The permission icon will be shown as long as the popup is open, event if
// no permissions are set.
let permissionsGrantedIcon = document.getElementById(
"permissions-granted-icon"
);
let permissionsList = document.getElementById(
"identity-popup-permission-list"
);
if (expectPermissionHidden) {
ok(
BrowserTestUtils.is_hidden(permissionsGrantedIcon),
"Permission Granted Icon is hidden"
);
is(
permissionsList.querySelectorAll(
".identity-popup-permission-label-persistent-storage"
).length,
0,
"Persistent storage Permission should be hidden"
);
} else {
ok(
BrowserTestUtils.is_visible(permissionsGrantedIcon),
"Permission Granted Icon is visible"
);
}
await closeIdentityPopup();
}
add_task(async function testPersistentStoragePermissionHidden() {
@ -82,7 +78,7 @@ add_task(async function testPersistentStoragePermissionHidden() {
let url = await extension.awaitMessage("url");
await BrowserTestUtils.withNewTab({ gBrowser, url }, async function() {
await testPermissionPopup({ expectPermissionHidden: true });
await testIdentityPopup({ expectPermissionHidden: true });
});
await extension.unload();
@ -114,7 +110,7 @@ add_task(async function testPersistentStoragePermissionVisible() {
);
await BrowserTestUtils.withNewTab({ gBrowser, url }, async function() {
await testPermissionPopup({ expectPermissionHidden: false });
await testIdentityPopup({ expectPermissionHidden: false });
});
await extension.unload();

Просмотреть файл

@ -307,10 +307,13 @@ identity-https-only-info-turn-on2 = Turn on HTTPS-Only Mode for this site if you
identity-https-only-info-turn-off2 = If the page seems broken, you may want to turn off HTTPS-Only Mode for this site to reload using insecure HTTP.
identity-https-only-info-no-upgrade = Unable to upgrade connection from HTTP.
identity-permissions =
.value = Permissions
identity-permissions-storage-access-header = Cross-site cookies
identity-permissions-storage-access-hint = These parties can use cross-site cookies and site data while you are on this site.
identity-permissions-reload-hint = You may need to reload the page for changes to apply.
identity-permissions-empty = You have not granted this site any special permissions.
identity-clear-site-data =
.label = Clear Cookies and Site Data…
identity-connection-not-secure-security-view = You are not securely connected to this site.

Просмотреть файл

@ -983,9 +983,6 @@ captivePortal.infoMessage3 = You must log in to this network before you can acce
# The button shows the portal login page tab when clicked.
captivePortal.showLoginPage2 = Open Network Login Page
# LOCALIZATION NOTE (permissions.header):
# %S is the hostname of the site that is being displayed.
permissions.header = Permissions for %S
permissions.remove.tooltip = Clear this permission and ask again
permissions.fullscreen.promptCanceled = Canceled pending permission requests: permission requests should not be issued before entering DOM fullscreen.

Просмотреть файл

@ -672,15 +672,13 @@ var webrtcUI = {
aActiveStream.browser.focus();
}
browserWindow.focus();
let permissionBox = browserWindow.document.getElementById(
"identity-permission-box"
);
let identityBox = browserWindow.document.getElementById("identity-box");
if (AppConstants.platform == "macosx" && !Services.focus.activeWindow) {
browserWindow.addEventListener(
"activate",
function() {
Services.tm.dispatchToMainThread(function() {
permissionBox.click();
identityBox.click();
});
},
{ once: true }
@ -690,7 +688,7 @@ var webrtcUI = {
.activateApplication(true);
return;
}
permissionBox.click();
identityBox.click();
},
updateWarningLabel(aMenuList) {

Просмотреть файл

@ -5,12 +5,12 @@
%include ../../shared/controlcenter/panel.inc.css
.identity-popup-expander > .button-box,
.permission-popup-permission-remove-button > .button-box {
.identity-popup-permission-remove-button > .button-box {
appearance: none;
}
.identity-popup-expander:-moz-focusring,
.permission-popup-permission-remove-button:-moz-focusring {
.identity-popup-permission-remove-button:-moz-focusring {
outline: 1px -moz-dialogtext dotted;
outline-offset: -1px;
}

Просмотреть файл

@ -5,7 +5,7 @@
%include ../../shared/controlcenter/panel.inc.css
.identity-popup-expander:-moz-focusring,
.permission-popup-permission-remove-button:-moz-focusring {
.identity-popup-permission-remove-button:-moz-focusring {
box-shadow: var(--focus-ring-box-shadow);
}

Просмотреть файл

@ -7,7 +7,7 @@
%filter substitution
%define identityBoxPaddingInline 6px
%define identityBoxMarginInline 3px
%define identityBoxMarginInlineEnd 2px
%define lwtPopupBrighttextLinkColor #74c0ff
%define themeTransition background-color 0.1s cubic-bezier(.17,.67,.83,.67)
%define urlbarBreakoutExtend 2px

Просмотреть файл

@ -11,7 +11,6 @@
#identity-popup,
#permission-popup,
#protections-popup {
%if defined(XP_MACOSX) || defined(XP_WIN)
font-size: 1.18em;
@ -47,8 +46,7 @@
/* This is used by screenshots tests to hide intermittently different
* identity popup shadows (see bug 1425253). */
#identity-popup.no-shadow,
#permission-popup.no-shadow {
#identity-popup.no-shadow {
-moz-window-shadow: none;
}
@ -95,10 +93,8 @@
}
#identity-popup-mainView,
#permission-popup-mainView,
#protections-popup-mainView,
#identity-popup-mainView-panel-header,
#permission-popup-mainView-panel-header,
#protections-popup-mainView-panel-header {
min-width: var(--popup-width);
max-width: var(--popup-width);
@ -114,7 +110,6 @@
}
.identity-popup-section,
.permission-popup-section,
.protections-popup-section {
border-top: 1px solid var(--panel-separator-color);
}
@ -138,6 +133,7 @@
margin-block: 0;
}
#identity-popup-permissions-header,
.identity-popup-security-connection,
#identity-popup-security-description,
#identity-popup-security-httpsonlymode {
@ -175,15 +171,32 @@
margin-inline: 0;
}
#permission-popup-permissions-content {
#identity-popup-permissions-content {
padding-inline: 2em 1em;
}
.identity-popup-security-content,
#permission-popup-permissions-content {
#identity-popup-permissions-content {
padding-block: 1em;
}
#identity-popup-permissions-header {
background-image: url(chrome://browser/skin/permissions.svg);
background-repeat: no-repeat;
-moz-context-properties: fill;
fill: currentColor;
}
#identity-popup-permissions-header:-moz-locale-dir(rtl) {
background-position-x: right;
}
#identity-popup-permissions-header,
#identity-popup-permission-list {
/* 16px icon width + 12px margin */
padding-inline-start: 28px;
}
#protections-popup-content {
background-repeat: no-repeat;
background-position: 1em 1em;
@ -234,6 +247,7 @@
/* CONTENT */
#identity-popup-permissions-headline,
.protections-popup-empty-label,
.tracking-protection-button,
.protections-popup-cookiesView-list-header,
@ -251,7 +265,6 @@
margin: 0;
}
#permission-popup-mainView-panel-header,
#identity-popup-mainView-panel-header,
#protections-popup-mainView-panel-header {
min-height: 40px;
@ -259,7 +272,6 @@
-moz-box-align: center;
}
#permission-popup-mainView-panel-header,
#identity-popup-mainView-panel-header {
padding: var(--vertical-section-padding) var(--horizontal-padding);
}
@ -289,7 +301,6 @@
background: radial-gradient(circle farthest-side at top left, #9059FF, #0250BB);
}
#permission-popup-mainView-panel-header-span,
#identity-popup-mainView-panel-header-span,
#protections-popup-mainView-panel-header-span {
font-weight: 600;
@ -301,13 +312,11 @@
margin-inline-start: 35px;
}
#permission-popup-mainView-panel-header-span,
#identity-popup-mainView-panel-header-span,
#protections-popup-mainView-panel-header-span,
#protections-popup-toast-panel-tp-on-desc,
#protections-popup-toast-panel-tp-off-desc,
#protections-popup .panel-header > label > span,
#permission-popup .panel-header > label > span,
#identity-popup .panel-header > label > span {
display: inline-block;
text-align: center;
@ -329,7 +338,7 @@
fill-opacity: 1;
}
#permission-popup-permissions-content > description,
#identity-popup-permissions-content > description,
#protections-popup-content > description {
color: var(--panel-description-color);
}
@ -731,13 +740,13 @@ description#identity-popup-content-verifier,
@supports -moz-bool-pref("layout.css.emulate-moz-box-with-flex") {
/* The extra padding-bottom is there to work around XUL flex (Bug 1368281).
This rule and the 1.5em above can both be removed once we are only using CSS flex. */
#permission-popup-permissions-content {
#identity-popup-permissions-content {
padding-bottom: 1em;
}
}
.protections-popup-category,
.permission-popup-permission-item {
.identity-popup-permission-item {
min-height: 24px;
}
@ -749,22 +758,24 @@ description#identity-popup-content-verifier,
display: none;
}
.permission-popup-permission-item,
#permission-popup-storage-access-permission-list-header {
.identity-popup-permission-item,
#identity-popup-storage-access-permission-list-header {
padding-inline-end: 8px;
margin-top: 0.25em;
}
#permission-popup-permission-reload-hint,
#permission-popup-permission-empty-hint {
#identity-popup-permission-reload-hint,
#identity-popup-permission-empty-hint,
#identity-popup-permission-list:not(:empty),
#identity-popup-permission-list:empty + #identity-popup-storage-access-permission-list:not(:empty) {
margin-top: 8px;
}
.permission-popup-permission-list-anchor[anchorfor="3rdPartyStorage"] > vbox:only-child {
.identity-popup-permission-list-anchor[anchorfor="3rdPartyStorage"] > vbox:only-child {
display: none;
}
#permission-popup-storage-access-permission-list-hint {
#identity-popup-storage-access-permission-list-hint {
margin-top: 0.25em;
font-size: 0.85em;
/* Matches offset for items - 3px margin + 16px icon + 10px margin */
@ -772,23 +783,23 @@ description#identity-popup-content-verifier,
color: var(--panel-description-color);
}
.permission-popup-permission-icon {
.identity-popup-permission-icon {
margin-inline-start: 3px;
}
.protections-popup-category-icon,
.permission-popup-permission-icon {
.identity-popup-permission-icon {
width: 16px;
height: 16px;
}
.permission-popup-permission-icon.in-use {
.identity-popup-permission-icon.in-use {
-moz-context-properties: fill;
fill: rgb(224, 41, 29);
animation: 1.5s ease permission-popup-permission-icon-in-use-blink infinite;
animation: 1.5s ease identity-popup-permission-icon-in-use-blink infinite;
}
@keyframes permission-popup-permission-icon-in-use-blink {
@keyframes identity-popup-permission-icon-in-use-blink {
50% { opacity: 0; }
}
@ -797,24 +808,24 @@ description#identity-popup-content-verifier,
margin-inline-start: 1em;
}
.permission-popup-permission-label,
.permission-popup-permission-header-label {
.identity-popup-permission-label,
.identity-popup-permission-header-label {
margin-inline-start: 10px;
}
.permission-popup-permission-label-subitem {
.identity-popup-permission-label-subitem {
/* Align label with other labels with icon. */
/* icon width + icon inline margin + label inline margin */
margin-inline-start: calc(16px + 3px + 10px);
}
.protections-popup-category-state-label,
.permission-popup-permission-state-label {
.identity-popup-permission-state-label {
margin-inline-end: 5px;
text-align: end;
}
.permission-popup-permission-state-label {
.identity-popup-permission-state-label {
color: var(--panel-description-color);
}
@ -822,7 +833,7 @@ description#identity-popup-content-verifier,
visibility: hidden;
}
.permission-popup-permission-remove-button {
.identity-popup-permission-remove-button {
appearance: none;
margin: 0;
margin-inline-start: 2px;
@ -836,11 +847,11 @@ description#identity-popup-content-verifier,
opacity: 0.6;
}
.permission-popup-permission-remove-button > .button-box {
.identity-popup-permission-remove-button > .button-box {
padding: 0;
}
.permission-popup-permission-remove-button > .button-box > .button-icon {
.identity-popup-permission-remove-button > .button-box > .button-icon {
margin: 0;
width: 16px;
height: 16px;
@ -849,20 +860,20 @@ description#identity-popup-content-verifier,
fill: currentColor;
}
.permission-popup-permission-remove-button > .button-box > .button-text {
.identity-popup-permission-remove-button > .button-box > .button-text {
display: none;
}
/* swap foreground / background colors on hover */
.permission-popup-permission-remove-button:not(:-moz-focusring):hover {
.identity-popup-permission-remove-button:not(:-moz-focusring):hover {
background-color: currentColor;
}
.permission-popup-permission-remove-button:not(:-moz-focusring):hover > .button-box > .button-icon {
.identity-popup-permission-remove-button:not(:-moz-focusring):hover > .button-box > .button-icon {
fill: var(--arrowpanel-background);
}
.permission-popup-permission-remove-button:not(:-moz-focusring):hover:active {
.identity-popup-permission-remove-button:not(:-moz-focusring):hover:active {
opacity: 0.8;
}

Просмотреть файл

@ -184,8 +184,6 @@ panelmultiview[transitioning] > .panel-viewcontainer > .panel-viewstack > panelv
#widget-overflow,
#appMenu-popup,
#customizationui-widget-panel,
#identity-popup,
#permission-popup,
#protections-popup {
margin-top: -6px;
}
@ -199,6 +197,12 @@ panelmultiview[transitioning] > .panel-viewcontainer > .panel-viewstack > panelv
margin-top: calc(var(--toolbarbutton-inner-padding) - var(--urlbar-icon-padding) - 6px)
}
/* The identity popup does not have any padding of its own,
otherwise would use the same formula as above. */
#identity-popup {
margin-top: calc(var(--toolbarbutton-inner-padding) - 6px);
}
/* The bookmarks toolbar is too thin to have the panels overlap 6px. */
#downloadsPanel.bookmarks-toolbar,
#widget-overflow.bookmarks-toolbar,

Просмотреть файл

@ -7,14 +7,8 @@
%filter substitution
#identity-box {
margin-inline: @identityBoxMarginInline@;
}
/* The tracking protection icon will be hidden if it is a chrome page. There
will be only the brand icon in the url bar. We need to change the margin
in order for the identity box to cover the whole urlbar start section. */
#identity-box[pageproxystate="valid"].chromeUI {
margin-inline-start: 0;
padding-inline: @identityBoxPaddingInline@;
margin-inline-end: @identityBoxMarginInlineEnd@;
}
#identity-box,
@ -25,15 +19,19 @@
fill-opacity: .6;
}
#identity-box[pageproxystate="invalid"] {
margin-inline-end: calc(@identityBoxMarginInline@ + 2px);
/* The tracking protection icon will be hidden if it is a chrome page. There
will be only the brand icon in the url bar. So, we need to change the padding
start for proper positing the icon. */
#identity-box[pageproxystate="valid"].chromeUI {
padding-inline-start: 8px;
}
#urlbar.searchButton > #urlbar-input-container > #identity-box[pageproxystate="invalid"],
#identity-box[pageproxystate="invalid"] > #identity-permission-box,
#identity-box[pageproxystate="invalid"] > #permissions-granted-icon,
#identity-box[pageproxystate="invalid"] > #blocked-permissions-container,
#identity-box[pageproxystate="invalid"] > #notification-popup-box,
#identity-box[pageproxystate="invalid"] #identity-icon-label,
#identity-box[pageproxystate="invalid"] #remote-control-icon {
#identity-box[pageproxystate="invalid"] > #identity-icon-label,
#identity-box[pageproxystate="invalid"] > #remote-control-icon {
display: none;
}
@ -42,32 +40,28 @@
-moz-user-focus: ignore;
}
.identity-box-button:hover:not([open=true]),
#identity-box:hover:not(.no-hover, [open=true]),
#tracking-protection-icon-container:hover:not([open=true]) {
background-color: hsla(0,0%,70%,.2);
fill-opacity: .8;
}
.identity-box-button:hover:active,
.identity-box-button[open=true],
#identity-box:hover:active:not(.no-hover),
#identity-box[open=true],
#tracking-protection-icon-container:hover:active,
#tracking-protection-icon-container[open=true] {
background-color: hsla(0,0%,70%,.3);
fill-opacity: .8;
}
.identity-box-button:not(:active):-moz-focusring,
#identity-box:not(:active):-moz-focusring,
#tracking-protection-icon-container:not(:active):-moz-focusring {
outline: var(--toolbarbutton-focus-outline);
outline-offset: -2px;
-moz-outline-radius: var(--toolbarbutton-border-radius);
}
.identity-box-button {
padding-inline: calc(@identityBoxPaddingInline@ / 2);
}
#identity-box[pageproxystate="valid"].chromeUI #identity-icon-label,
#identity-box[pageproxystate="valid"].chromeUI > #identity-icon-label,
.urlbar-label {
opacity: .6;
}
@ -89,10 +83,10 @@
border-image-slice: 1;
}
#identity-box[pageproxystate="valid"].notSecureText > #identity-icon-box,
#identity-box[pageproxystate="valid"].chromeUI > #identity-icon-box,
#identity-box[pageproxystate="valid"].extensionPage > #identity-icon-box {
padding-inline: 8px;
#identity-box[pageproxystate="valid"].notSecureText,
#identity-box[pageproxystate="valid"].chromeUI,
#identity-box[pageproxystate="valid"].extensionPage {
padding-inline-end: 8px;
}
#urlbar-label-box {
@ -122,15 +116,8 @@
#blocked-permissions-container > .blocked-permission-icon {
width: 16px;
height: 16px;
-moz-context-properties: fill, fill-opacity;
}
.sharing-icon,
#identity-icon,
#tracking-protection-icon,
.notification-anchor-icon,
#blocked-permissions-container > .blocked-permission-icon {
margin-inline-start: 4px;
-moz-context-properties: fill, fill-opacity;
}
#tracking-protection-icon {
@ -143,51 +130,50 @@
list-style-image: url(chrome://global/skin/icons/identity-icon.svg);
}
#identity-box[pageproxystate="valid"].chromeUI #identity-icon {
#identity-box[pageproxystate="valid"].chromeUI > #identity-icon {
list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
}
#identity-box[pageproxystate="valid"].localResource #identity-icon {
#identity-box[pageproxystate="valid"].localResource > #identity-icon {
list-style-image: url(chrome://global/skin/icons/document.svg);
}
#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] #identity-icon {
#urlbar:not(.searchButton) > #urlbar-input-container > #identity-box[pageproxystate="invalid"] > #identity-icon {
list-style-image: url(chrome://global/skin/icons/search-glass.svg);
fill-opacity: .4;
}
#urlbar[actiontype="extension"] > #urlbar-input-container > #identity-box #identity-icon {
#urlbar[actiontype="extension"] > #urlbar-input-container > #identity-box > #identity-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extension.svg);
}
#identity-box[pageproxystate="valid"].extensionPage #identity-icon {
#identity-box[pageproxystate="valid"].extensionPage > #identity-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extension.svg);
}
#identity-box[pageproxystate="valid"].verifiedDomain #identity-icon,
#identity-box[pageproxystate="valid"].mixedActiveBlocked #identity-icon {
#identity-box[pageproxystate="valid"].verifiedDomain > #identity-icon,
#identity-box[pageproxystate="valid"].mixedActiveBlocked > #identity-icon {
list-style-image: url(chrome://browser/skin/connection-secure.svg);
}
#identity-box[pageproxystate="valid"].verifiedDomain #identity-icon:not([lock-icon-gray]),
#identity-box[pageproxystate="valid"].mixedActiveBlocked #identity-icon:not([lock-icon-gray]) {
#identity-box[pageproxystate="valid"].verifiedDomain > #identity-icon:not([lock-icon-gray]),
#identity-box[pageproxystate="valid"].mixedActiveBlocked > #identity-icon:not([lock-icon-gray]) {
fill-opacity: 1;
fill: #12BC00;
}
#identity-box[pageproxystate="valid"].weakCipher #identity-icon,
#identity-box[pageproxystate="valid"].mixedDisplayContent #identity-icon,
#identity-box[pageproxystate="valid"].mixedDisplayContentLoadedActiveBlocked #identity-icon,
#identity-box[pageproxystate="valid"].certUserOverridden #identity-icon,
#identity-box[pageproxystate="valid"].certErrorPage #identity-icon {
#identity-box[pageproxystate="valid"].weakCipher > #identity-icon,
#identity-box[pageproxystate="valid"].mixedDisplayContent > #identity-icon,
#identity-box[pageproxystate="valid"].mixedDisplayContentLoadedActiveBlocked > #identity-icon,
#identity-box[pageproxystate="valid"].certUserOverridden > #identity-icon,
#identity-box[pageproxystate="valid"].certErrorPage > #identity-icon {
list-style-image: url(chrome://global/skin/icons/connection-mixed-passive-loaded.svg);
fill: unset;
}
#identity-box[pageproxystate="valid"].notSecure #identity-icon,
#identity-box[pageproxystate="valid"].mixedActiveContent #identity-icon,
#identity-box[pageproxystate="valid"].httpsOnlyErrorPage #identity-icon {
#identity-box[pageproxystate="valid"].notSecure > #identity-icon,
#identity-box[pageproxystate="valid"].mixedActiveContent > #identity-icon,
#identity-box[pageproxystate="valid"].httpsOnlyErrorPage > #identity-icon {
list-style-image: url(chrome://global/skin/icons/connection-mixed-active-loaded.svg);
}
@ -195,17 +181,10 @@
list-style-image: url(chrome://browser/skin/permissions.svg);
}
#identity-permission-box {
#identity-box:not(.grantedPermissions) > #permissions-granted-icon {
display: none;
}
#identity-permission-box[open=true],
#identity-permission-box[hasGrantedPermissions],
#identity-permission-box[hasPermissionIcon],
#identity-permission-box[hasSharingIcon] {
display: -moz-box;
}
/* SHARING ICON */
#webrtc-sharing-icon[sharing="camera"] {

Просмотреть файл

@ -5,7 +5,7 @@
%endif
.popup-notification-icon,
.permission-popup-permission-icon {
.identity-popup-permission-icon {
-moz-context-properties: fill, fill-opacity;
fill: currentColor;
fill-opacity: 0.6;
@ -14,6 +14,7 @@
#notification-popup-box {
padding: 5px 0;
margin: -5px 0;
margin-inline-end: -5px;
padding-inline-end: 5px;
}
@ -258,8 +259,8 @@ html|*#webRTC-previewVideo {
transform: scaleX(-1);
}
#permission-popup-menulist,
#permission-popup-menulist > menupopup {
#identity-popup-popup-menulist,
#identity-popup-popup-menulist > menupopup {
min-width: 6.5em;
}

Просмотреть файл

@ -6,7 +6,7 @@
%filter substitution
%define urlbarViewPadding 4px
%define urlbarViewIconMarginEnd (@identityBoxPaddingInline@ + @identityBoxMarginInline@)
%define urlbarViewIconMarginEnd (@identityBoxPaddingInline@ + @identityBoxMarginInlineEnd@)
%define urlbarViewMarginInline 7px
%define urlbarViewItemInlinePadding 6px
%define urlbarViewFaviconWidth 16px
@ -143,10 +143,10 @@
}
/* urlbarView-url is forced to be LTR for RTL locales, so set the padding based on the browser's directionality. */
.urlbarView-results[wrap] > .urlbarView-row[has-url] > .urlbarView-row-inner > .urlbarView-url:-moz-locale-dir(ltr) {
padding-left: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInline@ + @urlbarViewFaviconWidth@);
padding-left: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInlineEnd@ + @urlbarViewFaviconWidth@);
}
.urlbarView-results[wrap] > .urlbarView-row[has-url] > .urlbarView-row-inner > .urlbarView-url:-moz-locale-dir(rtl) {
padding-right: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInline@ + @urlbarViewFaviconWidth@);
padding-right: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInlineEnd@ + @urlbarViewFaviconWidth@);
}
/* Note: switchtab entries show the url only in override mode,
remotetab and sponsored ones only when selected or :hover. */
@ -161,7 +161,7 @@
}
.urlbarView-results[wrap] > .urlbarView-row[type=tabtosearch] > .urlbarView-row-inner > .urlbarView-no-wrap > .urlbarView-action {
flex-basis: 100%;
margin-inline-start: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInline@ + @urlbarViewFaviconWidth@);
margin-inline-start: calc(@urlbarViewItemInlinePadding@ + @identityBoxMarginInlineEnd@ + @urlbarViewFaviconWidth@);
}
}

Просмотреть файл

@ -304,7 +304,7 @@ async function openIdentityPopup(expand) {
if (AppConstants.platform == "macosx") {
gIdentityHandler._identityPopup.classList.add("no-shadow");
}
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.querySelector("#identity-icon").click();
if (expand) {
// give some time for opening to avoid weird style issues
await new Promise(c => setTimeout(c, 500));

Просмотреть файл

@ -220,28 +220,28 @@ async function testDoorHanger(
await Promise.all([ct, permChanged]);
}
if (choice != BLOCK) {
let permissionPopupPromise = BrowserTestUtils.waitForEvent(
let identityPopupPromise = BrowserTestUtils.waitForEvent(
window,
"popupshown",
true,
event => event.target == gPermissionPanel._permissionPopup
event => event.target == gIdentityHandler._identityPopup
);
gPermissionPanel._identityPermissionBox.click();
await permissionPopupPromise;
gIdentityHandler._identityBox.click();
await identityPopupPromise;
let permissionItem = document.getElementById(
`permission-popup-permission-label-3rdPartyStorage^https://tracking.example.org`
`identity-popup-permission-label-3rdPartyStorage^https://tracking.example.org`
);
ok(permissionItem, "Permission item exists");
ok(
BrowserTestUtils.is_visible(permissionItem),
"Permission item visible in the identity panel"
);
permissionPopupPromise = BrowserTestUtils.waitForEvent(
gPermissionPanel._permissionPopup,
identityPopupPromise = BrowserTestUtils.waitForEvent(
gIdentityHandler._identityPopup,
"popuphidden"
);
gPermissionPanel._permissionPopup.hidePopup();
await permissionPopupPromise;
gIdentityHandler._identityPopup.hidePopup();
await identityPopupPromise;
}
BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -7,7 +7,7 @@ function openIdentityPopup() {
true,
event => event.target == gIdentityHandler._identityPopup
);
gIdentityHandler._identityIconBox.click();
gIdentityHandler._identityBox.click();
return promise;
}