diff --git a/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js b/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js index ff3cb01fa911..c11d7161022d 100644 --- a/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js +++ b/browser/base/content/test/tabPrompts/browser_openPromptInBackgroundTab.js @@ -50,6 +50,20 @@ add_task(function*() { is(ps.ALLOW_ACTION, ps.testPermission(makeURI(pageWithAlert), "focus-tab-by-prompt"), "Tab switching should now be allowed"); + // Check if the control center shows the correct permission. + let shown = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown"); + gIdentityHandler._identityBox.click(); + yield shown; + let labelText = SitePermissions.getPermissionLabel("focus-tab-by-prompt"); + let permissionsList = document.getElementById("identity-popup-permission-list"); + let label = permissionsList.querySelector(".identity-popup-permission-label"); + is(label.textContent, labelText); + gIdentityHandler._identityPopup.hidePopup() + + // Check if the identity icon signals granted permission. + ok(gIdentityHandler._identityBox.classList.contains("grantedPermissions"), + "identity-box signals granted permissions"); + let openedTabSelectedPromise = BrowserTestUtils.waitForAttribute("selected", openedTab, "true"); // switch to other tab again yield BrowserTestUtils.switchTab(gBrowser, firstTab); @@ -63,3 +77,4 @@ add_task(function*() { yield BrowserTestUtils.removeTab(openedTab); }); + diff --git a/browser/locales/en-US/chrome/browser/sitePermissions.properties b/browser/locales/en-US/chrome/browser/sitePermissions.properties index 4d8b0b1b00f8..c3ca61480b3c 100644 --- a/browser/locales/en-US/chrome/browser/sitePermissions.properties +++ b/browser/locales/en-US/chrome/browser/sitePermissions.properties @@ -35,3 +35,4 @@ permission.install.label = Install Add-ons permission.popup.label = Open Pop-up Windows permission.geo.label = Access Your Location permission.indexedDB.label = Maintain Offline Storage +permission.focus-tab-by-prompt.label = Switch to this Tab \ No newline at end of file diff --git a/browser/modules/SitePermissions.jsm b/browser/modules/SitePermissions.jsm index f6a2cf19a1e9..82c9a1ba2412 100644 --- a/browser/modules/SitePermissions.jsm +++ b/browser/modules/SitePermissions.jsm @@ -608,9 +608,14 @@ var gPermissionObject = { exactHostMatch: true }, - "indexedDB": {} + "indexedDB": {}, + + "focus-tab-by-prompt": { + exactHostMatch: true, + states: [ SitePermissions.UNKNOWN, SitePermissions.ALLOW ], + }, + }; XPCOMUtils.defineLazyPreferenceGetter(SitePermissions, "temporaryPermissionExpireTime", "privacy.temporary_permission_expire_time_ms", 3600 * 1000); - diff --git a/browser/themes/shared/notification-icons.inc.css b/browser/themes/shared/notification-icons.inc.css index e5a546a9ddf5..d6f7cd838fd2 100644 --- a/browser/themes/shared/notification-icons.inc.css +++ b/browser/themes/shared/notification-icons.inc.css @@ -33,6 +33,10 @@ /* INDIVIDUAL NOTIFICATIONS */ +.focus-tab-by-prompt-icon { + list-style-image: url(chrome://browser/skin/notification-icons.svg#focus-tab-by-prompt); +} + .popup-notification-icon[popupid="web-notifications"], .desktop-notification-icon { list-style-image: url(chrome://browser/skin/notification-icons.svg#desktop-notification); diff --git a/browser/themes/shared/notification-icons.svg b/browser/themes/shared/notification-icons.svg index 0850f5d4f6e7..428d3782d579 100644 --- a/browser/themes/shared/notification-icons.svg +++ b/browser/themes/shared/notification-icons.svg @@ -49,6 +49,7 @@ + @@ -84,6 +85,7 @@ +