Bug 1466449 - Update Tokenizer.java and StackNode.java to initialize properties. r=andi
--- a/parser/html/javasrc/StackNode.java
+++ b/parser/html/javasrc/StackNode.java
@@ -92,17 +92,24 @@ final class StackNode<T> {
public boolean isOptionalEndTag() {
return (flags & ElementName.OPTIONAL_END_TAG) != 0;
}
// ]NOCPP]
StackNode(int idxInTreeBuilder) {
this.idxInTreeBuilder = idxInTreeBuilder;
+ this.flags = 0;
+ this.name = null;
+ this.popName = null;
+ this.ns = 0;
+ this.node = null;
+ this.attributes = null;
this.refcount = 0;
+ this.htmlCreator = null;
}
// CPPONLY: public @HtmlCreator Object getHtmlCreator() {
// CPPONLY: return htmlCreator;
// CPPONLY: }
/**
* Setter for copying. This doesn't take another <code>StackNode</code>
--- a/parser/html/javasrc/Tokenizer.java
+++ b/parser/html/javasrc/Tokenizer.java
@@ -522,31 +522,56 @@ public class Tokenizer implements Locato
// [NOCPP[
protected LocatorImpl ampersandLocation;
public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
this.tokenHandler = tokenHandler;
this.encodingDeclarationHandler = null;
+ this.lastCR = false;
+ this.stateSave = 0;
+ this.returnStateSave = 0;
+ this.index = 0;
+ this.forceQuirks = false;
+ this.additional = '\u0000';
+ this.entCol = 0;
+ this.firstCharKey = 0;
+ this.lo = 0;
+ this.hi = 0;
+ this.candidate = 0;
+ this.charRefBufMark = 0;
+ this.value = 0;
+ this.seenDigits = false;
+ this.cstart = 0;
+ this.strBufLen = 0;
this.newAttributesEachTime = newAttributesEachTime;
// ∳ is the longest valid char ref and
// the semicolon never gets appended to the buffer.
this.charRefBuf = new char[32];
+ this.charRefBufLen = 0;
this.bmpChar = new char[1];
this.astralChar = new char[2];
+ this.endTagExpectation = null;
+ this.endTagExpectationAsArray = new char[0];
+ this.endTag = false;
this.containsHyphen = false;
this.tagName = null;
this.nonInternedTagName = new ElementName();
this.attributeName = null;
// CPPONLY: this.nonInternedAttributeName = new AttributeName();
this.doctypeName = null;
this.publicIdentifier = null;
this.systemIdentifier = null;
this.attributes = null;
+ this.shouldSuspend = false;
+ this.confident = false;
+ this.line = 0;
+ this.attributeLine = 0;
+ this.interner = null;
}
// ]NOCPP]
/**
* The constructor.
*
* @param tokenHandler
@@ -555,34 +580,59 @@ public class Tokenizer implements Locato
public Tokenizer(TokenHandler tokenHandler
// CPPONLY: , boolean viewingXmlSource
) {
this.tokenHandler = tokenHandler;
this.encodingDeclarationHandler = null;
// [NOCPP[
this.newAttributesEachTime = false;
// ]NOCPP]
+ this.lastCR = false;
+ this.stateSave = 0;
+ this.returnStateSave = 0;
+ this.index = 0;
+ this.forceQuirks = false;
+ this.additional = '\u0000';
+ this.entCol = 0;
+ this.firstCharKey = 0;
+ this.lo = 0;
+ this.hi = 0;
+ this.candidate = 0;
+ this.charRefBufMark = 0;
+ this.value = 0;
+ this.seenDigits = false;
+ this.cstart = 0;
+ this.strBufLen = 0;
// ∳ is the longest valid char ref and
// the semicolon never gets appended to the buffer.
this.charRefBuf = new char[32];
+ this.charRefBufLen = 0;
this.bmpChar = new char[1];
this.astralChar = new char[2];
+ this.endTagExpectation = null;
+ this.endTagExpectationAsArray = new char[0];
+ this.endTag = false;
this.containsHyphen = false;
this.tagName = null;
this.nonInternedTagName = new ElementName();
this.attributeName = null;
// CPPONLY: this.nonInternedAttributeName = new AttributeName();
this.doctypeName = null;
this.publicIdentifier = null;
this.systemIdentifier = null;
// [NOCPP[
this.attributes = null;
// ]NOCPP]
// CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null;
// CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder();
+ this.shouldSuspend = false;
+ this.confident = false;
+ this.line = 0;
+ this.attributeLine = 0;
+ this.interner = null;
// CPPONLY: this.viewingXmlSource = viewingXmlSource;
}
public void setInterner(Interner interner) {
this.interner = interner;
}
public void initLocation(String newPublicId, String newSystemId) {
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -126,33 +126,33 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtm
bool viewingXmlSource)
: tokenHandler(tokenHandler)
, encodingDeclarationHandler(nullptr)
, lastCR(false)
, stateSave(0)
, returnStateSave(0)
, index(0)
, forceQuirks(false)
- , additional(u'\0')
+ , additional('\0')
, entCol(0)
, firstCharKey(0)
, lo(0)
, hi(0)
, candidate(0)
, charRefBufMark(0)
, value(0)
, seenDigits(false)
, cstart(0)
, strBufLen(0)
, charRefBuf(jArray<char16_t, int32_t>::newJArray(32))
, charRefBufLen(0)
, bmpChar(jArray<char16_t, int32_t>::newJArray(1))
, astralChar(jArray<char16_t, int32_t>::newJArray(2))
, endTagExpectation(nullptr)
- , endTagExpectationAsArray{}
+ , endTagExpectationAsArray(jArray<char16_t, int32_t>::newJArray(0))
, endTag(false)
, containsHyphen(false)
, tagName(nullptr)
, nonInternedTagName(new nsHtml5ElementName())
, attributeName(nullptr)
, nonInternedAttributeName(new nsHtml5AttributeName())
, doctypeName(nullptr)
, publicIdentifier(nullptr)