commit 9ab76d176abad2a1c9eb1085c87c7ecd21d8b3ed parent 72a6633a4bc776d7f9ec70905340449b27cc83d2 Author: Sandor Molnar <smolnar@mozilla.com> Date: Sun, 16 Nov 2025 07:41:55 +0200 Revert "Bug 1972371 - Convert Website Permissions to config-based prefs - r=emz,fluent-reviewers,akulyk,bolsson" for causing bc failures @ browser_search_within_preferences_1.js This reverts commit 94691d791e17ba212dadde17b2fa462f06687fef. Diffstat:
11 files changed, 425 insertions(+), 359 deletions(-)
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -1849,152 +1849,6 @@ 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,7 +581,246 @@ <!-- Permissions --> <groupbox id="permissionsGroup" data-category="panePrivacy" hidden="true" data-subcategory="permissions"> - <html:setting-group groupid="permissions"></html:setting-group> + <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> + </groupbox> <!-- Firefox Data Collection and Use --> diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js @@ -283,9 +283,6 @@ 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)) { @@ -2105,104 +2102,6 @@ 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) @@ -2761,7 +2660,6 @@ var gPrivacyPane = { initSettingGroup("certificates"); initSettingGroup("ipprotection"); initSettingGroup("history"); - initSettingGroup("permissions"); /* Initialize Content Blocking */ this.initContentBlocking(); @@ -2832,6 +2730,11 @@ var gPrivacyPane = { gPrivacyPane.changeMasterPassword ); setEventListener("showPasswords", "command", gPrivacyPane.showPasswords); + setEventListener( + "addonExceptions", + "command", + gPrivacyPane.showAddonExceptions + ); this._pane = document.getElementById("panePrivacy"); @@ -2842,6 +2745,64 @@ 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() ); @@ -2935,6 +2896,12 @@ 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"); }, @@ -3635,6 +3602,10 @@ var gPrivacyPane = { ); }, + toggleDoNotDisturbNotifications(event) { + AlertsServiceDND.manualDoNotDisturb = event.target.checked; + }, + /** * Displays fine-grained, per-site preferences for tracking protection. */ @@ -4367,6 +4338,20 @@ 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() { @@ -4576,6 +4561,12 @@ 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( - "notificationsDoNotDisturb" - ).control; + "notificationsDoNotDisturbBox" + ); if (notificationsDoNotDisturbBox.hidden) { todo(false, "Do not disturb is not available on this platform"); return; @@ -32,15 +32,14 @@ add_task(async function () { return; } - let checkbox = doc.getElementById("notificationsDoNotDisturb").control - .controlEl; + let checkbox = doc.getElementById("notificationsDoNotDisturb"); 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, "change"); + let checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command"); checkbox.click(); await checkboxChanged; ok( @@ -48,7 +47,7 @@ add_task(async function () { "Do not disturb should be enabled when checked" ); - checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "change"); + checkboxChanged = BrowserTestUtils.waitForEvent(checkbox, "command"); 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,13 +586,12 @@ add_task(async function testTabBehaviour() { add_task(async function addSpeakerPermission() { let enabled = Services.prefs.getBoolPref("media.setsinkid.enabled", false); - let speakerButton = gBrowser.contentDocument.getElementById( - "speakerSettingsButton" - ); + let speakerRow = + gBrowser.contentDocument.getElementById("speakerSettingsRow"); Assert.equal( - BrowserTestUtils.isVisible(speakerButton), + BrowserTestUtils.isVisible(speakerRow), enabled, - "speakerButton visible" + "speakerRow visible" ); if (!enabled) { return; @@ -639,45 +638,35 @@ add_task(async function addSpeakerPermission() { add_task(async function testLocalNetworkAccessPermissionVisibility() { let enabled = Services.prefs.getBoolPref("network.lna.blocking", false); - let localHostSettingsButton = gBrowser.contentDocument.getElementById( - "localHostSettingsButton" + let localHostSettingsRow = gBrowser.contentDocument.getElementById( + "localHostSettingsRow" ); - let localNetworkSettingsButton = gBrowser.contentDocument.getElementById( - "localNetworkSettingsButton" + let localNetworkSettingsRow = gBrowser.contentDocument.getElementById( + "localNetworkSettingsRow" ); Assert.equal( - BrowserTestUtils.isVisible(localNetworkSettingsButton), + BrowserTestUtils.isVisible(localNetworkSettingsRow), enabled, "localhost permissions visible" ); Assert.equal( - BrowserTestUtils.isVisible(localHostSettingsButton), + BrowserTestUtils.isVisible(localHostSettingsRow), 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(localHostSettingsButton), + BrowserTestUtils.isVisible(localHostSettingsRow), enabled, "localhost permissions toggle" ); Assert.equal( - BrowserTestUtils.isVisible(localNetworkSettingsButton), + BrowserTestUtils.isVisible(localNetworkSettingsRow), 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,12 +14,9 @@ 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,6 +20,20 @@ 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,6 +20,20 @@ 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,17 +704,3 @@ 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,41 +1527,59 @@ tracking-manage-exceptions = ## Privacy Section - Permissions -permissions-header2 = - .label = Permissions - .description = Permissions you give to websites you browse. +permissions-header = Permissions -permissions-location2 = - .label = Location +permissions-location = Location +permissions-location-settings = + .label = Settings… + .accesskey = t -permissions-localhost2 = - .label = Device apps and services +permissions-localhost = Device apps and services +permissions-localhost-settings = + .label = Settings… + .accesskey = t -permissions-local-network2 = - .label = Local network devices +permissions-local-network = Local Network Devices +permissions-local-network-settings = + .label = Settings… + .accesskey = t -permissions-xr2 = - .label = Virtual reality +permissions-xr = Virtual Reality +permissions-xr-settings = + .label = Settings… + .accesskey = t -permissions-camera2 = - .label = Camera +permissions-camera = Camera +permissions-camera-settings = + .label = Settings… + .accesskey = t -permissions-microphone2 = - .label = Microphone +permissions-microphone = Microphone +permissions-microphone-settings = + .label = Settings… + .accesskey = t -# Privacy permission for sound output devices. -permissions-speaker2 = - .label = Speaker +# 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 -permissions-notification2 = - .label = Notifications +permissions-notification = Notifications +permissions-notification-settings = + .label = Settings… + .accesskey = t +permissions-notification-link = Learn more permissions-notification-pause = .label = Pause notifications until { -brand-short-name } restarts .accesskey = n -permissions-autoplay2 = - .label = Autoplay +permissions-autoplay = Autoplay + +permissions-autoplay-settings = + .label = Settings… + .accesskey = t permissions-block-popups2 = .label = Block pop-ups and third-party redirects @@ -1569,17 +1587,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-button2 = - .label = Manage pop-up and third-party redirect exceptions +permissions-block-popups-exceptions-button = + .label = Exceptions… .accesskey = E .searchkeywords = popups -permissions-addon-install-warning2 = - .label = Warn when websites try to install extensions +permissions-addon-install-warning = + .label = Warn you when websites try to install add-ons .accesskey = W -permissions-addon-exceptions2 = - .label = Choose which websites can install extensions +permissions-addon-exceptions = + .label = Exceptions… .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 @@ -1,35 +0,0 @@ -# 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, - ), - )