1 # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
15 # The Original Code is the Firefox Preferences System.
17 # The Initial Developer of the Original Code is
18 # Jeff Walden <jwalden+code@mit.edu>.
19 # Portions created by the Initial Developer are Copyright (C) 2006
20 # the Initial Developer. All Rights Reserved.
23 # Ryan Flint <rflint@dslr.net>
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
47 this._pane = document.getElementById(
"paneSecurity");
48 this._initMasterPasswordUI();
66 readWarnAddonInstall:
function ()
68 var warn = document.getElementById(
"xpinstall.whitelist.required");
69 var exceptions = document.getElementById(
"addonExceptions");
71 exceptions.disabled = !warn.value;
80 showAddonExceptions:
function ()
82 var bundlePrefs = document.getElementById(
"bundlePreferences");
84 var params = this._addonParams;
85 if (!params.windowTitle || !params.introText) {
86 params.windowTitle = bundlePrefs.getString(
"addons_permissions_title");
87 params.introText = bundlePrefs.getString(
"addonspermissionstext");
90 document.documentElement.openWindow(
"Browser:Permissions",
91 "chrome://browser/content/preferences/permissions.xul",
101 sessionVisible:
false,
104 permissionType:
"install"
120 readSavePasswords:
function ()
122 var
pref = document.getElementById(
"signon.rememberSignons");
123 var excepts = document.getElementById(
"passwordExceptions");
125 excepts.disabled = !pref.value;
135 showPasswordExceptions:
function ()
137 document.documentElement.openWindow(
"Toolkit:PasswordManagerExceptions",
138 "chrome://passwordmgr/content/passwordManagerExceptions.xul",
148 _initMasterPasswordUI:
function ()
150 var noMP = !this._masterPasswordSet();
152 var button = document.getElementById(
"changeMasterPassword");
153 button.disabled = noMP;
155 var checkbox = document.getElementById(
"useMasterPassword");
156 checkbox.checked = !noMP;
162 _masterPasswordSet:
function ()
164 const Cc = Components.classes,
Ci = Components.interfaces;
165 var secmodDB =
Cc[
"@mozilla.org/security/pkcs11moduledb;1"].
167 var slot = secmodDB.findSlotByName(
"");
169 var status = slot.status;
170 var hasMP = status !=
Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED &&
171 status !=
Ci.nsIPKCS11Slot.SLOT_READY;
184 updateMasterPasswordButton:
function ()
186 var checkbox = document.getElementById(
"useMasterPassword");
187 var button = document.getElementById(
"changeMasterPassword");
188 button.disabled = !checkbox.checked;
195 if (!checkbox.checked)
196 this._removeMasterPassword();
198 this.changeMasterPassword();
200 this._initMasterPasswordUI();
208 _removeMasterPassword:
function ()
210 const Cc = Components.classes,
Ci = Components.interfaces;
211 var secmodDB =
Cc[
"@mozilla.org/security/pkcs11moduledb;1"].
213 if (secmodDB.isFIPSEnabled) {
216 var
bundle = document.getElementById(
"bundlePreferences");
217 promptService.alert(
window,
218 bundle.getString(
"pw_change_failed_title"),
219 bundle.getString(
"pw_change2empty_in_fips_mode"));
222 document.documentElement.openSubDialog(
"chrome://mozapps/content/preferences/removemp.xul",
225 this._initMasterPasswordUI();
231 changeMasterPassword:
function ()
233 document.documentElement.openSubDialog(
"chrome://mozapps/content/preferences/changemp.xul",
235 this._initMasterPasswordUI();
242 showPasswords:
function ()
244 document.documentElement.openWindow(
"Toolkit:PasswordManager",
245 "chrome://passwordmgr/content/passwordManager.xul",
257 showWarningMessageSettings:
function ()
259 document.documentElement.openSubDialog(
"chrome://browser/content/preferences/securityWarnings.xul",
getService(Ci.sbIFaceplateManager)