Bug 1355479 - Flatten attribute storage in the HTML parser to AutoTArray to avoid malloc.

HTML Regen.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-18 16:08:45 -05:00 committed by Roy Tam
commit 84ba7ad062
18 changed files with 66 additions and 71 deletions

View file

@ -62,7 +62,6 @@
#include "nsHtml5MetaScanner.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
#include "nsHtml5HtmlAttributes.h"
#include "nsHtml5StackNode.h"
#include "nsHtml5UTF16Buffer.h"
#include "nsHtml5StateSnapshot.h"
@ -1260,11 +1259,11 @@ nsHtml5TreeBuilder::startTag(nsHtml5ElementName* elementName, nsHtml5HtmlAttribu
nsHtml5HtmlAttributes* inputAttributes = new nsHtml5HtmlAttributes(0);
inputAttributes->addAttribute(nsHtml5AttributeName::ATTR_NAME, nsHtml5Portability::newStringFromLiteral("isindex"), tokenizer->getLineNumber());
for (int32_t i = 0; i < attributes->getLength(); i++) {
nsHtml5AttributeName* attributeQName = attributes->getAttributeNameNoBoundsCheck(i);
if (nsHtml5AttributeName::ATTR_NAME == attributeQName || nsHtml5AttributeName::ATTR_PROMPT == attributeQName) {
nsIAtom* attributeQName = attributes->getLocalNameNoBoundsCheck(i);
if (nsHtml5Atoms::name == attributeQName || nsHtml5Atoms::prompt == attributeQName) {
attributes->releaseValue(i);
} else if (nsHtml5AttributeName::ATTR_ACTION != attributeQName) {
inputAttributes->addAttribute(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i));
} else if (nsHtml5Atoms::action != attributeQName) {
inputAttributes->AddAttributeWithLocal(attributeQName, attributes->getValueNoBoundsCheck(i), attributes->getLineNoBoundsCheck(i));
}
}
attributes->clearWithoutReleasingContents();