зеркало из https://github.com/mozilla/pjs.git
Bug 60708; prevent user from creating helper app entries with blank mime type fields; r=pchen, sr=ben
This commit is contained in:
Родитель
b780ea8c61
Коммит
5aff5f2905
|
@ -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?
|
||||
|
|
Загрузка…
Ссылка в новой задаче