diff options
Diffstat (limited to 'browser/base/content/test/permissions/browser_site_scoped_permissions.js')
-rw-r--r-- | browser/base/content/test/permissions/browser_site_scoped_permissions.js | 89 |
1 files changed, 43 insertions, 46 deletions
diff --git a/browser/base/content/test/permissions/browser_site_scoped_permissions.js b/browser/base/content/test/permissions/browser_site_scoped_permissions.js index 7a8953de47..949d7a0596 100644 --- a/browser/base/content/test/permissions/browser_site_scoped_permissions.js +++ b/browser/base/content/test/permissions/browser_site_scoped_permissions.js @@ -21,7 +21,7 @@ add_task(async function testSiteScopedPermissionSubdomainAffectsBaseDomain() { ); let id = "3rdPartyStorage^https://example.org"; - await BrowserTestUtils.withNewTab(EMPTY_PAGE, async function (browser) { + await BrowserTestUtils.withNewTab(EMPTY_PAGE, async function () { Services.perms.addFromPrincipal( subdomainPrincipal, id, @@ -76,49 +76,46 @@ add_task(async function testSiteScopedPermissionBaseDomainAffectsSubdomain() { Services.scriptSecurityManager.createContentPrincipalFromOrigin(origin); let id = "3rdPartyStorage^https://example.org"; - await BrowserTestUtils.withNewTab( - SUBDOMAIN_EMPTY_PAGE, - async function (browser) { - Services.perms.addFromPrincipal(principal, id, SitePermissions.ALLOW); - await openPermissionPopup(); - - let permissionsList = document.getElementById( - "permission-popup-permission-list" - ); - let listEntryCount = permissionsList.querySelectorAll( - ".permission-popup-permission-item" - ).length; - is( - listEntryCount, - 1, - "Permission exists on base domain when set on subdomain" - ); - - closePermissionPopup(); - - Services.perms.removeFromPrincipal(principal, id); - - // We intentionally turn off a11y_checks, because the following function - // is expected to click a toolbar button that may be already hidden - // with "display:none;". The permissions panel anchor is hidden because - // the last permission was removed, however we force opening the panel - // anyways in order to test that the list has been properly emptied: - AccessibilityUtils.setEnv({ - mustHaveAccessibleRule: false, - }); - await openPermissionPopup(); - AccessibilityUtils.resetEnv(); - - listEntryCount = permissionsList.querySelectorAll( - ".permission-popup-permission-item-3rdPartyStorage" - ).length; - is( - listEntryCount, - 0, - "Permission removed on base domain when removed on subdomain" - ); - - await closePermissionPopup(); - } - ); + await BrowserTestUtils.withNewTab(SUBDOMAIN_EMPTY_PAGE, async function () { + Services.perms.addFromPrincipal(principal, id, SitePermissions.ALLOW); + await openPermissionPopup(); + + let permissionsList = document.getElementById( + "permission-popup-permission-list" + ); + let listEntryCount = permissionsList.querySelectorAll( + ".permission-popup-permission-item" + ).length; + is( + listEntryCount, + 1, + "Permission exists on base domain when set on subdomain" + ); + + closePermissionPopup(); + + Services.perms.removeFromPrincipal(principal, id); + + // We intentionally turn off a11y_checks, because the following function + // is expected to click a toolbar button that may be already hidden + // with "display:none;". The permissions panel anchor is hidden because + // the last permission was removed, however we force opening the panel + // anyways in order to test that the list has been properly emptied: + AccessibilityUtils.setEnv({ + mustHaveAccessibleRule: false, + }); + await openPermissionPopup(); + AccessibilityUtils.resetEnv(); + + listEntryCount = permissionsList.querySelectorAll( + ".permission-popup-permission-item-3rdPartyStorage" + ).length; + is( + listEntryCount, + 0, + "Permission removed on base domain when removed on subdomain" + ); + + await closePermissionPopup(); + }); }); |