summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/privacy.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /browser/components/preferences/privacy.js
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/preferences/privacy.js')
-rw-r--r--browser/components/preferences/privacy.js78
1 files changed, 63 insertions, 15 deletions
diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js
index 89fed04e21..2d6fe7cacd 100644
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -60,6 +60,10 @@ ChromeUtils.defineLazyGetter(this, "AlertsServiceDND", function () {
}
});
+ChromeUtils.defineLazyGetter(lazy, "AboutLoginsL10n", () => {
+ return new Localization(["branding/brand.ftl", "browser/aboutLogins.ftl"]);
+});
+
XPCOMUtils.defineLazyServiceGetter(
lazy,
"gParentalControlsService",
@@ -69,13 +73,6 @@ XPCOMUtils.defineLazyServiceGetter(
XPCOMUtils.defineLazyPreferenceGetter(
this,
- "OS_AUTH_ENABLED",
- "signon.management.page.os-auth.enabled",
- true
-);
-
-XPCOMUtils.defineLazyPreferenceGetter(
- this,
"gIsFirstPartyIsolated",
"privacy.firstparty.isolate",
false
@@ -1053,6 +1050,7 @@ var gPrivacyPane = {
this._initPasswordGenerationUI();
this._initRelayIntegrationUI();
this._initMasterPasswordUI();
+ this._initOSAuthentication();
this.initListenersForExtensionControllingPasswordManager();
@@ -2863,8 +2861,7 @@ var gPrivacyPane = {
// OS reauthenticate functionality is not available on Linux yet (bug 1527745)
if (
!LoginHelper.isPrimaryPasswordSet() &&
- OS_AUTH_ENABLED &&
- OSKeyStore.canReauth()
+ LoginHelper.getOSAuthEnabled(LoginHelper.OS_AUTH_FOR_PASSWORDS_PREF)
) {
// Uses primary-password-os-auth-dialog-message-win and
// primary-password-os-auth-dialog-message-macosx via concatenation:
@@ -2961,6 +2958,54 @@ var gPrivacyPane = {
this._updateRelayIntegrationUI();
},
+ async _toggleOSAuth() {
+ let osReauthCheckbox = document.getElementById("osReauthCheckbox");
+
+ const messageText = await lazy.AboutLoginsL10n.formatValue(
+ "about-logins-os-auth-dialog-message"
+ );
+ const captionText = await lazy.AboutLoginsL10n.formatValue(
+ "about-logins-os-auth-dialog-caption"
+ );
+ let win =
+ osReauthCheckbox.ownerGlobal.docShell.chromeEventHandler.ownerGlobal;
+
+ // Calling OSKeyStore.ensureLoggedIn() instead of LoginHelper.verifyOSAuth()
+ // since we want to authenticate user each time this stting is changed.
+ let isAuthorized = (
+ await OSKeyStore.ensureLoggedIn(messageText, captionText, win, false)
+ ).authenticated;
+ if (!isAuthorized) {
+ osReauthCheckbox.checked = !osReauthCheckbox.checked;
+ return;
+ }
+
+ // If osReauthCheckbox is checked enable osauth.
+ LoginHelper.setOSAuthEnabled(
+ LoginHelper.OS_AUTH_FOR_PASSWORDS_PREF,
+ osReauthCheckbox.checked
+ );
+ },
+
+ _initOSAuthentication() {
+ let osReauthCheckbox = document.getElementById("osReauthCheckbox");
+ if (!OSKeyStore.canReauth()) {
+ osReauthCheckbox.hidden = true;
+ return;
+ }
+
+ osReauthCheckbox.setAttribute(
+ "checked",
+ LoginHelper.getOSAuthEnabled(LoginHelper.OS_AUTH_FOR_PASSWORDS_PREF)
+ );
+
+ setEventListener(
+ "osReauthCheckbox",
+ "command",
+ gPrivacyPane._toggleOSAuth.bind(gPrivacyPane)
+ );
+ },
+
/**
* Shows the sites where the user has saved passwords and the associated login
* information.
@@ -3227,8 +3272,8 @@ var gPrivacyPane = {
initDataCollection() {
if (
!AppConstants.MOZ_DATA_REPORTING &&
- !NimbusFeatures.majorRelease2022.getVariable(
- "feltPrivacyShowPreferencesSection"
+ !Services.prefs.getBoolPref(
+ "browser.privacySegmentation.preferences.show"
)
) {
// Nothing to control in the data collection section, remove it.
@@ -3255,16 +3300,19 @@ var gPrivacyPane = {
// Section visibility
let section = document.getElementById("privacySegmentationSection");
let updatePrivacySegmentationSectionVisibilityState = () => {
- section.hidden = !NimbusFeatures.majorRelease2022.getVariable(
- "feltPrivacyShowPreferencesSection"
+ section.hidden = !Services.prefs.getBoolPref(
+ "browser.privacySegmentation.preferences.show"
);
};
- NimbusFeatures.majorRelease2022.onUpdate(
+ Services.prefs.addObserver(
+ "browser.privacySegmentation.preferences.show",
updatePrivacySegmentationSectionVisibilityState
);
+
window.addEventListener("unload", () => {
- NimbusFeatures.majorRelease2022.offUpdate(
+ Services.prefs.removeObserver(
+ "browser.privacySegmentation.preferences.show",
updatePrivacySegmentationSectionVisibilityState
);
});