зеркало из https://github.com/mozilla/gecko-dev.git
281343 show an error message when filenames are too long; and convert that error
to an nsresult patch by Son Le <son.le0@gmail.com> r=biesi sr=darin
This commit is contained in:
Родитель
8fcfb86b19
Коммит
5dd7f9a4e8
|
@ -44,3 +44,5 @@ accessError=%S could not be saved, because you cannot change the contents of tha
|
|||
helperAppNotFound=%S could not be opened, because the associated helper application does not exist. Change the association in your preferences.
|
||||
noMemory=There is not sufficient memory to complete the action you requested.\n\nQuit some applications and try again.
|
||||
title=Downloading %S
|
||||
fileAlreadyExistsError=%S could not be saved, because a file already exists with the same name as the '_files' directory.\n\nTry saving to a different location.
|
||||
fileNameTooLongError=%S could not be saved, because the file name was too long.\n\nTry saving with a shorter file name.
|
||||
|
|
|
@ -1033,6 +1033,14 @@ nsresult nsWebBrowserPersist::SendErrorStatusChange(
|
|||
nsAutoString msgId;
|
||||
switch(aResult)
|
||||
{
|
||||
case NS_ERROR_FILE_NAME_TOO_LONG:
|
||||
// File name too long.
|
||||
msgId.AssignLiteral("fileNameTooLongError");
|
||||
break;
|
||||
case NS_ERROR_FILE_ALREADY_EXISTS:
|
||||
// File exists with same name as directory.
|
||||
msgId.AssignLiteral("fileAlreadyExistsError");
|
||||
break;
|
||||
case NS_ERROR_FILE_DISK_FULL:
|
||||
case NS_ERROR_FILE_NO_DEVICE_SPACE:
|
||||
// Out of space on target volume.
|
||||
|
@ -1584,9 +1592,13 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal(
|
|||
{
|
||||
localDataPath->IsDirectory(&haveDir);
|
||||
}
|
||||
if (!haveDir && NS_SUCCEEDED(localDataPath->Create(nsILocalFile::DIRECTORY_TYPE, 0755)))
|
||||
if (!haveDir)
|
||||
{
|
||||
haveDir = PR_TRUE;
|
||||
rv = localDataPath->Create(nsILocalFile::DIRECTORY_TYPE, 0755);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
haveDir = PR_TRUE;
|
||||
else
|
||||
SendErrorStatusChange(PR_FALSE, rv, nsnull, aFile);
|
||||
}
|
||||
if (!haveDir)
|
||||
{
|
||||
|
|
|
@ -254,10 +254,15 @@ static nsresult ConvertWinError(DWORD winErr)
|
|||
case ERROR_CANNOT_MAKE:
|
||||
rv = NS_ERROR_FILE_ALREADY_EXISTS;
|
||||
break;
|
||||
case ERROR_FILENAME_EXCED_RANGE:
|
||||
rv = NS_ERROR_FILE_NAME_TOO_LONG;
|
||||
break;
|
||||
case 0:
|
||||
rv = NS_OK;
|
||||
break;
|
||||
default:
|
||||
rv = NS_ERROR_FAILURE;
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче