Skip to content

Commit 59511bd

Browse files
author
Jonathan Kingston
committed
Bug 1466449 - Update Tokenizer.java and StackNode.java to initialize properties. r=hsivonen.
1 parent 15f9ede commit 59511bd

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

src/nu/validator/htmlparser/impl/StackNode.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,14 @@ public boolean isOptionalEndTag() {
9797

9898
StackNode(int idxInTreeBuilder) {
9999
this.idxInTreeBuilder = idxInTreeBuilder;
100+
this.flags = 0;
101+
this.name = null;
102+
this.popName = null;
103+
this.ns = 0;
104+
this.node = null;
105+
this.attributes = null;
100106
this.refcount = 0;
107+
this.htmlCreator = null;
101108
}
102109

103110
// CPPONLY: public @HtmlCreator Object getHtmlCreator() {

src/nu/validator/htmlparser/impl/Tokenizer.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,12 +527,32 @@ public class Tokenizer implements Locator {
527527
public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
528528
this.tokenHandler = tokenHandler;
529529
this.encodingDeclarationHandler = null;
530+
this.lastCR = false;
531+
this.stateSave = 0;
532+
this.returnStateSave = 0;
533+
this.index = 0;
534+
this.forceQuirks = false;
535+
this.additional = '\u0000';
536+
this.entCol = 0;
537+
this.firstCharKey = 0;
538+
this.lo = 0;
539+
this.hi = 0;
540+
this.candidate = 0;
541+
this.charRefBufMark = 0;
542+
this.value = 0;
543+
this.seenDigits = false;
544+
this.cstart = 0;
545+
this.strBufLen = 0;
530546
this.newAttributesEachTime = newAttributesEachTime;
531547
// &CounterClockwiseContourIntegral; is the longest valid char ref and
532548
// the semicolon never gets appended to the buffer.
533549
this.charRefBuf = new char[32];
550+
this.charRefBufLen = 0;
534551
this.bmpChar = new char[1];
535552
this.astralChar = new char[2];
553+
this.endTagExpectation = null;
554+
this.endTagExpectationAsArray = new char[0];
555+
this.endTag = false;
536556
this.containsHyphen = false;
537557
this.tagName = null;
538558
this.nonInternedTagName = new ElementName();
@@ -542,6 +562,11 @@ public Tokenizer(TokenHandler tokenHandler, boolean newAttributesEachTime) {
542562
this.publicIdentifier = null;
543563
this.systemIdentifier = null;
544564
this.attributes = null;
565+
this.shouldSuspend = false;
566+
this.confident = false;
567+
this.line = 0;
568+
this.attributeLine = 0;
569+
this.interner = null;
545570
}
546571

547572
// ]NOCPP]
@@ -560,11 +585,31 @@ public Tokenizer(TokenHandler tokenHandler
560585
// [NOCPP[
561586
this.newAttributesEachTime = false;
562587
// ]NOCPP]
588+
this.lastCR = false;
589+
this.stateSave = 0;
590+
this.returnStateSave = 0;
591+
this.index = 0;
592+
this.forceQuirks = false;
593+
this.additional = '\u0000';
594+
this.entCol = 0;
595+
this.firstCharKey = 0;
596+
this.lo = 0;
597+
this.hi = 0;
598+
this.candidate = 0;
599+
this.charRefBufMark = 0;
600+
this.value = 0;
601+
this.seenDigits = false;
602+
this.cstart = 0;
603+
this.strBufLen = 0;
563604
// &CounterClockwiseContourIntegral; is the longest valid char ref and
564605
// the semicolon never gets appended to the buffer.
565606
this.charRefBuf = new char[32];
607+
this.charRefBufLen = 0;
566608
this.bmpChar = new char[1];
567609
this.astralChar = new char[2];
610+
this.endTagExpectation = null;
611+
this.endTagExpectationAsArray = new char[0];
612+
this.endTag = false;
568613
this.containsHyphen = false;
569614
this.tagName = null;
570615
this.nonInternedTagName = new ElementName();
@@ -578,6 +623,11 @@ public Tokenizer(TokenHandler tokenHandler
578623
// ]NOCPP]
579624
// CPPONLY: this.attributes = tokenHandler.HasBuilder() ? new HtmlAttributes(mappingLangToXmlLang) : null;
580625
// CPPONLY: this.newAttributesEachTime = !tokenHandler.HasBuilder();
626+
this.shouldSuspend = false;
627+
this.confident = false;
628+
this.line = 0;
629+
this.attributeLine = 0;
630+
this.interner = null;
581631
// CPPONLY: this.viewingXmlSource = viewingXmlSource;
582632
}
583633

0 commit comments

Comments
 (0)