Bug 1176698 - Use fallible allocator for attribute values in the HTML parser. r=wchen.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "nsString.h"
|
||||
#include "jArray.h"
|
||||
#include "nsHtml5Portability.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
|
||||
nsIAtom*
|
||||
nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5AtomTable* interner)
|
||||
@@ -16,9 +17,15 @@ nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf, int32_t offset, int32_
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5Portability::newStringFromBuffer(char16_t* buf, int32_t offset, int32_t length)
|
||||
nsHtml5Portability::newStringFromBuffer(char16_t* buf, int32_t offset, int32_t length, nsHtml5TreeBuilder* treeBuilder)
|
||||
{
|
||||
return new nsString(buf + offset, length);
|
||||
nsString* str = new nsString();
|
||||
bool succeeded = str->Append(buf + offset, length, mozilla::fallible);
|
||||
if (!succeeded) {
|
||||
str->Assign(char16_t(0xFFFD));
|
||||
treeBuilder->MarkAsBroken(NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
nsString*
|
||||
|
||||
Reference in New Issue
Block a user