commit 94691d791e17ba212dadde17b2fa462f06687fef parent 5482895d95a16e74d9254459e11849c489dc24e7 Author: Benjamin VanderSloot <bvandersloot@mozilla.com> Date: Sun, 16 Nov 2025 03:12:38 +0000 Bug 1972371 - Convert Website Permissions to config-based prefs - r=emz,fluent-reviewers,akulyk,bolsson Differential Revision: https://phabricator.services.mozilla.com/D267470 Diffstat:
11 files changed, 359 insertions(+), 425 deletions(-)
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -1849,6 +1849,152 @@ let SETTINGS_CONFIG = { }, ], }, + permissions: { + id: "permissions", + l10nId: "permissions-header2", + headingLevel: 2, + items: [ + { + id: "permissionBox", + control: "moz-box-group", + controlAttrs: { + type: "list", + }, + items: [ + { + id: "locationSettingsButton", + control: "moz-box-button", + l10nId: "permissions-location2", + controlAttrs: { + ".iconSrc": "chrome://browser/skin/notification-icons/geo.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-location-window2.title,permissions-site-location-desc,permissions-site-location-disable-label,permissions-site-location-disable-desc", + }, + }, + { + id: "cameraSettingsButton", + control: "moz-box-button", + l10nId: "permissions-camera2", + controlAttrs: { + ".iconSrc": "chrome://browser/skin/notification-icons/camera.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-camera-window2.title,permissions-site-camera-desc,permissions-site-camera-disable-label,permissions-site-camera-disable-desc,", + }, + }, + { + id: "localHostSettingsButton", + control: "moz-box-button", + l10nId: "permissions-localhost2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/local-host.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-localhost-window.title,permissions-site-localhost-desc,permissions-site-localhost-disable-label,permissions-site-localhost-disable-desc,", + }, + }, + { + id: "localNetworkSettingsButton", + control: "moz-box-button", + l10nId: "permissions-local-network2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/local-network.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-local-network-window.title,permissions-site-local-network-desc,permissions-site-local-network-disable-label,permissions-site-local-network-disable-desc,", + }, + }, + { + id: "microphoneSettingsButton", + control: "moz-box-button", + l10nId: "permissions-microphone2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/microphone.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-microphone-window2.title,permissions-site-microphone-desc,permissions-site-microphone-disable-label,permissions-site-microphone-disable-desc,", + }, + }, + { + id: "speakerSettingsButton", + control: "moz-box-button", + l10nId: "permissions-speaker2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/speaker.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-speaker-window.title,permissions-site-speaker-desc,", + }, + }, + { + id: "notificationSettingsButton", + control: "moz-box-button", + l10nId: "permissions-notification2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/desktop-notification.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-notification-window2.title,permissions-site-notification-desc,permissions-site-notification-disable-label,permissions-site-notification-disable-desc,", + }, + }, + { + id: "autoplaySettingsButton", + control: "moz-box-button", + l10nId: "permissions-autoplay2", + controlAttrs: { + ".iconSrc": + "chrome://browser/skin/notification-icons/autoplay-media.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-autoplay-window2.title,permissions-site-autoplay-desc,", + }, + }, + { + id: "xrSettingsButton", + control: "moz-box-button", + l10nId: "permissions-xr2", + controlAttrs: { + ".iconSrc": "chrome://browser/skin/notification-icons/xr.svg", + "search-l10n-ids": + "permissions-remove.label,permissions-remove-all.label,permissions-site-xr-window2.title,permissions-site-xr-desc,permissions-site-xr-disable-label,permissions-site-xr-disable-desc,", + }, + }, + ], + }, + { + id: "popupPolicy", + l10nId: "permissions-block-popups2", + items: [ + { + id: "popupPolicyButton", + l10nId: "permissions-block-popups-exceptions-button2", + control: "moz-box-button", + controlAttrs: { + "search-l10n-ids": + "permissions-address,permissions-exceptions-popup-window3.title,permissions-exceptions-popup-desc2", + }, + }, + ], + }, + { + id: "warnAddonInstall", + l10nId: "permissions-addon-install-warning2", + items: [ + { + id: "addonExceptions", + l10nId: "permissions-addon-exceptions2", + control: "moz-box-button", + controlAttrs: { + "search-l10n-ids": + "permissions-address,permissions-allow.label,permissions-remove.label,permissions-remove-all.label,permissions-exceptions-addons-window2.title,permissions-exceptions-addons-desc", + }, + }, + ], + }, + { + id: "notificationsDoNotDisturb", + l10nId: "permissions-notification-pause", + }, + ], + }, }; /** diff --git a/browser/components/preferences/privacy.inc.xhtml b/browser/components/preferences/privacy.inc.xhtml @@ -581,246 +581,7 @@ <!-- Permissions --> <groupbox id="permissionsGroup" data-category="panePrivacy" hidden="true" data-subcategory="permissions"> - <label class="search-header" hidden="true"><html:h2 data-l10n-id="permissions-header"/></label> - - <!-- The hbox around the buttons is to compute the search tooltip position properly --> - <vbox> - <hbox id="locationSettingsRow" align="center" role="group" aria-labelledby="locationPermissionsLabel"> - <hbox flex="1"> - <image class="geo-icon permission-icon" /> - <label id="locationPermissionsLabel" data-l10n-id="permissions-location"/> - </hbox> - <hbox pack="end"> - <button id="locationSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-location-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-location-window2.title, - permissions-site-location-desc, - permissions-site-location-disable-label, - permissions-site-location-disable-desc, - " /> - </hbox> - </hbox> - - <hbox id="cameraSettingsRow" align="center" role="group" aria-labelledby="cameraPermissionsLabel"> - <hbox flex="1"> - <image class="camera-icon permission-icon" /> - <label id="cameraPermissionsLabel" data-l10n-id="permissions-camera"/> - </hbox> - <hbox pack="end"> - <button id="cameraSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-camera-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-camera-window2.title, - permissions-site-camera-desc, - permissions-site-camera-disable-label, - permissions-site-camera-disable-desc, - " /> - </hbox> - </hbox> - - <hbox id="localHostSettingsRow" align="center" role="group" aria-labelledby="localHostPermissionsLabel"> - <hbox flex="1"> - <image class="localhost-icon permission-icon" /> - <label id="localHostPermissionsLabel" data-l10n-id="permissions-localhost"/> - </hbox> - <hbox pack="end"> - <button id="localHostSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-localhost-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-localhost-window.title, - permissions-site-localhost-desc, - permissions-site-localhost-disable-label, - permissions-site-localhost-disable-desc, - " /> - </hbox> - </hbox> - - <hbox id="localNetworkSettingsRow" align="center" role="group" aria-labelledby="localNetworkPermissionsLabel"> - <hbox flex="1"> - <image class="local-network-icon permission-icon" /> - <label id="localNetworkPermissionsLabel" data-l10n-id="permissions-local-network"/> - </hbox> - <hbox pack="end"> - <button id="localNetworkSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-local-network-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-local-network-window.title, - permissions-site-local-network-desc, - permissions-site-local-network-disable-label, - permissions-site-local-network-disable-desc, - " /> - </hbox> - </hbox> - - <hbox id="microphoneSettingsRow" align="center" role="group" aria-labelledby="microphonePermissionsLabel"> - <hbox flex="1"> - <image class="microphone-icon permission-icon" /> - <label id="microphonePermissionsLabel" data-l10n-id="permissions-microphone"/> - </hbox> - <hbox pack="end"> - <button id="microphoneSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-microphone-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-microphone-window2.title, - permissions-site-microphone-desc, - permissions-site-microphone-disable-label, - permissions-site-microphone-disable-desc, - " /> - </hbox> - </hbox> - - <hbox id="speakerSettingsRow" align="center" role="group" aria-labelledby="speakerPermissionsLabel"> - <hbox flex="1"> - <image class="speaker-icon permission-icon" /> - <label id="speakerPermissionsLabel" data-l10n-id="permissions-speaker"/> - </hbox> - <hbox pack="end"> - <button id="speakerSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-speaker-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-speaker-window.title, - permissions-site-speaker-desc, - " /> - </hbox> - </hbox> - - <hbox id="notificationSettingsRow" align="center" role="group" aria-labelledby="notificationPermissionsLabel"> - <hbox flex="1"> - <image class="desktop-notification-icon permission-icon" /> - <label id="notificationPermissionsLabel" - class="tail-with-learn-more" - data-l10n-id="permissions-notification"/> - <html:a is="moz-support-link" - id="notificationPermissionsLearnMore" - class="learnMore" - data-l10n-id="permissions-notification-link" - support-page="push" - /> - </hbox> - <hbox pack="end"> - <button id="notificationSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-notification-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-notification-window2.title, - permissions-site-notification-desc, - permissions-site-notification-disable-label, - permissions-site-notification-disable-desc, - " /> - </hbox> - </hbox> - - <vbox id="notificationsDoNotDisturbBox" hidden="true"> - <checkbox id="notificationsDoNotDisturb" class="indent"/> - </vbox> - - <hbox id="autoplaySettingsRow" align="center" role="group" aria-labelledby="autoplayPermissionsLabel"> - <hbox flex="1"> - <image class="autoplay-icon permission-icon" /> - <label id="autoplayPermissionsLabel" - data-l10n-id="permissions-autoplay"/> - </hbox> - <hbox pack="end"> - <button id="autoplaySettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-autoplay-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-autoplay-window2.title, - permissions-site-autoplay-desc, - " /> - </hbox> - </hbox> - - <hbox id="xrSettingsRow" align="center" role="group" aria-labelledby="xrPermissionsLabel"> - <hbox flex="1"> - <image class="xr-icon permission-icon" /> - <label id="xrPermissionsLabel" data-l10n-id="permissions-xr"/> - </hbox> - <hbox pack="end"> - <button id="xrSettingsButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-xr-settings" - search-l10n-ids=" - permissions-remove.label, - permissions-remove-all.label, - permissions-site-xr-window2.title, - permissions-site-xr-desc, - permissions-site-xr-disable-label, - permissions-site-xr-disable-desc, - " /> - </hbox> - </hbox> - </vbox> - - <separator /> - - <hbox data-subcategory="permissions-block-popups"> - <checkbox id="popupPolicy" preference="dom.disable_open_during_load" - data-l10n-id="permissions-block-popups2" - flex="1" /> - <button id="popupPolicyButton" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-block-popups-exceptions-button" - data-l10n-attrs="searchkeywords" - search-l10n-ids=" - permissions-address, - permissions-exceptions-popup-window3.title, - permissions-exceptions-popup-desc2, - " /> - </hbox> - - <hbox id="addonInstallBox"> - <checkbox id="warnAddonInstall" - data-l10n-id="permissions-addon-install-warning" - preference="xpinstall.whitelist.required" - flex="1" /> - <button id="addonExceptions" - is="highlightable-button" - class="accessory-button" - data-l10n-id="permissions-addon-exceptions" - search-l10n-ids=" - permissions-address, - permissions-allow.label, - permissions-remove.label, - permissions-remove-all.label, - permissions-exceptions-addons-window2.title, - permissions-exceptions-addons-desc, - " /> - </hbox> - + <html:setting-group groupid="permissions"></html:setting-group> </groupbox> <!-- Firefox Data Collection and Use --> diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js @@ -283,6 +283,9 @@ Preferences.addAll([ // Local Network Access { id: "network.lna.blocking", type: "bool" }, + + // Permissions + { id: "media.setsinkid.enabled", type: "bool" }, ]); if (Services.prefs.getBoolPref("privacy.ui.status_card", false)) { @@ -2102,6 +2105,104 @@ Preferences.addSetting({ }, }); +Preferences.addSetting({ + id: "permissionBox", +}); +Preferences.addSetting({ + id: "popupPolicy", + pref: "dom.disable_open_during_load", +}); +Preferences.addSetting({ + id: "popupPolicyButton", + deps: ["popupPolicy"], + onUserClick: () => gPrivacyPane.showPopupExceptions(), + disabled: ({ popupPolicy }) => { + return !popupPolicy.value || popupPolicy.locked; + }, +}); +Preferences.addSetting({ + id: "warnAddonInstall", + pref: "xpinstall.whitelist.required", +}); +Preferences.addSetting({ + id: "addonExceptions", + deps: ["warnAddonInstall"], + onUserClick: () => gPrivacyPane.showAddonExceptions(), + disabled: ({ warnAddonInstall }) => { + return !warnAddonInstall.value || warnAddonInstall.locked; + }, +}); +Preferences.addSetting({ + id: "notificationsDoNotDisturb", + get: () => { + return AlertsServiceDND?.manualDoNotDisturb ?? false; + }, + set: value => { + if (AlertsServiceDND) { + AlertsServiceDND.manualDoNotDisturb = value; + } + }, + visible: () => { + return AlertsServiceDND != undefined; + }, +}); +Preferences.addSetting({ + id: "locationSettingsButton", + onUserClick: () => gPrivacyPane.showLocationExceptions(), +}); +Preferences.addSetting({ + id: "cameraSettingsButton", + onUserClick: () => gPrivacyPane.showCameraExceptions(), +}); +Preferences.addSetting({ + id: "enabledLNA", + pref: "network.lna.blocking", +}); +Preferences.addSetting({ + id: "localNetworkSettingsButton", + onUserClick: () => gPrivacyPane.showLocalNetworkExceptions(), + deps: ["enabledLNA"], + visible: deps => { + return deps.enabledLNA.value; + }, +}); +Preferences.addSetting({ + id: "localHostSettingsButton", + onUserClick: () => gPrivacyPane.showLocalHostExceptions(), + deps: ["enabledLNA"], + visible: deps => { + return deps.enabledLNA.value; + }, +}); +Preferences.addSetting({ + id: "microphoneSettingsButton", + onUserClick: () => gPrivacyPane.showMicrophoneExceptions(), +}); +Preferences.addSetting({ + id: "enabledSpeakerControl", + pref: "media.setsinkid.enabled", +}); +Preferences.addSetting({ + id: "speakerSettingsButton", + onUserClick: () => gPrivacyPane.showSpeakerExceptions(), + deps: ["enabledSpeakerControl"], + visible: ({ enabledSpeakerControl }) => { + return enabledSpeakerControl.value; + }, +}); +Preferences.addSetting({ + id: "notificationSettingsButton", + onUserClick: () => gPrivacyPane.showNotificationExceptions(), +}); +Preferences.addSetting({ + id: "autoplaySettingsButton", + onUserClick: () => gPrivacyPane.showAutoplayMediaExceptions(), +}); +Preferences.addSetting({ + id: "xrSettingsButton", + onUserClick: () => gPrivacyPane.showXRExceptions(), +}); + function setEventListener(aId, aEventType, aCallback) { document .getElementById(aId) @@ -2660,6 +2761,7 @@ var gPrivacyPane = { initSettingGroup("certificates"); initSettingGroup("ipprotection"); initSettingGroup("history"); + initSettingGroup("permissions"); /* Initialize Content Blocking */ this.initContentBlocking(); @@ -2730,11 +2832,6 @@ var gPrivacyPane = { gPrivacyPane.changeMasterPassword ); setEventListener("showPasswords", "command", gPrivacyPane.showPasswords); - setEventListener( - "addonExceptions", - "command", - gPrivacyPane.showAddonExceptions - ); this._pane = document.getElementById("panePrivacy"); @@ -2745,64 +2842,6 @@ var gPrivacyPane = { this.initListenersForExtensionControllingPasswordManager(); - setEventListener( - "autoplaySettingsButton", - "command", - gPrivacyPane.showAutoplayMediaExceptions - ); - setEventListener( - "notificationSettingsButton", - "command", - gPrivacyPane.showNotificationExceptions - ); - setEventListener( - "locationSettingsButton", - "command", - gPrivacyPane.showLocationExceptions - ); - setEventListener( - "localHostSettingsButton", - "command", - gPrivacyPane.showLocalHostExceptions - ); - setEventListener( - "localNetworkSettingsButton", - "command", - gPrivacyPane.showLocalNetworkExceptions - ); - setEventListener( - "xrSettingsButton", - "command", - gPrivacyPane.showXRExceptions - ); - setEventListener( - "cameraSettingsButton", - "command", - gPrivacyPane.showCameraExceptions - ); - setEventListener( - "microphoneSettingsButton", - "command", - gPrivacyPane.showMicrophoneExceptions - ); - document.getElementById("speakerSettingsRow").hidden = - !Services.prefs.getBoolPref("media.setsinkid.enabled", false); - setEventListener( - "speakerSettingsButton", - "command", - gPrivacyPane.showSpeakerExceptions - ); - setEventListener( - "popupPolicyButton", - "command", - gPrivacyPane.showPopupExceptions - ); - setEventListener( - "notificationsDoNotDisturb", - "command", - gPrivacyPane.toggleDoNotDisturbNotifications - ); - setSyncFromPrefListener("contentBlockingBlockCookiesCheckbox", () => this.readBlockCookies() ); @@ -2896,12 +2935,6 @@ var gPrivacyPane = { this.initWebAuthn(); - Preferences.get("network.lna.blocking").on( - "change", - this.setUpLocalNetworkAccessPermissionUI - ); - this.setUpLocalNetworkAccessPermissionUI(); - // Notify observers that the UI is now ready Services.obs.notifyObservers(window, "privacy-pane-loaded"); }, @@ -3602,10 +3635,6 @@ var gPrivacyPane = { ); }, - toggleDoNotDisturbNotifications(event) { - AlertsServiceDND.manualDoNotDisturb = event.target.checked; - }, - /** * Displays fine-grained, per-site preferences for tracking protection. */ @@ -4338,20 +4367,6 @@ var gPrivacyPane = { }, /** - * Enables/disables the add-ons Exceptions button depending on whether - * or not add-on installation warnings are displayed. - */ - readWarnAddonInstall() { - var warn = Preferences.get("xpinstall.whitelist.required"); - var exceptions = document.getElementById("addonExceptions"); - - exceptions.disabled = !warn.value || warn.locked; - - // don't override the preference value - return undefined; - }, - - /** * Displays the exceptions lists for add-on installation warnings. */ showAddonExceptions() { @@ -4561,12 +4576,6 @@ var gPrivacyPane = { this.updateProfilesPrivacyInfo(); }, - setUpLocalNetworkAccessPermissionUI() { - const isLNADisabled = !Preferences.get("network.lna.blocking").value; - document.getElementById("localHostSettingsRow").hidden = isLNADisabled; - document.getElementById("localNetworkSettingsRow").hidden = isLNADisabled; - }, - updateProfilesPrivacyInfo() { let profilesInfo = document.getElementById("preferences-privacy-profiles"); profilesInfo.hidden = !SelectableProfileService.isEnabled; diff --git a/browser/components/preferences/tests/browser_notifications_do_not_disturb.js b/browser/components/preferences/tests/browser_notifications_do_not_disturb.js @@ -15,8 +15,8 @@ add_task(async function () { let doc = gBrowser.contentDocument; let notificationsDoNotDisturbBox = doc.getElementById( - "notificationsDoNotDisturbBox" - ); + "notificationsDoNotDisturb" + ).control; if (notificationsDoNotDisturbBox.hidden) { todo(false, "Do not disturb is not available on this platform"); return; @@ -32,14 +32,15 @@ add_task(async function () { return; } - let checkbox = doc.getElementById("notificationsDoNotDisturb"); + let checkbox = doc.getElementById("notificationsDoNotDisturb").control + .controlEl; ok(!checkbox.checked, "Checkbox should not be checked by default"); ok( !alertService.manualDoNotDisturb, "Do not disturb should be off by default" ); - let checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command"); + let checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "change"); checkbox.click(); await checkboxChanged; ok( @@ -47,7 +48,7 @@ add_task(async function () { "Do not disturb should be enabled when checked" ); - checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command"); + checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "change"); checkbox.click(); await checkboxChanged; ok( diff --git a/browser/components/preferences/tests/browser_permissions_dialog.js b/browser/components/preferences/tests/browser_permissions_dialog.js @@ -586,12 +586,13 @@ add_task(async function testTabBehaviour() { add_task(async function addSpeakerPermission() { let enabled = Services.prefs.getBoolPref("media.setsinkid.enabled", false); - let speakerRow = - gBrowser.contentDocument.getElementById("speakerSettingsRow"); + let speakerButton = gBrowser.contentDocument.getElementById( + "speakerSettingsButton" + ); Assert.equal( - BrowserTestUtils.isVisible(speakerRow), + BrowserTestUtils.isVisible(speakerButton), enabled, - "speakerRow visible" + "speakerButton visible" ); if (!enabled) { return; @@ -638,35 +639,45 @@ add_task(async function addSpeakerPermission() { add_task(async function testLocalNetworkAccessPermissionVisibility() { let enabled = Services.prefs.getBoolPref("network.lna.blocking", false); - let localHostSettingsRow = gBrowser.contentDocument.getElementById( - "localHostSettingsRow" + let localHostSettingsButton = gBrowser.contentDocument.getElementById( + "localHostSettingsButton" ); - let localNetworkSettingsRow = gBrowser.contentDocument.getElementById( - "localNetworkSettingsRow" + let localNetworkSettingsButton = gBrowser.contentDocument.getElementById( + "localNetworkSettingsButton" ); Assert.equal( - BrowserTestUtils.isVisible(localNetworkSettingsRow), + BrowserTestUtils.isVisible(localNetworkSettingsButton), enabled, "localhost permissions visible" ); Assert.equal( - BrowserTestUtils.isVisible(localHostSettingsRow), + BrowserTestUtils.isVisible(localHostSettingsButton), enabled, "localhost permissions visible" ); + let changeLocalHostButton = waitForSettingControlChange( + localHostSettingsButton + ); + let changeLocalNetworkButton = waitForSettingControlChange( + localNetworkSettingsButton + ); + enabled = !enabled; Services.prefs.setBoolPref("network.lna.blocking", enabled); + await changeLocalHostButton; + await changeLocalNetworkButton; + Assert.equal( - BrowserTestUtils.isVisible(localHostSettingsRow), + BrowserTestUtils.isVisible(localHostSettingsButton), enabled, "localhost permissions toggle" ); Assert.equal( - BrowserTestUtils.isVisible(localNetworkSettingsRow), + BrowserTestUtils.isVisible(localNetworkSettingsButton), enabled, "localhost permissions toggle" ); diff --git a/browser/components/preferences/tests/browser_permissions_urlFieldHidden.js b/browser/components/preferences/tests/browser_permissions_urlFieldHidden.js @@ -14,9 +14,12 @@ add_task(async function urlFieldVisibleForPopupPermissions() { !popupPolicyCheckbox.checked, "popupPolicyCheckbox should be unchecked by default" ); - popupPolicyCheckbox.click(); let popupPolicyButton = doc.getElementById("popupPolicyButton"); ok(popupPolicyButton, "popupPolicyButton found"); + let popupPolicyButtonAvailable = + waitForSettingControlChange(popupPolicyButton); + popupPolicyCheckbox.click(); + await popupPolicyButtonAvailable; let dialogPromise = promiseLoadSubDialog(PERMISSIONS_URL); popupPolicyButton.click(); let dialog = await dialogPromise; diff --git a/browser/components/preferences/tests/browser_security-1.js b/browser/components/preferences/tests/browser_security-1.js @@ -20,20 +20,6 @@ registerCleanupFunction(function () { ); }); -function waitForSettingChange(setting) { - return new Promise(resolve => { - setting.on("change", function handler() { - setting.off("change", handler); - resolve(); - }); - }); -} - -async function waitForSettingControlChange(control) { - await waitForSettingChange(control.setting); - await new Promise(resolve => requestAnimationFrame(resolve)); -} - // This test only opens the Preferences once, and then reloads the page // each time that it wants to test various preference combinations. We // only use one tab (instead of opening/closing for each test) for all diff --git a/browser/components/preferences/tests/browser_security-2.js b/browser/components/preferences/tests/browser_security-2.js @@ -20,20 +20,6 @@ registerCleanupFunction(function () { ); }); -function waitForSettingChange(setting) { - return new Promise(resolve => { - setting.on("change", function handler() { - setting.off("change", handler); - resolve(); - }); - }); -} - -async function waitForSettingControlChange(control) { - await waitForSettingChange(control.setting); - await new Promise(resolve => requestAnimationFrame(resolve)); -} - // This test only opens the Preferences once, and then reloads the page // each time that it wants to test various preference combinations. We // only use one tab (instead of opening/closing for each test) for all diff --git a/browser/components/preferences/tests/head.js b/browser/components/preferences/tests/head.js @@ -704,3 +704,17 @@ async function updateCheckBox(win, id, value) { // Toggle the state. await EventUtils.synthesizeMouseAtCenter(checkbox, {}, checkbox.ownerGlobal); } + +function waitForSettingChange(setting) { + return new Promise(resolve => { + setting.on("change", function handler() { + setting.off("change", handler); + resolve(); + }); + }); +} + +async function waitForSettingControlChange(control) { + await waitForSettingChange(control.setting); + await new Promise(resolve => requestAnimationFrame(resolve)); +} diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -1527,59 +1527,41 @@ tracking-manage-exceptions = ## Privacy Section - Permissions -permissions-header = Permissions +permissions-header2 = + .label = Permissions + .description = Permissions you give to websites you browse. -permissions-location = Location -permissions-location-settings = - .label = Settings… - .accesskey = t +permissions-location2 = + .label = Location -permissions-localhost = Device apps and services -permissions-localhost-settings = - .label = Settings… - .accesskey = t +permissions-localhost2 = + .label = Device apps and services -permissions-local-network = Local Network Devices -permissions-local-network-settings = - .label = Settings… - .accesskey = t +permissions-local-network2 = + .label = Local network devices -permissions-xr = Virtual Reality -permissions-xr-settings = - .label = Settings… - .accesskey = t +permissions-xr2 = + .label = Virtual reality -permissions-camera = Camera -permissions-camera-settings = - .label = Settings… - .accesskey = t +permissions-camera2 = + .label = Camera -permissions-microphone = Microphone -permissions-microphone-settings = - .label = Settings… - .accesskey = t +permissions-microphone2 = + .label = Microphone -# Short form for "the act of choosing sound output devices and redirecting audio to the chosen devices". -permissions-speaker = Speaker Selection -permissions-speaker-settings = - .label = Settings… - .accesskey = t +# Privacy permission for sound output devices. +permissions-speaker2 = + .label = Speaker -permissions-notification = Notifications -permissions-notification-settings = - .label = Settings… - .accesskey = t -permissions-notification-link = Learn more +permissions-notification2 = + .label = Notifications permissions-notification-pause = .label = Pause notifications until { -brand-short-name } restarts .accesskey = n -permissions-autoplay = Autoplay - -permissions-autoplay-settings = - .label = Settings… - .accesskey = t +permissions-autoplay2 = + .label = Autoplay permissions-block-popups2 = .label = Block pop-ups and third-party redirects @@ -1587,17 +1569,17 @@ permissions-block-popups2 = # "popup" is a misspelling that is more popular than the correct spelling of # "pop-up" so it's included as a search keyword, not displayed in the UI. -permissions-block-popups-exceptions-button = - .label = Exceptions… +permissions-block-popups-exceptions-button2 = + .label = Manage pop-up and third-party redirect exceptions .accesskey = E .searchkeywords = popups -permissions-addon-install-warning = - .label = Warn you when websites try to install add-ons +permissions-addon-install-warning2 = + .label = Warn when websites try to install extensions .accesskey = W -permissions-addon-exceptions = - .label = Exceptions… +permissions-addon-exceptions2 = + .label = Choose which websites can install extensions .accesskey = E ## Privacy Section - Data Collection diff --git a/python/l10n/fluent_migrations/bug_1972371_preferences_permissions.py b/python/l10n/fluent_migrations/bug_1972371_preferences_permissions.py @@ -0,0 +1,35 @@ +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +from fluent.migrate import COPY_PATTERN +from fluent.migrate.helpers import transforms_from + + +def migrate(ctx): + """Bug 1972371 - Migrate permissions settings content for the settings redesign part {index}.""" + path = "browser/browser/preferences/preferences.ftl" + ctx.add_transforms( + path, + path, + transforms_from( + """ +permissions-location2 = + .label = {COPY_PATTERN(from_path, "permissions-location")} +permissions-localhost2 = + .label = {COPY_PATTERN(from_path, "permissions-localhost")} +permissions-local-network2 = + .label = {COPY_PATTERN(from_path, "permissions-local-network")} +permissions-xr2 = + .label = {COPY_PATTERN(from_path, "permissions-xr")} +permissions-camera2 = + .label = {COPY_PATTERN(from_path, "permissions-camera")} +permissions-microphone2 = + .label = {COPY_PATTERN(from_path, "permissions-microphone")} +permissions-notification2 = + .label = {COPY_PATTERN(from_path, "permissions-notification")} +permissions-autoplay2 = + .label = {COPY_PATTERN(from_path, "permissions-autoplay")} +""", + from_path=path, + ), + )