Bug 1495698 - Fix hang when HTML signature references non-existent image. r=aceman

This commit is contained in:
Jorg K 2018-10-05 14:22:32 +02:00
Родитель e191920fe2
Коммит 7a80b646cf
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -4210,12 +4210,12 @@ nsMsgCompose::LoadDataFromFile(nsIFile *file, nsString &sigData,
* images loaded into the editor are available on send.
*/
nsresult
nsMsgCompose::ReplaceFileURLs(nsAutoString &aData)
nsMsgCompose::ReplaceFileURLs(nsString &aData)
{
int32_t fPos;
int32_t offset = -1; // We're using RFind(), so offset -1 is from the very right.
// XXX This code is rather incompelte since it looks for "file://" even
// XXX This code is rather incomplete since it looks for "file://" even
// outside tags.
while ((fPos = aData.RFind("file://", true, offset)) != kNotFound) {
bool quoted = false;
@ -4253,7 +4253,9 @@ nsMsgCompose::ReplaceFileURLs(nsAutoString &aData)
if (NS_SUCCEEDED(rv)) {
aData.Replace(fPos, end - fPos, dataURL);
}
offset = fPos;
if (fPos == 0)
break;
offset = fPos - 1;
}
return NS_OK;
}

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

@ -92,7 +92,7 @@ protected:
nsresult MoveToAboveQuote(void);
nsresult MoveToBeginningOfDocument(void);
nsresult MoveToEndOfDocument(void);
nsresult ReplaceFileURLs(nsAutoString &sigData);
nsresult ReplaceFileURLs(nsString &sigData);
nsresult DataURLForFileURL(const nsAString &aFileURL, nsAString &aDataURL);
// 3 = To, Cc, Bcc