Bug 60708; prevent user from creating helper app entries with blank mime type fields; r=pchen, sr=ben

This commit is contained in:
law%netscape.com 2006-05-17 02:32:57 +00:00
Родитель 5230b15caf
Коммит 45bd5bb7cd
3 изменённых файлов: 26 добавлений и 1 удалений

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

@ -403,3 +403,22 @@ function removeOverride(aMIMEType)
}
}
}
function checkInput() {
var result = true;
// Check for empty MIME type field.
if ( gMIMEField.value == "" ) {
// Input is not OK.
result = false;
// Focus the mime type field.
gMIMEField.focus();
// Put up alert. Title is same as parent dialog's.
var title = window.document.documentElement.getAttribute( "title" );
var text = gPrefApplicationsBundle.getString("emptyMIMEType");
var prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
prompter.alert(window, title, text);
}
return result;
}

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

@ -178,6 +178,10 @@
function onAccept()
{
// Validate input.
if ( !checkInput() ) {
return false;
}
getDS();
// figure out if this mime type already exists.
if (gMIMEField.value != gOldMIME) {

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

@ -9,5 +9,7 @@ programsFilter=Programs
handlerExists=A helper already exists for the MIME type '%mime%'. Do you want to replace it?
handlerExistsTitle=Helper Application Exists
emptyMIMEType=You must specify a MIME type.
removeHandlerTitle=Remove File Type
removeHandler=If you remove a registered type, the helper will no longer be able to automatically handle files of this type. %n%nAre you sure you want to remove this file type?
removeHandler=If you remove a registered type, the helper will no longer be able to automatically handle files of this type. %n%nAre you sure you want to remove this file type?