mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 22:28:59 +02:00
This uses the pref browser.preferences.useOldOrganization=true to use the old prefs. MozReview-Commit-ID: DQyHYSZJTKd --HG-- rename : browser/components/preferences/in-content/advanced.js => browser/components/preferences/in-content-old/advanced.js rename : browser/components/preferences/in-content/advanced.xul => browser/components/preferences/in-content-old/advanced.xul rename : browser/components/preferences/in-content/applications.js => browser/components/preferences/in-content-old/applications.js rename : browser/components/preferences/in-content/applications.xul => browser/components/preferences/in-content-old/applications.xul rename : browser/components/preferences/in-content/containers.js => browser/components/preferences/in-content-old/containers.js rename : browser/components/preferences/in-content/containers.xul => browser/components/preferences/in-content-old/containers.xul rename : browser/components/preferences/in-content/content.js => browser/components/preferences/in-content-old/content.js rename : browser/components/preferences/in-content/content.xul => browser/components/preferences/in-content-old/content.xul rename : browser/components/preferences/in-content/jar.mn => browser/components/preferences/in-content-old/jar.mn rename : browser/components/preferences/in-content/main.js => browser/components/preferences/in-content-old/main.js rename : browser/components/preferences/in-content/main.xul => browser/components/preferences/in-content-old/main.xul rename : browser/components/preferences/in-content/moz.build => browser/components/preferences/in-content-old/moz.build rename : browser/components/preferences/in-content/preferences.js => browser/components/preferences/in-content-old/preferences.js rename : browser/components/preferences/in-content/preferences.xul => browser/components/preferences/in-content-old/preferences.xul rename : browser/components/preferences/in-content/privacy.js => browser/components/preferences/in-content-old/privacy.js rename : browser/components/preferences/in-content/privacy.xul => browser/components/preferences/in-content-old/privacy.xul rename : browser/components/preferences/in-content/search.js => browser/components/preferences/in-content-old/search.js rename : browser/components/preferences/in-content/search.xul => browser/components/preferences/in-content-old/search.xul rename : browser/components/preferences/in-content/security.js => browser/components/preferences/in-content-old/security.js rename : browser/components/preferences/in-content/security.xul => browser/components/preferences/in-content-old/security.xul rename : browser/components/preferences/in-content/subdialogs.js => browser/components/preferences/in-content-old/subdialogs.js rename : browser/components/preferences/in-content/sync.js => browser/components/preferences/in-content-old/sync.js rename : browser/components/preferences/in-content/sync.xul => browser/components/preferences/in-content-old/sync.xul rename : browser/components/preferences/in-content/tests/.eslintrc.js => browser/components/preferences/in-content-old/tests/.eslintrc.js rename : browser/components/preferences/in-content/tests/browser.ini => browser/components/preferences/in-content-old/tests/browser.ini rename : browser/components/preferences/in-content/tests/browser_advanced_siteData.js => browser/components/preferences/in-content-old/tests/browser_advanced_siteData.js rename : browser/components/preferences/in-content/tests/browser_advanced_update.js => browser/components/preferences/in-content-old/tests/browser_advanced_update.js rename : browser/components/preferences/in-content/tests/browser_applications_selection.js => browser/components/preferences/in-content-old/tests/browser_applications_selection.js rename : browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js => browser/components/preferences/in-content-old/tests/browser_basic_rebuild_fonts_test.js rename : browser/components/preferences/in-content/tests/browser_bug1018066_resetScrollPosition.js => browser/components/preferences/in-content-old/tests/browser_bug1018066_resetScrollPosition.js rename : browser/components/preferences/in-content/tests/browser_bug1020245_openPreferences_to_paneContent.js => browser/components/preferences/in-content-old/tests/browser_bug1020245_openPreferences_to_paneContent.js rename : browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js => browser/components/preferences/in-content-old/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.js rename : browser/components/preferences/in-content/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul => browser/components/preferences/in-content-old/tests/browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul rename : browser/components/preferences/in-content/tests/browser_bug410900.js => browser/components/preferences/in-content-old/tests/browser_bug410900.js rename : browser/components/preferences/in-content/tests/browser_bug705422.js => browser/components/preferences/in-content-old/tests/browser_bug705422.js rename : browser/components/preferences/in-content/tests/browser_bug731866.js => browser/components/preferences/in-content-old/tests/browser_bug731866.js rename : browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js => browser/components/preferences/in-content-old/tests/browser_bug795764_cachedisabled.js rename : browser/components/preferences/in-content/tests/browser_change_app_handler.js => browser/components/preferences/in-content-old/tests/browser_change_app_handler.js rename : browser/components/preferences/in-content/tests/browser_connection.js => browser/components/preferences/in-content-old/tests/browser_connection.js rename : browser/components/preferences/in-content/tests/browser_connection_bug388287.js => browser/components/preferences/in-content-old/tests/browser_connection_bug388287.js rename : browser/components/preferences/in-content/tests/browser_cookies_exceptions.js => browser/components/preferences/in-content-old/tests/browser_cookies_exceptions.js rename : browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js => browser/components/preferences/in-content-old/tests/browser_defaultbrowser_alwayscheck.js rename : browser/components/preferences/in-content/tests/browser_healthreport.js => browser/components/preferences/in-content-old/tests/browser_healthreport.js rename : browser/components/preferences/in-content/tests/browser_homepages_filter_aboutpreferences.js => browser/components/preferences/in-content-old/tests/browser_homepages_filter_aboutpreferences.js rename : browser/components/preferences/in-content/tests/browser_notifications_do_not_disturb.js => browser/components/preferences/in-content-old/tests/browser_notifications_do_not_disturb.js rename : browser/components/preferences/in-content/tests/browser_permissions_urlFieldHidden.js => browser/components/preferences/in-content-old/tests/browser_permissions_urlFieldHidden.js rename : browser/components/preferences/in-content/tests/browser_privacypane_1.js => browser/components/preferences/in-content-old/tests/browser_privacypane_1.js rename : browser/components/preferences/in-content/tests/browser_privacypane_3.js => browser/components/preferences/in-content-old/tests/browser_privacypane_3.js rename : browser/components/preferences/in-content/tests/browser_privacypane_4.js => browser/components/preferences/in-content-old/tests/browser_privacypane_4.js rename : browser/components/preferences/in-content/tests/browser_privacypane_5.js => browser/components/preferences/in-content-old/tests/browser_privacypane_5.js rename : browser/components/preferences/in-content/tests/browser_privacypane_8.js => browser/components/preferences/in-content-old/tests/browser_privacypane_8.js rename : browser/components/preferences/in-content/tests/browser_proxy_backup.js => browser/components/preferences/in-content-old/tests/browser_proxy_backup.js rename : browser/components/preferences/in-content/tests/browser_sanitizeOnShutdown_prefLocked.js => browser/components/preferences/in-content-old/tests/browser_sanitizeOnShutdown_prefLocked.js rename : browser/components/preferences/in-content/tests/browser_searchsuggestions.js => browser/components/preferences/in-content-old/tests/browser_searchsuggestions.js rename : browser/components/preferences/in-content/tests/browser_security.js => browser/components/preferences/in-content-old/tests/browser_security.js rename : browser/components/preferences/in-content/tests/browser_subdialogs.js => browser/components/preferences/in-content-old/tests/browser_subdialogs.js rename : browser/components/preferences/in-content/tests/browser_telemetry.js => browser/components/preferences/in-content-old/tests/browser_telemetry.js rename : browser/components/preferences/in-content/tests/head.js => browser/components/preferences/in-content-old/tests/head.js rename : browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js => browser/components/preferences/in-content-old/tests/privacypane_tests_perwindow.js rename : browser/components/preferences/in-content/tests/site_data_test.html => browser/components/preferences/in-content-old/tests/site_data_test.html rename : browser/components/preferences/in-content/tests/subdialog.xul => browser/components/preferences/in-content-old/tests/subdialog.xul rename : browser/components/preferences/in-content/tests/subdialog2.xul => browser/components/preferences/in-content-old/tests/subdialog2.xul rename : browser/locales/en-US/chrome/browser/preferences/advanced.dtd => browser/locales/en-US/chrome/browser/preferences-old/advanced.dtd rename : browser/locales/en-US/chrome/browser/preferences/applications.dtd => browser/locales/en-US/chrome/browser/preferences-old/applications.dtd rename : browser/locales/en-US/chrome/browser/preferences/containers.dtd => browser/locales/en-US/chrome/browser/preferences-old/containers.dtd rename : browser/locales/en-US/chrome/browser/preferences/containers.properties => browser/locales/en-US/chrome/browser/preferences-old/containers.properties rename : browser/locales/en-US/chrome/browser/preferences/content.dtd => browser/locales/en-US/chrome/browser/preferences-old/content.dtd rename : browser/locales/en-US/chrome/browser/preferences/main.dtd => browser/locales/en-US/chrome/browser/preferences-old/main.dtd rename : browser/locales/en-US/chrome/browser/preferences/preferences.dtd => browser/locales/en-US/chrome/browser/preferences-old/preferences.dtd rename : browser/locales/en-US/chrome/browser/preferences/preferences.properties => browser/locales/en-US/chrome/browser/preferences-old/preferences.properties rename : browser/locales/en-US/chrome/browser/preferences/privacy.dtd => browser/locales/en-US/chrome/browser/preferences-old/privacy.dtd rename : browser/locales/en-US/chrome/browser/preferences/search.dtd => browser/locales/en-US/chrome/browser/preferences-old/search.dtd rename : browser/locales/en-US/chrome/browser/preferences/security.dtd => browser/locales/en-US/chrome/browser/preferences-old/security.dtd rename : browser/locales/en-US/chrome/browser/preferences/sync.dtd => browser/locales/en-US/chrome/browser/preferences-old/sync.dtd rename : browser/locales/en-US/chrome/browser/preferences/tabs.dtd => browser/locales/en-US/chrome/browser/preferences-old/tabs.dtd extra : rebase_source : a2e39a4526b4938d3275978ab54bd24ed8427d1a
292 lines
9.9 KiB
JavaScript
292 lines
9.9 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* import-globals-from preferences.js */
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
|
|
"resource://gre/modules/LoginHelper.jsm");
|
|
|
|
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
|
|
|
var gSecurityPane = {
|
|
_pane: null,
|
|
|
|
/**
|
|
* Initializes master password UI.
|
|
*/
|
|
init() {
|
|
function setEventListener(aId, aEventType, aCallback) {
|
|
document.getElementById(aId)
|
|
.addEventListener(aEventType, aCallback.bind(gSecurityPane));
|
|
}
|
|
|
|
this._pane = document.getElementById("paneSecurity");
|
|
this._initMasterPasswordUI();
|
|
this._initSafeBrowsing();
|
|
|
|
setEventListener("addonExceptions", "command",
|
|
gSecurityPane.showAddonExceptions);
|
|
setEventListener("passwordExceptions", "command",
|
|
gSecurityPane.showPasswordExceptions);
|
|
setEventListener("useMasterPassword", "command",
|
|
gSecurityPane.updateMasterPasswordButton);
|
|
setEventListener("changeMasterPassword", "command",
|
|
gSecurityPane.changeMasterPassword);
|
|
setEventListener("showPasswords", "command",
|
|
gSecurityPane.showPasswords);
|
|
},
|
|
|
|
// ADD-ONS
|
|
|
|
/*
|
|
* Preferences:
|
|
*
|
|
* xpinstall.whitelist.required
|
|
* - true if a site must be added to a site whitelist before extensions
|
|
* provided by the site may be installed from it, false if the extension
|
|
* may be directly installed after a confirmation dialog
|
|
*/
|
|
|
|
/**
|
|
* Enables/disables the add-ons Exceptions button depending on whether
|
|
* or not add-on installation warnings are displayed.
|
|
*/
|
|
readWarnAddonInstall() {
|
|
var warn = document.getElementById("xpinstall.whitelist.required");
|
|
var exceptions = document.getElementById("addonExceptions");
|
|
|
|
exceptions.disabled = !warn.value;
|
|
|
|
// don't override the preference value
|
|
return undefined;
|
|
},
|
|
|
|
/**
|
|
* Displays the exceptions lists for add-on installation warnings.
|
|
*/
|
|
showAddonExceptions() {
|
|
var bundlePrefs = document.getElementById("bundlePreferences");
|
|
|
|
var params = this._addonParams;
|
|
if (!params.windowTitle || !params.introText) {
|
|
params.windowTitle = bundlePrefs.getString("addons_permissions_title");
|
|
params.introText = bundlePrefs.getString("addonspermissionstext");
|
|
}
|
|
|
|
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
|
|
null, params);
|
|
},
|
|
|
|
/**
|
|
* Parameters for the add-on install permissions dialog.
|
|
*/
|
|
_addonParams:
|
|
{
|
|
blockVisible: false,
|
|
sessionVisible: false,
|
|
allowVisible: true,
|
|
prefilledHost: "",
|
|
permissionType: "install"
|
|
},
|
|
|
|
// PASSWORDS
|
|
|
|
/*
|
|
* Preferences:
|
|
*
|
|
* signon.rememberSignons
|
|
* - true if passwords are remembered, false otherwise
|
|
*/
|
|
|
|
/**
|
|
* Enables/disables the Exceptions button used to configure sites where
|
|
* passwords are never saved. When browser is set to start in Private
|
|
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
|
|
*/
|
|
readSavePasswords() {
|
|
var pref = document.getElementById("signon.rememberSignons");
|
|
var excepts = document.getElementById("passwordExceptions");
|
|
|
|
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
|
document.getElementById("savePasswords").disabled = true;
|
|
excepts.disabled = true;
|
|
return false;
|
|
}
|
|
excepts.disabled = !pref.value;
|
|
// don't override pref value in UI
|
|
return undefined;
|
|
},
|
|
|
|
/**
|
|
* Displays a dialog in which the user can view and modify the list of sites
|
|
* where passwords are never saved.
|
|
*/
|
|
showPasswordExceptions() {
|
|
var bundlePrefs = document.getElementById("bundlePreferences");
|
|
var params = {
|
|
blockVisible: true,
|
|
sessionVisible: false,
|
|
allowVisible: false,
|
|
hideStatusColumn: true,
|
|
prefilledHost: "",
|
|
permissionType: "login-saving",
|
|
windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
|
|
introText: bundlePrefs.getString("savedLoginsExceptions_desc")
|
|
};
|
|
|
|
gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
|
|
null, params);
|
|
},
|
|
|
|
/**
|
|
* Initializes master password UI: the "use master password" checkbox, selects
|
|
* the master password button to show, and enables/disables it as necessary.
|
|
* The master password is controlled by various bits of NSS functionality, so
|
|
* the UI for it can't be controlled by the normal preference bindings.
|
|
*/
|
|
_initMasterPasswordUI() {
|
|
var noMP = !LoginHelper.isMasterPasswordSet();
|
|
|
|
var button = document.getElementById("changeMasterPassword");
|
|
button.disabled = noMP;
|
|
|
|
var checkbox = document.getElementById("useMasterPassword");
|
|
checkbox.checked = !noMP;
|
|
},
|
|
|
|
_initSafeBrowsing() {
|
|
let enableSafeBrowsing = document.getElementById("enableSafeBrowsing");
|
|
let blockDownloads = document.getElementById("blockDownloads");
|
|
let blockUncommonUnwanted = document.getElementById("blockUncommonUnwanted");
|
|
|
|
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
|
|
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
|
|
|
|
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
|
|
let malwareTable = document.getElementById("urlclassifier.malwareTable");
|
|
|
|
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
|
|
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
|
|
|
|
enableSafeBrowsing.addEventListener("command", function() {
|
|
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
|
|
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
|
|
|
|
if (enableSafeBrowsing.checked) {
|
|
blockDownloads.removeAttribute("disabled");
|
|
if (blockDownloads.checked) {
|
|
blockUncommonUnwanted.removeAttribute("disabled");
|
|
}
|
|
} else {
|
|
blockDownloads.setAttribute("disabled", "true");
|
|
blockUncommonUnwanted.setAttribute("disabled", "true");
|
|
}
|
|
});
|
|
|
|
blockDownloads.addEventListener("command", function() {
|
|
blockDownloadsPref.value = blockDownloads.checked;
|
|
if (blockDownloads.checked) {
|
|
blockUncommonUnwanted.removeAttribute("disabled");
|
|
} else {
|
|
blockUncommonUnwanted.setAttribute("disabled", "true");
|
|
}
|
|
});
|
|
|
|
blockUncommonUnwanted.addEventListener("command", function() {
|
|
blockUnwantedPref.value = blockUncommonUnwanted.checked;
|
|
blockUncommonPref.value = blockUncommonUnwanted.checked;
|
|
|
|
let malware = malwareTable.value
|
|
.split(",")
|
|
.filter(x => x !== "goog-unwanted-shavar" && x !== "test-unwanted-simple");
|
|
|
|
if (blockUncommonUnwanted.checked) {
|
|
malware.push("goog-unwanted-shavar");
|
|
malware.push("test-unwanted-simple");
|
|
}
|
|
|
|
// sort alphabetically to keep the pref consistent
|
|
malware.sort();
|
|
|
|
malwareTable.value = malware.join(",");
|
|
});
|
|
|
|
// set initial values
|
|
|
|
enableSafeBrowsing.checked = safeBrowsingPhishingPref.value && safeBrowsingMalwarePref.value;
|
|
if (!enableSafeBrowsing.checked) {
|
|
blockDownloads.setAttribute("disabled", "true");
|
|
blockUncommonUnwanted.setAttribute("disabled", "true");
|
|
}
|
|
|
|
blockDownloads.checked = blockDownloadsPref.value;
|
|
if (!blockDownloadsPref.value) {
|
|
blockUncommonUnwanted.setAttribute("disabled", "true");
|
|
}
|
|
|
|
blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
|
|
},
|
|
|
|
/**
|
|
* Enables/disables the master password button depending on the state of the
|
|
* "use master password" checkbox, and prompts for master password removal if
|
|
* one is set.
|
|
*/
|
|
updateMasterPasswordButton() {
|
|
var checkbox = document.getElementById("useMasterPassword");
|
|
var button = document.getElementById("changeMasterPassword");
|
|
button.disabled = !checkbox.checked;
|
|
|
|
// unchecking the checkbox should try to immediately remove the master
|
|
// password, because it's impossible to non-destructively remove the master
|
|
// password used to encrypt all the passwords without providing it (by
|
|
// design), and it would be extremely odd to pop up that dialog when the
|
|
// user closes the prefwindow and saves his settings
|
|
if (!checkbox.checked)
|
|
this._removeMasterPassword();
|
|
else
|
|
this.changeMasterPassword();
|
|
|
|
this._initMasterPasswordUI();
|
|
},
|
|
|
|
/**
|
|
* Displays the "remove master password" dialog to allow the user to remove
|
|
* the current master password. When the dialog is dismissed, master password
|
|
* UI is automatically updated.
|
|
*/
|
|
_removeMasterPassword() {
|
|
var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
|
|
getService(Ci.nsIPKCS11ModuleDB);
|
|
if (secmodDB.isFIPSEnabled) {
|
|
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
|
getService(Ci.nsIPromptService);
|
|
var bundle = document.getElementById("bundlePreferences");
|
|
promptService.alert(window,
|
|
bundle.getString("pw_change_failed_title"),
|
|
bundle.getString("pw_change2empty_in_fips_mode"));
|
|
this._initMasterPasswordUI();
|
|
} else {
|
|
gSubDialog.open("chrome://mozapps/content/preferences/removemp.xul",
|
|
null, null, this._initMasterPasswordUI.bind(this));
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Displays a dialog in which the master password may be changed.
|
|
*/
|
|
changeMasterPassword() {
|
|
gSubDialog.open("chrome://mozapps/content/preferences/changemp.xul",
|
|
"resizable=no", null, this._initMasterPasswordUI.bind(this));
|
|
},
|
|
|
|
/**
|
|
* Shows the sites where the user has saved passwords and the associated login
|
|
* information.
|
|
*/
|
|
showPasswords() {
|
|
gSubDialog.open("chrome://passwordmgr/content/passwordManager.xul");
|
|
}
|
|
|
|
};
|