mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1695356 - Show permission indicator for any non-default site-permissions. r=johannh
Before decoupling the permission panel in Bug 1596897, the permission indicator was not shown if we had a blocked permission icon to show instead. With the decoupled permissions panel it needs to be shown whenever we have permissions listed in the panel. The granted permissions icon is now the anchor for the panel. Differential Revision: https://phabricator.services.mozilla.com/D106771
This commit is contained in:
parent
e8193fff6f
commit
805563414d
@ -125,8 +125,7 @@ var gPermissionPanel = {
|
||||
* state.
|
||||
*/
|
||||
hidePermissionIcons() {
|
||||
this._identityPermissionBox.removeAttribute("hasGrantedPermissions");
|
||||
this._identityPermissionBox.removeAttribute("hasPermissionIcon");
|
||||
this._identityPermissionBox.removeAttribute("hasPermissions");
|
||||
},
|
||||
|
||||
/**
|
||||
@ -142,14 +141,16 @@ var gPermissionPanel = {
|
||||
}
|
||||
|
||||
// keeps track if we should show an indicator that there are active permissions
|
||||
let hasGrantedPermissions = false;
|
||||
let hasPermissionIcon = false;
|
||||
let hasPermissions = false;
|
||||
|
||||
// show permission icons
|
||||
let permissions = SitePermissions.getAllForBrowser(
|
||||
gBrowser.selectedBrowser
|
||||
);
|
||||
for (let permission of permissions) {
|
||||
if (permission.state != SitePermissions.UNKNOWN) {
|
||||
hasPermissions = true;
|
||||
|
||||
if (
|
||||
permission.state == SitePermissions.BLOCK ||
|
||||
permission.state == SitePermissions.AUTOPLAY_BLOCKED_ALL
|
||||
@ -157,10 +158,8 @@ var gPermissionPanel = {
|
||||
let icon = permissionAnchors[permission.id];
|
||||
if (icon) {
|
||||
icon.setAttribute("showing", "true");
|
||||
hasPermissionIcon = true;
|
||||
}
|
||||
} else if (permission.state != SitePermissions.UNKNOWN) {
|
||||
hasGrantedPermissions = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,16 +168,12 @@ var gPermissionPanel = {
|
||||
if (gBrowser.selectedBrowser.popupBlocker.getBlockedPopupCount()) {
|
||||
let icon = permissionAnchors.popup;
|
||||
icon.setAttribute("showing", "true");
|
||||
hasPermissionIcon = true;
|
||||
hasPermissions = true;
|
||||
}
|
||||
|
||||
this._identityPermissionBox.toggleAttribute(
|
||||
"hasGrantedPermissions",
|
||||
hasGrantedPermissions
|
||||
);
|
||||
this._identityPermissionBox.toggleAttribute(
|
||||
"hasPermissionIcon",
|
||||
hasPermissionIcon
|
||||
"hasPermissions",
|
||||
hasPermissions
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -100,31 +100,25 @@ add_task(async function testIdentityIcon() {
|
||||
);
|
||||
|
||||
ok(
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box signals granted permissions"
|
||||
);
|
||||
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "geo");
|
||||
|
||||
ok(
|
||||
!gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
!gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box doesn't signal granted permissions"
|
||||
);
|
||||
|
||||
PermissionTestUtils.add(
|
||||
gBrowser.currentURI,
|
||||
"camera",
|
||||
Services.perms.DENY_ACTION
|
||||
"not-a-site-permission",
|
||||
Services.perms.ALLOW_ACTION
|
||||
);
|
||||
|
||||
ok(
|
||||
!gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
!gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box doesn't signal granted permissions"
|
||||
);
|
||||
|
||||
@ -135,14 +129,36 @@ add_task(async function testIdentityIcon() {
|
||||
);
|
||||
|
||||
ok(
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box signals granted permissions"
|
||||
);
|
||||
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "cookie");
|
||||
|
||||
PermissionTestUtils.add(
|
||||
gBrowser.currentURI,
|
||||
"cookie",
|
||||
Ci.nsICookiePermission.ACCESS_DENY
|
||||
);
|
||||
|
||||
ok(
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box signals granted permissions"
|
||||
);
|
||||
|
||||
PermissionTestUtils.add(
|
||||
gBrowser.currentURI,
|
||||
"cookie",
|
||||
Ci.nsICookiePermission.ACCESS_DEFAULT
|
||||
);
|
||||
|
||||
ok(
|
||||
!gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box doesn't signal granted permissions"
|
||||
);
|
||||
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "geo");
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "camera");
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "not-a-site-permission");
|
||||
PermissionTestUtils.remove(gBrowser.currentURI, "cookie");
|
||||
});
|
||||
});
|
||||
|
@ -101,9 +101,7 @@ add_task(async function test_old_modal_ui() {
|
||||
|
||||
// Check if the identity icon signals granted permission.
|
||||
ok(
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-box signals granted permissions"
|
||||
);
|
||||
|
||||
@ -230,9 +228,7 @@ add_task(async function test_new_modal_ui() {
|
||||
|
||||
// Check if the identity icon signals granted permission.
|
||||
ok(
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute(
|
||||
"hasGrantedPermissions"
|
||||
),
|
||||
gPermissionPanel._identityPermissionBox.hasAttribute("hasPermissions"),
|
||||
"identity-permission-box signals granted permissions"
|
||||
);
|
||||
|
||||
|
@ -200,8 +200,7 @@
|
||||
}
|
||||
|
||||
#identity-permission-box[open=true],
|
||||
#identity-permission-box[hasGrantedPermissions],
|
||||
#identity-permission-box[hasPermissionIcon],
|
||||
#identity-permission-box[hasPermissions],
|
||||
#identity-permission-box[hasSharingIcon] {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user