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 2001-12-06 03:28:10 +00:00
Родитель b780ea8c61
Коммит 5aff5f2905
4 изменённых файлов: 31 добавлений и 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) {

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

@ -65,6 +65,11 @@ function chooseApp()
var gDS = null;
function onOK()
{
// Make sure all fields are filled in OK.
if ( !checkInput() ) {
return false;
}
const mimeTypes = "UMimTyp";
var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"].getService();
if (fileLocator)

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

@ -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?