Bug 527713 - Use nsIPromptService's alert instead of window.alert. r=kaie

This commit is contained in:
Marek Stępień 2010-07-18 16:41:54 +02:00
Родитель 9855496f0b
Коммит 7c24f6e03d
5 изменённых файлов: 44 добавлений и 16 удалений

Просмотреть файл

@ -387,7 +387,7 @@ function doLogin()
}
} catch (e) {
var alertStr = bundle.GetStringFromName("login_failed");
alert(alertStr);
doPrompt(alertStr);
}
enableButtons();
}
@ -537,7 +537,7 @@ function toggleFIPS()
case nsIPKCS11Slot.SLOT_UNINITIALIZED:
case nsIPKCS11Slot.SLOT_READY:
// Token has either no or an empty password.
alert(bundle.GetStringFromName("fips_nonempty_password_required"));
doPrompt(bundle.GetStringFromName("fips_nonempty_password_required"));
return;
}
}

Просмотреть файл

@ -44,6 +44,13 @@ const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
var certdb;
var cert;
function doPrompt(msg)
{
let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
getService(Components.interfaces.nsIPromptService);
prompts.alert(window, null, msg);
}
function setWindowName()
{
var dbkey = self.name;
@ -235,7 +242,7 @@ function editCaTrust()
else
{
var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");
alert(bundle.GetStringFromName("issuerCertNotFound"));
doPrompt(bundle.GetStringFromName("issuerCertNotFound"));
}
}

Просмотреть файл

@ -47,6 +47,13 @@ var params;
var tokenName="";
var pw1;
function doPrompt(msg)
{
let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
getService(Components.interfaces.nsIPromptService);
prompts.alert(window, null, msg);
}
function onLoad()
{
document.documentElement.getButton("accept").disabled = true;
@ -196,18 +203,18 @@ function setPassword()
var secmoddb = Components.classes[nsPKCS11ModuleDB].getService(nsIPKCS11ModuleDB);
if (secmoddb.isFIPSEnabled) {
// empty passwords are not allowed in FIPS mode
alert(bundle.GetStringFromName("pw_change2empty_in_fips_mode"));
doPrompt(bundle.GetStringFromName("pw_change2empty_in_fips_mode"));
passok = 0;
}
}
if (passok) {
token.changePassword(oldpw, pw1.value);
if (pw1.value == "") {
alert(bundle.GetStringFromName("pw_erased_ok")
doPrompt(bundle.GetStringFromName("pw_erased_ok")
+ " "
+ bundle.GetStringFromName("pw_empty_warning"));
} else {
alert(bundle.GetStringFromName("pw_change_ok"));
doPrompt(bundle.GetStringFromName("pw_change_ok"));
}
success = true;
}
@ -215,15 +222,15 @@ function setPassword()
} else {
oldpwbox.focus();
oldpwbox.setAttribute("value", "");
alert(bundle.GetStringFromName("incorrect_pw"));
doPrompt(bundle.GetStringFromName("incorrect_pw"));
}
} catch (e) {
alert(bundle.GetStringFromName("failed_pw_change"));
doPrompt(bundle.GetStringFromName("failed_pw_change"));
}
} else {
token.initPassword(pw1.value);
if (pw1.value == "") {
alert(bundle.GetStringFromName("pw_not_wanted")
doPrompt(bundle.GetStringFromName("pw_not_wanted")
+ " "
+ bundle.GetStringFromName("pw_empty_warning"));
}
@ -267,7 +274,7 @@ function setPasswordStrength()
// upper and lower case characters
var pw=document.getElementById('pw1').value;
// alert("password='" + pw +"'");
// doPrompt("password='" + pw +"'");
//length of the password
var pwlength=(pw.length);

Просмотреть файл

@ -60,6 +60,13 @@ var autoupdateErrDetailString = "security.crl.autoupdate.errDetail.";
var autoupdateDayCntString = "security.crl.autoupdate.dayCnt.";
var autoupdateFreqCntString = "security.crl.autoupdate.freqCnt.";
function doPrompt(msg)
{
let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
getService(Components.interfaces.nsIPromptService);
prompts.alert(window, null, msg);
}
function onLoad()
{
crlManager = Components.classes[nsCRLManager].getService(nsICRLManager);
@ -162,7 +169,7 @@ function initializeSelection()
var timeBasedBox = document.getElementById("nextUpdateDay");
try {
var dayCnt = prefBranch.getCharPref(autoupdateDayCntString);
//alert(dayCnt);
//doPrompt(dayCnt);
if(dayCnt != null){
timeBasedBox.value = dayCnt;
} else {
@ -175,7 +182,7 @@ function initializeSelection()
var freqBasedBox = document.getElementById("nextUpdateFreq");
try {
var freqCnt = prefBranch.getCharPref(autoupdateFreqCntString);
//alert(freqCnt);
//doPrompt(freqCnt);
if(freqCnt != null){
freqBasedBox.value = freqCnt;
} else {
@ -234,7 +241,7 @@ function onAccept()
updateTime = crlManager.computeNextAutoUpdateTime(crl, crlManager.TYPE_AUTOUPDATE_FREQ_BASED, freqCnt);
}
//alert(updateTime);
//doPrompt(updateTime);
prefBranch.setCharPref(autoupdateTimeString, updateTime);
prefBranch.setCharPref(autoupdateDayCntString, dayCnt);
prefBranch.setCharPref(autoupdateFreqCntString, freqCnt);
@ -254,13 +261,13 @@ function validatePrefs()
var tmp = parseFloat(dayCnt);
if(!(tmp > 0.0)){
alert(bundle.GetStringFromName("crlAutoUpdateDayCntError"));
doPrompt(bundle.GetStringFromName("crlAutoUpdateDayCntError"));
return false;
}
tmp = parseFloat(freqCnt);
if(!(tmp > 0.0)){
alert(bundle.GetStringFromName("crlAutoUpdtaeFreqCntError"));
doPrompt(bundle.GetStringFromName("crlAutoUpdtaeFreqCntError"));
return false;
}

Просмотреть файл

@ -54,6 +54,13 @@ const nsASN1Tree = "@mozilla.org/security/nsASN1Tree;1"
var bundle;
function doPrompt(msg)
{
let prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
getService(Components.interfaces.nsIPromptService);
prompts.alert(window, null, msg);
}
function AddCertChain(node, chain, idPrefix)
{
var idfier = idPrefix+"chain_";
@ -297,7 +304,7 @@ function updateCertDump()
var tree = document.getElementById('treesetDump');
if (tree.currentIndex < 0) {
alert("No items are selected."); //This should never happen.
doPrompt("No items are selected."); //This should never happen.
} else {
var item = tree.contentView.getItemAtIndex(tree.currentIndex);
var dbKey = item.firstChild.firstChild.getAttribute('display');