Bug 1176698 - Use fallible allocator for attribute values in the HTML parser. r=wchen.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Henri Sivonen
|
||||
* Copyright (c) 2007-2011 Mozilla Foundation
|
||||
* Copyright (c) 2007-2015 Mozilla Foundation
|
||||
* Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla
|
||||
* Foundation, and Opera Software ASA.
|
||||
*
|
||||
@@ -1991,7 +1991,7 @@ nsHtml5TreeBuilder::isSpecialParentInForeign(nsHtml5StackNode* stackNode)
|
||||
}
|
||||
|
||||
nsString*
|
||||
nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue)
|
||||
nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue, nsHtml5TreeBuilder* tb)
|
||||
{
|
||||
int32_t charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL;
|
||||
int32_t start = -1;
|
||||
@@ -2180,7 +2180,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue)
|
||||
if (end == -1) {
|
||||
end = buffer.length;
|
||||
}
|
||||
charset = nsHtml5Portability::newStringFromBuffer(buffer, start, end - start);
|
||||
charset = nsHtml5Portability::newStringFromBuffer(buffer, start, end - start, tb);
|
||||
}
|
||||
return charset;
|
||||
}
|
||||
@@ -2201,7 +2201,7 @@ nsHtml5TreeBuilder::checkMetaCharset(nsHtml5HtmlAttributes* attributes)
|
||||
}
|
||||
nsString* content = attributes->getValue(nsHtml5AttributeName::ATTR_CONTENT);
|
||||
if (content) {
|
||||
nsString* extract = nsHtml5TreeBuilder::extractCharsetFromContent(content);
|
||||
nsString* extract = nsHtml5TreeBuilder::extractCharsetFromContent(content, this);
|
||||
if (extract) {
|
||||
if (tokenizer->internalEncodingDeclaration(extract)) {
|
||||
requestSuspension();
|
||||
|
||||
Reference in New Issue
Block a user