summaryrefslogtreecommitdiff
path: root/parser/html/nsHtml5Tokenizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parser/html/nsHtml5Tokenizer.cpp')
-rw-r--r--parser/html/nsHtml5Tokenizer.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp
index aa5b3df282..3b1c34b588 100644
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -52,7 +52,6 @@
#include "nsHtml5MetaScanner.h"
#include "nsHtml5AttributeName.h"
#include "nsHtml5ElementName.h"
-#include "nsHtml5HtmlAttributes.h"
#include "nsHtml5StackNode.h"
#include "nsHtml5UTF16Buffer.h"
#include "nsHtml5StateSnapshot.h"
@@ -99,6 +98,7 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, bool viewin
tagName(nullptr),
nonInternedTagName(new nsHtml5ElementName()),
attributeName(nullptr),
+ nonInternedAttributeName(new nsHtml5AttributeName()),
doctypeName(nullptr),
publicIdentifier(nullptr),
systemIdentifier(nullptr),
@@ -325,13 +325,16 @@ void
nsHtml5Tokenizer::attributeNameComplete()
{
attributeName = nsHtml5AttributeName::nameByBuffer(strBuf, 0, strBufLen, interner);
+ if (!attributeName) {
+ nonInternedAttributeName->setNameForNonInterned(nsHtml5Portability::newLocalNameFromBuffer(strBuf, 0, strBufLen, interner));
+ attributeName = nonInternedAttributeName;
+ }
clearStrBufAfterUse();
if (!attributes) {
attributes = new nsHtml5HtmlAttributes(0);
}
if (attributes->contains(attributeName)) {
errDuplicateAttribute();
- attributeName->release();
attributeName = nullptr;
}
}
@@ -3941,10 +3944,8 @@ nsHtml5Tokenizer::end()
}
tagName = nullptr;
nonInternedTagName->setNameForNonInterned(nullptr);
- if (attributeName) {
- attributeName->release();
- attributeName = nullptr;
- }
+ attributeName = nullptr;
+ nonInternedAttributeName->setNameForNonInterned(nullptr);
tokenHandler->endTokenization();
if (attributes) {
attributes->clear(0);
@@ -3984,13 +3985,8 @@ nsHtml5Tokenizer::resetToDataState()
endTag = false;
shouldSuspend = false;
initDoctypeFields();
- if (tagName) {
- tagName = nullptr;
- }
- if (attributeName) {
- attributeName->release();
- attributeName = nullptr;
- }
+ tagName = nullptr;
+ attributeName = nullptr;
if (newAttributesEachTime) {
if (attributes) {
delete attributes;
@@ -4052,13 +4048,13 @@ nsHtml5Tokenizer::loadState(nsHtml5Tokenizer* other)
nonInternedTagName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->tagName->getName(), interner));
tagName = nonInternedTagName;
}
- if (attributeName) {
- attributeName->release();
- }
if (!other->attributeName) {
attributeName = nullptr;
+ } else if (other->attributeName->isInterned()) {
+ attributeName = other->attributeName;
} else {
- attributeName = other->attributeName->cloneAttributeName(interner);
+ nonInternedAttributeName->setNameForNonInterned(nsHtml5Portability::newLocalFromLocal(other->attributeName->getLocal(NS_HTML5ATTRIBUTE_NAME_HTML), interner));
+ attributeName = nonInternedAttributeName;
}
delete attributes;
if (!other->attributes) {
@@ -4089,6 +4085,7 @@ nsHtml5Tokenizer::~nsHtml5Tokenizer()
{
MOZ_COUNT_DTOR(nsHtml5Tokenizer);
delete nonInternedTagName;
+ delete nonInternedAttributeName;
nonInternedTagName = nullptr;
delete attributes;
attributes = nullptr;