From a6712deaa27d84115d123508dbd215f443ac9b8c Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Wed, 27 Mar 2013 10:34:29 -0700 Subject: [PATCH] Bug 854881 - Remove broken Master Password support from /browser/metro [r=mbrubeck] --- browser/metro/base/content/browser-scripts.js | 1 - browser/metro/base/content/browser.xul | 2 - .../base/content/helperui/MasterPasswordUI.js | 133 ------------------ browser/metro/base/content/preferences.js | 1 - .../base/content/prompt/masterPassword.xul | 45 ------ .../content/prompt/removeMasterPassword.xul | 43 ------ browser/metro/base/jar.mn | 3 - .../locales/en-US/chrome/preferences.dtd | 1 - browser/metro/profile/metro.js | 1 - 9 files changed, 230 deletions(-) delete mode 100644 browser/metro/base/content/helperui/MasterPasswordUI.js delete mode 100644 browser/metro/base/content/prompt/masterPassword.xul delete mode 100644 browser/metro/base/content/prompt/removeMasterPassword.xul diff --git a/browser/metro/base/content/browser-scripts.js b/browser/metro/base/content/browser-scripts.js index 1b90663e21f..e72ccc1096d 100644 --- a/browser/metro/base/content/browser-scripts.js +++ b/browser/metro/base/content/browser-scripts.js @@ -108,7 +108,6 @@ let ScriptContexts = {}; ["MenuControlUI", "chrome://browser/content/helperui/MenuUI.js"], ["MenuPopup", "chrome://browser/content/helperui/MenuUI.js"], ["IndexedDB", "chrome://browser/content/helperui/IndexedDB.js"], - ["MasterPasswordUI", "chrome://browser/content/helperui/MasterPasswordUI.js"], ["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"], ["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"], ["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"], diff --git a/browser/metro/base/content/browser.xul b/browser/metro/base/content/browser.xul index 2ddea02f517..6d0e1e27a32 100644 --- a/browser/metro/base/content/browser.xul +++ b/browser/metro/base/content/browser.xul @@ -437,8 +437,6 @@ - - diff --git a/browser/metro/base/content/helperui/MasterPasswordUI.js b/browser/metro/base/content/helperui/MasterPasswordUI.js deleted file mode 100644 index 7a6f7ce77d4..00000000000 --- a/browser/metro/base/content/helperui/MasterPasswordUI.js +++ /dev/null @@ -1,133 +0,0 @@ -/* 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/. */ - -var MasterPasswordUI = { - _dialog: null, - _tokenName: "", - - get _secModuleDB() { - delete this._secModuleDB; - return this._secModuleDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].getService(Ci.nsIPKCS11ModuleDB); - }, - - get _pk11DB() { - delete this._pk11DB; - return this._pk11DB = Cc["@mozilla.org/security/pk11tokendb;1"].getService(Ci.nsIPK11TokenDB); - }, - - _setPassword: function _setPassword(password) { - try { - let status; - let slot = this._secModuleDB.findSlotByName(this._tokenName); - if (slot) - status = slot.status; - else - return false; - - let token = this._pk11DB.findTokenByName(this._tokenName); - - if (status == Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED) { - token.initPassword(password); - } else if (status == Ci.nsIPKCS11Slot.SLOT_READY) { - token.changePassword("", password); - } - return true; - } catch(e) { - dump("--- MasterPasswordUI._setPassword exception: " + e + "\n"); - return false; - } - }, - - _removePassword: function _removePassword(password) { - try { - let token = this._pk11DB.getInternalKeyToken(); - if (token.checkPassword(password)) { - token.changePassword(password, ""); - return true; - } - } catch(e) { - dump("--- MasterPasswordUI._removePassword exception: " + e + "\n"); - } - return false; - }, - - show: function mp_show(aSet) { - let dialogId = aSet ? "masterpassword-change" : "masterpassword-remove"; - if (document.getElementById(dialogId)) - return; - - let dialog = aSet ? "chrome://browser/content/prompt/masterPassword.xul" - : "chrome://browser/content/prompt/removeMasterPassword.xul"; - this._dialog = DialogUI.importModal(window, dialog, null); - DialogUI.pushPopup(this, this._dialog); - - if (aSet) { - this.checkPassword(); - document.getElementById("masterpassword-newpassword1").focus(); - } else { - document.getElementById("masterpassword-oldpassword").focus(); - } - }, - - hide: function mp_hide(aValue) { - this.updatePreference(); - this._dialog.close(); - this._dialog = null; - DialogUI.popPopup(this); - }, - - setPassword: function mp_setPassword() { - if (!this.checkPassword()) - return; - - let newPasswordValue = document.getElementById("masterpassword-newpassword1").value; - if (this._setPassword(newPasswordValue)) { - this.hide(); - } - }, - - removePassword: function mp_removePassword() { - let oldPassword = document.getElementById("masterpassword-oldpassword").value; - if (this._removePassword(oldPassword)) { - this.hide(); - } - }, - - checkPassword: function mp_checkPassword() { - let newPasswordValue1 = document.getElementById("masterpassword-newpassword1").value; - let newPasswordValue2 = document.getElementById("masterpassword-newpassword2").value; - - let buttonOk = this._dialog.getElementsByAttribute("class", "prompt-buttons")[0].firstChild; - let isPasswordValid = this._secModuleDB.isFIPSEnabled ? (newPasswordValue1 != "" && newPasswordValue1 == newPasswordValue2) - : (newPasswordValue1 == newPasswordValue2); - if (isPasswordValid) { - buttonOk.removeAttribute("disabled"); - } else { - buttonOk.setAttribute("disabled", true); - } - - return isPasswordValid; - }, - - checkOldPassword: function mp_checkOldPassword() { - let oldPassword = document.getElementById("masterpassword-oldpassword"); - - let buttonOk = this._dialog.getElementsByAttribute("class", "prompt-buttons")[0].firstChild; - let isPasswordValid = this._pk11DB.getInternalKeyToken().checkPassword(oldPassword.value); - buttonOk.setAttribute("disabled", !isPasswordValid); - }, - - hasMasterPassword: function mp_hasMasterPassword() { - let slot = this._secModuleDB.findSlotByName(this._tokenName); - if (slot) { - let status = slot.status; - return status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED && status != Ci.nsIPKCS11Slot.SLOT_READY; - } - return false; - }, - - updatePreference: function mp_updatePreference() { - document.getElementById("prefs-master-password").value = this.hasMasterPassword(); - } -}; diff --git a/browser/metro/base/content/preferences.js b/browser/metro/base/content/preferences.js index 4002a622fd1..fa952b673aa 100644 --- a/browser/metro/base/content/preferences.js +++ b/browser/metro/base/content/preferences.js @@ -9,7 +9,6 @@ var PreferencesPanelView = { Elements.prefsFlyout.addEventListener("PopupChanged", function onShow(aEvent) { if (aEvent.detail && aEvent.popup === Elements.prefsFlyout) { Elements.prefsFlyout.removeEventListener("PopupChanged", onShow, false); - MasterPasswordUI.updatePreference(); } }, false); } diff --git a/browser/metro/base/content/prompt/masterPassword.xul b/browser/metro/base/content/prompt/masterPassword.xul deleted file mode 100644 index e90d376693f..00000000000 --- a/browser/metro/base/content/prompt/masterPassword.xul +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - -%dialog; -%changempDTD; -]> - - - - - - - - - - - - - - - - &setPassword.title; - - - - - - - diff --git a/browser/metro/base/content/prompt/removeMasterPassword.xul b/browser/metro/base/content/prompt/removeMasterPassword.xul deleted file mode 100644 index eda47a12618..00000000000 --- a/browser/metro/base/content/prompt/removeMasterPassword.xul +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - -%dialog; -%removempDTD; -]> - - - - - - - - - - - - - - - - &removePassword.title; - - - - - - - diff --git a/browser/metro/base/jar.mn b/browser/metro/base/jar.mn index 0a625de3e9a..4cdd4962e7a 100644 --- a/browser/metro/base/jar.mn +++ b/browser/metro/base/jar.mn @@ -36,12 +36,9 @@ chrome.jar: content/prompt/promptPassword.xul (content/prompt/promptPassword.xul) content/prompt/select.xul (content/prompt/select.xul) content/prompt/prompt.js (content/prompt/prompt.js) - content/prompt/masterPassword.xul (content/prompt/masterPassword.xul) - content/prompt/removeMasterPassword.xul (content/prompt/removeMasterPassword.xul) content/helperui/AlertsHelper.js (content/helperui/AlertsHelper.js) content/helperui/IndexedDB.js (content/helperui/IndexedDB.js) - content/helperui/MasterPasswordUI.js (content/helperui/MasterPasswordUI.js) content/helperui/MenuUI.js (content/helperui/MenuUI.js) content/helperui/OfflineApps.js (content/helperui/OfflineApps.js) content/helperui/SelectHelperUI.js (content/helperui/SelectHelperUI.js) diff --git a/browser/metro/locales/en-US/chrome/preferences.dtd b/browser/metro/locales/en-US/chrome/preferences.dtd index 60f1381ff1a..8eef8d2c5e3 100644 --- a/browser/metro/locales/en-US/chrome/preferences.dtd +++ b/browser/metro/locales/en-US/chrome/preferences.dtd @@ -24,7 +24,6 @@ - diff --git a/browser/metro/profile/metro.js b/browser/metro/profile/metro.js index e5cf75e661e..df9722fb1a8 100644 --- a/browser/metro/profile/metro.js +++ b/browser/metro/profile/metro.js @@ -172,7 +172,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false); /* password manager */ pref("signon.rememberSignons", true); -pref("signon.expireMasterPassword", false); pref("signon.SignonFileName", "signons.txt"); /* find helper */