Backed out changeset cb24d2d42554 (bug 1466449) for Tokenizer leaks a=backout
authorCiure Andrei <aciure@mozilla.com>
Tue, 23 Oct 2018 17:12:48 +0300
changeset 490864 d088f3b8a8058e34f43d9aae909c027b41dd2f11
parent 490863 0920d2b1122d3e364ab7a49be99788b9596e07b0
child 490865 fd8c2dda33fccca55c84453205efbca498b906cb
child 490868 38b95489a34aa885be28aa4b92781ecd763e8093
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersbackout
bugs1466449
milestone65.0a1
backs outcb24d2d42554fb0f0f01ee5de3187d19e9985de4
Backed out changeset cb24d2d42554 (bug 1466449) for Tokenizer leaks a=backout
parser/html/javasrc/StackNode.java
parser/html/javasrc/Tokenizer.java
parser/html/nsHtml5Tokenizer.cpp
--- a/parser/html/javasrc/StackNode.java
+++ b/parser/html/javasrc/StackNode.java
@@ -92,24 +92,17 @@ 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,56 +522,31 @@ 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;
         // &CounterClockwiseContourIntegral; 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
@@ -580,59 +555,34 @@ 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;
         // &CounterClockwiseContourIntegral; 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('\0')
+  , additional(u'\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(jArray<char16_t, int32_t>::newJArray(0))
+  , endTagExpectationAsArray{}
   , endTag(false)
   , containsHyphen(false)
   , tagName(nullptr)
   , nonInternedTagName(new nsHtml5ElementName())
   , attributeName(nullptr)
   , nonInternedAttributeName(new nsHtml5AttributeName())
   , doctypeName(nullptr)
   , publicIdentifier(nullptr)