Bug 1506133 - More HTML parser cleanup post bug 1392185. r=hsivonen
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 12 Nov 2018 14:37:09 +0000
changeset 445888 577c34da7b73f1d33026ff0c768ace3e893c34b8
parent 445887 b05772bcb6f4e6e7e83cb7e05d12d160f82f65b5
child 445889 039f38a78b19baa65c162531976c67b42c98fcde
push id35028
push usercsabou@mozilla.com
push dateMon, 12 Nov 2018 21:54:15 +0000
treeherdermozilla-central@05331fb8f533 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1506133, 1392185
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1506133 - More HTML parser cleanup post bug 1392185. r=hsivonen Differential Revision: https://phabricator.services.mozilla.com/D11480
parser/html/javasrc/Portability.java
parser/html/javasrc/Tokenizer.java
parser/html/javasrc/TreeBuilder.java
parser/html/nsHtml5AttributeEntry.h
parser/html/nsHtml5AttributeName.h
parser/html/nsHtml5HtmlAttributes.cpp
parser/html/nsHtml5HtmlAttributes.h
parser/html/nsHtml5Parser.cpp
parser/html/nsHtml5Portability.cpp
parser/html/nsHtml5Portability.h
parser/html/nsHtml5StreamParser.cpp
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.cpp
parser/html/nsHtml5TreeBuilder.h
--- a/parser/html/javasrc/Portability.java
+++ b/parser/html/javasrc/Portability.java
@@ -61,20 +61,16 @@ public final class Portability {
     public static char[] newCharArrayFromLocal(@Local String local) {
         return local.toCharArray();
     }
 
     public static char[] newCharArrayFromString(String string) {
         return string.toCharArray();
     }
 
-    public static @Local String newLocalFromLocal(@Local String local, Interner interner) {
-        return local;
-    }
-
     // Deallocation methods
 
     public static void releaseString(String str) {
         // No-op in Java
     }
 
     // Comparison methods
 
--- a/parser/html/javasrc/Tokenizer.java
+++ b/parser/html/javasrc/Tokenizer.java
@@ -6854,23 +6854,17 @@ public class Tokenizer implements Locato
         lo = other.lo;
         hi = other.hi;
         candidate = other.candidate;
         charRefBufMark = other.charRefBufMark;
         value = other.value;
         seenDigits = other.seenDigits;
         endTag = other.endTag;
         shouldSuspend = false;
-
-        if (other.doctypeName == null) {
-            doctypeName = null;
-        } else {
-            doctypeName = Portability.newLocalFromLocal(other.doctypeName,
-                    interner);
-        }
+        doctypeName = other.doctypeName;
 
         Portability.releaseString(systemIdentifier);
         if (other.systemIdentifier == null) {
             systemIdentifier = null;
         } else {
             systemIdentifier = Portability.newStringFromString(other.systemIdentifier);
         }
 
@@ -6885,42 +6879,42 @@ public class Tokenizer implements Locato
         if (other.tagName == null) {
             tagName = null;
         } else if (other.tagName.isInterned()) {
             tagName = other.tagName;
         } else {
             // In the C++ case, the atoms in the other tokenizer are from a
             // different tokenizer-scoped atom table. Therefore, we have to
             // obtain the correspoding atom from our own atom table.
-            nonInternedTagName.setNameForNonInterned(Portability.newLocalFromLocal(other.tagName.getName(), interner)
+            nonInternedTagName.setNameForNonInterned(other.tagName.getName()
                     // CPPONLY: , other.tagName.isCustom()
                     );
             tagName = nonInternedTagName;
         }
 
         // [NOCPP[
         attributeName = other.attributeName;
         // ]NOCPP]
         // CPPONLY: if (other.attributeName == null) {
         // CPPONLY:     attributeName = null;
         // CPPONLY: } else if (other.attributeName.isInterned()) {
         // CPPONLY:     attributeName = other.attributeName;
         // CPPONLY: } else {
         // CPPONLY:     // In the C++ case, the atoms in the other tokenizer are from a
         // CPPONLY:     // different tokenizer-scoped atom table. Therefore, we have to
         // CPPONLY:     // obtain the correspoding atom from our own atom table.
-        // CPPONLY:     nonInternedAttributeName.setNameForNonInterned(Portability.newLocalFromLocal(other.attributeName.getLocal(AttributeName.HTML), interner));
+        // CPPONLY:     nonInternedAttributeName.setNameForNonInterned(other.attributeName.getLocal(AttributeName.HTML));
         // CPPONLY:     attributeName = nonInternedAttributeName;
         // CPPONLY: }
 
         Portability.delete(attributes);
         if (other.attributes == null) {
             attributes = null;
         } else {
-            attributes = other.attributes.cloneAttributes(interner);
+            attributes = other.attributes.cloneAttributes();
         }
     }
 
     public void initializeWithoutStarting() throws SAXException {
         confident = false;
         strBuf = null;
         line = 1;
         // CPPONLY: attributeLine = 1;
@@ -7146,18 +7140,19 @@ public class Tokenizer implements Locato
      */
     public void setEncodingDeclarationHandler(
             EncodingDeclarationHandler encodingDeclarationHandler) {
         this.encodingDeclarationHandler = encodingDeclarationHandler;
     }
 
     void destructor() {
         Portability.delete(nonInternedTagName);
+        nonInternedTagName = null;
         // CPPONLY: Portability.delete(nonInternedAttributeName);
-        nonInternedTagName = null;
+        // CPPONLY: nonInternedAttributeName = null;
         // The translator will write refcount tracing stuff here
         Portability.delete(attributes);
         attributes = null;
     }
 
     // [NOCPP[
 
     /**
--- a/parser/html/javasrc/TreeBuilder.java
+++ b/parser/html/javasrc/TreeBuilder.java
@@ -4781,17 +4781,17 @@ public abstract class TreeBuilder<T> imp
                 // now node is both on stack and in the list
                 if (nodePos == furthestBlockPos) {
                     bookmark = nodeListPos + 1;
                 }
                 // if (hasChildren(node.node)) { XXX AAA CHANGE
                 assert node == listOfActiveFormattingElements[nodeListPos];
                 assert node == stack[nodePos];
                 T clone = createElement("http://www.w3.org/1999/xhtml",
-                        node.name, node.attributes.cloneAttributes(null), commonAncestor.node
+                        node.name, node.attributes.cloneAttributes(), commonAncestor.node
                         // CPPONLY: , htmlCreator(node.getHtmlCreator())
                         );
                 StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
                         node.name, clone, node.popName, node.attributes
                         // CPPONLY: , node.getHtmlCreator()
                         // [NOCPP[
                         , node.getLocator()
                         // ]NOCPP]
@@ -4813,17 +4813,17 @@ public abstract class TreeBuilder<T> imp
                 detachFromParent(lastNode.node);
                 insertIntoFosterParent(lastNode.node);
             } else {
                 detachFromParent(lastNode.node);
                 appendElement(lastNode.node, commonAncestor.node);
             }
             T clone = createElement("http://www.w3.org/1999/xhtml",
                     formattingElt.name,
-                    formattingElt.attributes.cloneAttributes(null), furthestBlock.node
+                    formattingElt.attributes.cloneAttributes(), furthestBlock.node
                     // CPPONLY: , htmlCreator(formattingElt.getHtmlCreator())
                     );
             StackNode<T> formattingClone = createStackNode(
                     formattingElt.getFlags(), formattingElt.ns,
                     formattingElt.name, clone, formattingElt.popName,
                     formattingElt.attributes
                     // CPPONLY: , formattingElt.getHtmlCreator()
                     // [NOCPP[
@@ -5000,22 +5000,22 @@ public abstract class TreeBuilder<T> imp
         while (entryPos < listPtr) {
             entryPos++;
             StackNode<T> entry = listOfActiveFormattingElements[entryPos];
             StackNode<T> currentNode = stack[currentPtr];
 
             T clone;
             if (currentNode.isFosterParenting()) {
                 clone = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", entry.name,
-                        entry.attributes.cloneAttributes(null)
+                        entry.attributes.cloneAttributes()
                         // CPPONLY: , htmlCreator(entry.getHtmlCreator())
                         );
             } else {
                 clone = createElement("http://www.w3.org/1999/xhtml", entry.name,
-                        entry.attributes.cloneAttributes(null), currentNode.node
+                        entry.attributes.cloneAttributes(), currentNode.node
                         // CPPONLY: , htmlCreator(entry.getHtmlCreator())
                         );
                 appendElement(clone, currentNode.node);
             }
 
             StackNode<T> entryClone = createStackNode(entry.getFlags(),
                     entry.ns, entry.name, clone, entry.popName,
                     entry.attributes
@@ -5419,17 +5419,17 @@ public abstract class TreeBuilder<T> imp
 
     private void appendToCurrentNodeAndPushFormattingElementMayFoster(
             ElementName elementName, HtmlAttributes attributes)
             throws SAXException {
         // [NOCPP[
         checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
         // ]NOCPP]
         // This method can't be called for custom elements
-        HtmlAttributes clone = attributes.cloneAttributes(null);
+        HtmlAttributes clone = attributes.cloneAttributes();
         // Attributes must not be read after calling createElement, because
         // createElement may delete attributes in C++.
         T elt;
         StackNode<T> current = stack[currentPtr];
         if (current.isFosterParenting()) {
             fatal();
             elt = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", elementName.getName(), attributes
                     // CPPONLY: , htmlCreator(elementName.getHtmlCreator())
@@ -6125,17 +6125,17 @@ public abstract class TreeBuilder<T> imp
             throws SAXException {
         StackNode<T>[] listCopy = new StackNode[listPtr + 1];
         for (int i = 0; i < listCopy.length; i++) {
             StackNode<T> node = listOfActiveFormattingElements[i];
             if (node != null) {
                 StackNode<T> newNode = new StackNode<T>(-1);
                 newNode.setValues(node.getFlags(), node.ns,
                         node.name, node.node, node.popName,
-                        node.attributes.cloneAttributes(null)
+                        node.attributes.cloneAttributes()
                         // CPPONLY: , node.getHtmlCreator()
                         // [NOCPP[
                         , node.getLocator()
                         // ]NOCPP]
                 );
                 listCopy[i] = newNode;
             } else {
                 listCopy[i] = null;
@@ -6212,17 +6212,17 @@ public abstract class TreeBuilder<T> imp
             if (templateModeStackCopy[i] != templateModeStack[i]) {
                 return false;
             }
         }
         return true;
     }
 
     @SuppressWarnings("unchecked") public void loadState(
-            TreeBuilderState<T> snapshot, Interner interner)
+            TreeBuilderState<T> snapshot)
             throws SAXException {
         // CPPONLY: mCurrentHtmlScriptIsAsyncOrDefer = false;
         StackNode<T>[] stackCopy = snapshot.getStack();
         int stackLen = snapshot.getStackLength();
         StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();
         int listLen = snapshot.getListOfActiveFormattingElementsLength();
         int[] templateModeStackCopy = snapshot.getTemplateModeStack();
         int templateModeStackLen = snapshot.getTemplateModeStackLength();
@@ -6249,36 +6249,36 @@ public abstract class TreeBuilder<T> imp
             templateModeStack = new int[templateModeStackLen];
         }
         templateModePtr = templateModeStackLen - 1;
 
         for (int i = 0; i < listLen; i++) {
             StackNode<T> node = listCopy[i];
             if (node != null) {
                 StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
-                        Portability.newLocalFromLocal(node.name, interner), node.node,
-                        Portability.newLocalFromLocal(node.popName, interner),
-                        node.attributes.cloneAttributes(null)
+                        node.name, node.node,
+                        node.popName,
+                        node.attributes.cloneAttributes()
                         // CPPONLY: , node.getHtmlCreator()
                         // [NOCPP[
                         , node.getLocator()
                 // ]NOCPP]
                 );
                 listOfActiveFormattingElements[i] = newNode;
             } else {
                 listOfActiveFormattingElements[i] = null;
             }
         }
         for (int i = 0; i < stackLen; i++) {
             StackNode<T> node = stackCopy[i];
             int listIndex = findInArray(node, listCopy);
             if (listIndex == -1) {
                 StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
-                        Portability.newLocalFromLocal(node.name, interner), node.node,
-                        Portability.newLocalFromLocal(node.popName, interner),
+                        node.name, node.node,
+                        node.popName,
                         null
                         // CPPONLY: , node.getHtmlCreator()
                         // [NOCPP[
                         , node.getLocator()
                 // ]NOCPP]
                 );
                 stack[i] = newNode;
             } else {
--- a/parser/html/nsHtml5AttributeEntry.h
+++ b/parser/html/nsHtml5AttributeEntry.h
@@ -52,36 +52,22 @@ public:
   inline int32_t GetUri(int32_t aMode) { return mUris[aMode]; }
 
   inline nsHtml5String GetValue() { return mValue; }
 
   inline int32_t GetLine() { return mLine; }
 
   inline void ReleaseValue() { mValue.Release(); }
 
-  inline nsHtml5AttributeEntry Clone(nsHtml5AtomTable* aInterner)
+  inline nsHtml5AttributeEntry Clone()
   {
     // Copy the memory
     nsHtml5AttributeEntry clone(*this);
     // Increment refcount for value
     clone.mValue = this->mValue.Clone();
-    if (aInterner) {
-      // Now if we have an interner, we'll need to rewrite non-static atoms.
-      // Only the local names may be non-static, in which case all three
-      // are the same.
-      nsAtom* local = GetLocal(0);
-      if (!local->IsStatic()) {
-        nsAutoString str;
-        local->ToString(str);
-        nsAtom* local = aInterner->GetAtom(str);
-        clone.mLocals[0] = local;
-        clone.mLocals[1] = local;
-        clone.mLocals[2] = local;
-      }
-    }
     return clone;
   }
 
 private:
   RefPtr<nsAtom> mLocals[3];
   RefPtr<nsAtom> mPrefixes[3];
   int32_t mUris[3];
   int32_t mLine;
--- a/parser/html/nsHtml5AttributeName.h
+++ b/parser/html/nsHtml5AttributeName.h
@@ -59,25 +59,23 @@ class nsHtml5AttributeName
 public:
   static int32_t* ALL_NO_NS;
 private:
   static int32_t* XMLNS_NS;
   static int32_t* XML_NS;
   static int32_t* XLINK_NS;
 public:
   static nsStaticAtom** ALL_NO_PREFIX;
-
 private:
   static nsStaticAtom** XMLNS_PREFIX;
   static nsStaticAtom** XLINK_PREFIX;
   static nsStaticAtom** XML_PREFIX;
   static RefPtr<nsAtom>* SVG_DIFFERENT(nsAtom* name, nsAtom* camel);
   static RefPtr<nsAtom>* MATH_DIFFERENT(nsAtom* name, nsAtom* camel);
   static RefPtr<nsAtom>* COLONIFIED_LOCAL(nsAtom* name, nsAtom* suffix);
-
 public:
   static RefPtr<nsAtom>* SAME_LOCAL(nsAtom* name);
   inline static int32_t levelOrderBinarySearch(jArray<int32_t, int32_t> data,
                                                int32_t key)
   {
     int32_t n = data.length;
     int32_t i = 0;
     while (i < n) {
--- a/parser/html/nsHtml5HtmlAttributes.cpp
+++ b/parser/html/nsHtml5HtmlAttributes.cpp
@@ -195,23 +195,23 @@ nsHtml5HtmlAttributes::adjustForMath()
 
 void
 nsHtml5HtmlAttributes::adjustForSvg()
 {
   mMode = nsHtml5AttributeName::SVG;
 }
 
 nsHtml5HtmlAttributes*
-nsHtml5HtmlAttributes::cloneAttributes(nsHtml5AtomTable* aInterner)
+nsHtml5HtmlAttributes::cloneAttributes()
 {
   MOZ_ASSERT(mStorage.IsEmpty() || !mMode);
   nsHtml5HtmlAttributes* clone =
     new nsHtml5HtmlAttributes(nsHtml5AttributeName::HTML);
   for (nsHtml5AttributeEntry& entry : mStorage) {
-    clone->AddEntry(entry.Clone(aInterner));
+    clone->AddEntry(entry.Clone());
   }
   return clone;
 }
 
 bool
 nsHtml5HtmlAttributes::equalsAnother(nsHtml5HtmlAttributes* aOther)
 {
   MOZ_ASSERT(!mMode, "Trying to compare attributes in foreign content.");
--- a/parser/html/nsHtml5HtmlAttributes.h
+++ b/parser/html/nsHtml5HtmlAttributes.h
@@ -82,15 +82,15 @@ public:
                              nsHtml5String aValue,
                              int32_t aLine);
   void clear(int32_t aMode);
   void releaseValue(int32_t aIndex);
   void clearWithoutReleasingContents();
   bool contains(nsHtml5AttributeName* aName);
   void adjustForMath();
   void adjustForSvg();
-  nsHtml5HtmlAttributes* cloneAttributes(nsHtml5AtomTable* aInterner);
+  nsHtml5HtmlAttributes* cloneAttributes();
   bool equalsAnother(nsHtml5HtmlAttributes* aOther);
   static void initializeStatics();
   static void releaseStatics();
 };
 
 #endif
--- a/parser/html/nsHtml5Parser.cpp
+++ b/parser/html/nsHtml5Parser.cpp
@@ -473,17 +473,17 @@ nsHtml5Parser::Parse(const nsAString& aS
         mDocWriteSpeculativeTreeBuilder->setScriptingEnabled(
           mTreeBuilder->isScriptingEnabled());
         mDocWriteSpeculativeTokenizer =
           new nsHtml5Tokenizer(mDocWriteSpeculativeTreeBuilder, false);
         mDocWriteSpeculativeTokenizer->setInterner(&mAtomTable);
         mDocWriteSpeculativeTokenizer->start();
       }
       mDocWriteSpeculativeTokenizer->resetToDataState();
-      mDocWriteSpeculativeTreeBuilder->loadState(mTreeBuilder, &mAtomTable);
+      mDocWriteSpeculativeTreeBuilder->loadState(mTreeBuilder);
       mDocWriteSpeculativeLastWasCR = false;
     }
 
     // Note that with multilevel document.write if we didn't just activate the
     // speculator, it's possible that the speculator is now in the wrong state.
     // That's OK for the sake of simplicity. The worst that can happen is
     // that the speculative loads aren't exactly right. The content will be
     // reparsed anyway for non-preload purposes.
@@ -747,17 +747,17 @@ nsHtml5Parser::StartTokenizer(bool aScri
 }
 
 void
 nsHtml5Parser::InitializeDocWriteParserState(nsAHtml5TreeBuilderState* aState,
                                              int32_t aLine)
 {
   mTokenizer->resetToDataState();
   mTokenizer->setLineNumber(aLine);
-  mTreeBuilder->loadState(aState, &mAtomTable);
+  mTreeBuilder->loadState(aState);
   mLastWasCR = false;
   mReturnToStreamParserPermitted = true;
 }
 
 void
 nsHtml5Parser::ContinueAfterFailedCharsetSwitch()
 {
   MOZ_ASSERT(
--- a/parser/html/nsHtml5Portability.cpp
+++ b/parser/html/nsHtml5Portability.cpp
@@ -12,24 +12,16 @@ nsAtom*
 nsHtml5Portability::newLocalNameFromBuffer(char16_t* buf,
                                            int32_t length,
                                            nsHtml5AtomTable* interner)
 {
   NS_ASSERTION(interner, "Didn't get an atom service.");
   return interner->GetAtom(nsDependentSubstring(buf, buf + length));
 }
 
-nsAtom*
-nsHtml5Portability::newLocalFromLocal(nsAtom* local,
-                                      nsHtml5AtomTable* interner)
-{
-  // FIXME(emilio): This function should be removed.
-  return local;
-}
-
 static bool
 ContainsWhiteSpace(mozilla::Span<char16_t> aSpan)
 {
   for (char16_t c : aSpan) {
     if (nsContentUtils::IsHTMLWhitespace(c)) {
       return true;
     }
   }
--- a/parser/html/nsHtml5Portability.h
+++ b/parser/html/nsHtml5Portability.h
@@ -64,17 +64,16 @@ public:
                                            int32_t length,
                                            nsHtml5TreeBuilder* treeBuilder,
                                            bool maybeAtomize);
   static nsHtml5String newEmptyString();
   static nsHtml5String newStringFromLiteral(const char* literal);
   static nsHtml5String newStringFromString(nsHtml5String string);
   static jArray<char16_t, int32_t> newCharArrayFromLocal(nsAtom* local);
   static jArray<char16_t, int32_t> newCharArrayFromString(nsHtml5String string);
-  static nsAtom* newLocalFromLocal(nsAtom* local, nsHtml5AtomTable* interner);
   static bool localEqualsBuffer(nsAtom* local, char16_t* buf, int32_t length);
   static bool lowerCaseLiteralIsPrefixOfIgnoreAsciiCaseString(
     const char* lowerCaseLiteral,
     nsHtml5String string);
   static bool lowerCaseLiteralEqualsIgnoreAsciiCaseString(
     const char* lowerCaseLiteral,
     nsHtml5String string);
   static bool literalEqualsString(const char* literal, nsHtml5String string);
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -1680,17 +1680,17 @@ nsHtml5StreamParser::ContinueAfterScript
 
       mTreeBuilder->SetOpSink(mExecutor->GetStage());
       mExecutor->StartReadingFromStage();
       mSpeculating = false;
 
       // Copy state over
       mLastWasCR = aLastWasCR;
       mTokenizer->loadState(aTokenizer);
-      mTreeBuilder->loadState(aTreeBuilder, &mAtomTable);
+      mTreeBuilder->loadState(aTreeBuilder);
     } else {
       // We've got a successful speculation and at least a moment ago it was
       // the current speculation
       mSpeculations.ElementAt(0)->FlushToSink(mExecutor);
       NS_ASSERTION(!mExecutor->IsScriptExecuting(),
                    "ParseUntilBlocked() was supposed to ensure we don't come "
                    "here when scripts are executing.");
       NS_ASSERTION(
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -4788,22 +4788,17 @@ nsHtml5Tokenizer::loadState(nsHtml5Token
   lo = other->lo;
   hi = other->hi;
   candidate = other->candidate;
   charRefBufMark = other->charRefBufMark;
   value = other->value;
   seenDigits = other->seenDigits;
   endTag = other->endTag;
   shouldSuspend = false;
-  if (!other->doctypeName) {
-    doctypeName = nullptr;
-  } else {
-    doctypeName =
-      nsHtml5Portability::newLocalFromLocal(other->doctypeName, interner);
-  }
+  doctypeName = other->doctypeName;
   systemIdentifier.Release();
   if (!other->systemIdentifier) {
     systemIdentifier = nullptr;
   } else {
     systemIdentifier =
       nsHtml5Portability::newStringFromString(other->systemIdentifier);
   }
   publicIdentifier.Release();
@@ -4814,37 +4809,34 @@ nsHtml5Tokenizer::loadState(nsHtml5Token
       nsHtml5Portability::newStringFromString(other->publicIdentifier);
   }
   containsHyphen = other->containsHyphen;
   if (!other->tagName) {
     tagName = nullptr;
   } else if (other->tagName->isInterned()) {
     tagName = other->tagName;
   } else {
-    nonInternedTagName->setNameForNonInterned(
-      nsHtml5Portability::newLocalFromLocal(other->tagName->getName(),
-                                            interner),
-      other->tagName->isCustom());
+    nonInternedTagName->setNameForNonInterned(other->tagName->getName(),
+                                              other->tagName->isCustom());
     tagName = nonInternedTagName;
   }
   if (!other->attributeName) {
     attributeName = nullptr;
   } else if (other->attributeName->isInterned()) {
     attributeName = other->attributeName;
   } else {
     nonInternedAttributeName->setNameForNonInterned(
-      nsHtml5Portability::newLocalFromLocal(
-        other->attributeName->getLocal(nsHtml5AttributeName::HTML), interner));
+      other->attributeName->getLocal(nsHtml5AttributeName::HTML));
     attributeName = nonInternedAttributeName;
   }
   delete attributes;
   if (!other->attributes) {
     attributes = nullptr;
   } else {
-    attributes = other->attributes->cloneAttributes(interner);
+    attributes = other->attributes->cloneAttributes();
   }
 }
 
 void
 nsHtml5Tokenizer::initializeWithoutStarting()
 {
   confident = false;
   strBuf = nullptr;
@@ -4859,18 +4851,19 @@ nsHtml5Tokenizer::setEncodingDeclaration
 {
   this->encodingDeclarationHandler = encodingDeclarationHandler;
 }
 
 nsHtml5Tokenizer::~nsHtml5Tokenizer()
 {
   MOZ_COUNT_DTOR(nsHtml5Tokenizer);
   delete nonInternedTagName;
+  nonInternedTagName = nullptr;
   delete nonInternedAttributeName;
-  nonInternedTagName = nullptr;
+  nonInternedAttributeName = nullptr;
   delete attributes;
   attributes = nullptr;
 }
 
 void
 nsHtml5Tokenizer::initializeStatics()
 {
 }
--- a/parser/html/nsHtml5TreeBuilder.cpp
+++ b/parser/html/nsHtml5TreeBuilder.cpp
@@ -3878,17 +3878,17 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag
       if (nodePos == furthestBlockPos) {
         bookmark = nodeListPos + 1;
       }
       MOZ_ASSERT(node == listOfActiveFormattingElements[nodeListPos]);
       MOZ_ASSERT(node == stack[nodePos]);
       nsIContentHandle* clone =
         createElement(kNameSpaceID_XHTML,
                       node->name,
-                      node->attributes->cloneAttributes(nullptr),
+                      node->attributes->cloneAttributes(),
                       commonAncestor->node,
                       htmlCreator(node->getHtmlCreator()));
       nsHtml5StackNode* newNode = createStackNode(node->getFlags(),
                                                   node->ns,
                                                   node->name,
                                                   clone,
                                                   node->popName,
                                                   node->attributes,
@@ -3910,17 +3910,17 @@ nsHtml5TreeBuilder::adoptionAgencyEndTag
       insertIntoFosterParent(lastNode->node);
     } else {
       detachFromParent(lastNode->node);
       appendElement(lastNode->node, commonAncestor->node);
     }
     nsIContentHandle* clone =
       createElement(kNameSpaceID_XHTML,
                     formattingElt->name,
-                    formattingElt->attributes->cloneAttributes(nullptr),
+                    formattingElt->attributes->cloneAttributes(),
                     furthestBlock->node,
                     htmlCreator(formattingElt->getHtmlCreator()));
     nsHtml5StackNode* formattingClone =
       createStackNode(formattingElt->getFlags(),
                       formattingElt->ns,
                       formattingElt->name,
                       clone,
                       formattingElt->popName,
@@ -4096,22 +4096,22 @@ nsHtml5TreeBuilder::reconstructTheActive
     entryPos++;
     nsHtml5StackNode* entry = listOfActiveFormattingElements[entryPos];
     nsHtml5StackNode* currentNode = stack[currentPtr];
     nsIContentHandle* clone;
     if (currentNode->isFosterParenting()) {
       clone = createAndInsertFosterParentedElement(
         kNameSpaceID_XHTML,
         entry->name,
-        entry->attributes->cloneAttributes(nullptr),
+        entry->attributes->cloneAttributes(),
         htmlCreator(entry->getHtmlCreator()));
     } else {
       clone = createElement(kNameSpaceID_XHTML,
                             entry->name,
-                            entry->attributes->cloneAttributes(nullptr),
+                            entry->attributes->cloneAttributes(),
                             currentNode->node,
                             htmlCreator(entry->getHtmlCreator()));
       appendElement(clone, currentNode->node);
     }
     nsHtml5StackNode* entryClone = createStackNode(entry->getFlags(),
                                                    entry->ns,
                                                    entry->name,
                                                    clone,
@@ -4386,17 +4386,17 @@ nsHtml5TreeBuilder::appendToCurrentNodeA
   push(node);
 }
 
 void
 nsHtml5TreeBuilder::appendToCurrentNodeAndPushFormattingElementMayFoster(
   nsHtml5ElementName* elementName,
   nsHtml5HtmlAttributes* attributes)
 {
-  nsHtml5HtmlAttributes* clone = attributes->cloneAttributes(nullptr);
+  nsHtml5HtmlAttributes* clone = attributes->cloneAttributes();
   nsIContentHandle* elt;
   nsHtml5StackNode* current = stack[currentPtr];
   if (current->isFosterParenting()) {
 
     elt = createAndInsertFosterParentedElement(
       kNameSpaceID_XHTML,
       elementName->getName(),
       attributes,
@@ -4830,17 +4830,17 @@ nsHtml5TreeBuilder::newSnapshot()
     nsHtml5StackNode* node = listOfActiveFormattingElements[i];
     if (node) {
       nsHtml5StackNode* newNode = new nsHtml5StackNode(-1);
       newNode->setValues(node->getFlags(),
                          node->ns,
                          node->name,
                          node->node,
                          node->popName,
-                         node->attributes->cloneAttributes(nullptr),
+                         node->attributes->cloneAttributes(),
                          node->getHtmlCreator());
       listCopy[i] = newNode;
     } else {
       listCopy[i] = nullptr;
     }
   }
   jArray<nsHtml5StackNode*, int32_t> stackCopy =
     jArray<nsHtml5StackNode*, int32_t>::newJArray(currentPtr + 1);
@@ -4921,18 +4921,17 @@ nsHtml5TreeBuilder::snapshotMatches(nsAH
     if (templateModeStackCopy[i] != templateModeStack[i]) {
       return false;
     }
   }
   return true;
 }
 
 void
-nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot,
-                              nsHtml5AtomTable* interner)
+nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot)
 {
   mCurrentHtmlScriptIsAsyncOrDefer = false;
   jArray<nsHtml5StackNode*, int32_t> stackCopy = snapshot->getStack();
   int32_t stackLen = snapshot->getStackLength();
   jArray<nsHtml5StackNode*, int32_t> listCopy =
     snapshot->getListOfActiveFormattingElements();
   int32_t listLen = snapshot->getListOfActiveFormattingElementsLength();
   jArray<int32_t, int32_t> templateModeStackCopy =
@@ -4958,41 +4957,40 @@ nsHtml5TreeBuilder::loadState(nsAHtml5Tr
   if (templateModeStack.length < templateModeStackLen) {
     templateModeStack =
       jArray<int32_t, int32_t>::newJArray(templateModeStackLen);
   }
   templateModePtr = templateModeStackLen - 1;
   for (int32_t i = 0; i < listLen; i++) {
     nsHtml5StackNode* node = listCopy[i];
     if (node) {
-      nsHtml5StackNode* newNode = createStackNode(
-        node->getFlags(),
-        node->ns,
-        nsHtml5Portability::newLocalFromLocal(node->name, interner),
-        node->node,
-        nsHtml5Portability::newLocalFromLocal(node->popName, interner),
-        node->attributes->cloneAttributes(nullptr),
-        node->getHtmlCreator());
+      nsHtml5StackNode* newNode =
+        createStackNode(node->getFlags(),
+                        node->ns,
+                        node->name,
+                        node->node,
+                        node->popName,
+                        node->attributes->cloneAttributes(),
+                        node->getHtmlCreator());
       listOfActiveFormattingElements[i] = newNode;
     } else {
       listOfActiveFormattingElements[i] = nullptr;
     }
   }
   for (int32_t i = 0; i < stackLen; i++) {
     nsHtml5StackNode* node = stackCopy[i];
     int32_t listIndex = findInArray(node, listCopy);
     if (listIndex == -1) {
-      nsHtml5StackNode* newNode = createStackNode(
-        node->getFlags(),
-        node->ns,
-        nsHtml5Portability::newLocalFromLocal(node->name, interner),
-        node->node,
-        nsHtml5Portability::newLocalFromLocal(node->popName, interner),
-        nullptr,
-        node->getHtmlCreator());
+      nsHtml5StackNode* newNode = createStackNode(node->getFlags(),
+                                                  node->ns,
+                                                  node->name,
+                                                  node->node,
+                                                  node->popName,
+                                                  nullptr,
+                                                  node->getHtmlCreator());
       stack[i] = newNode;
     } else {
       stack[i] = listOfActiveFormattingElements[listIndex];
       stack[i]->retain();
     }
   }
   nsHtml5ArrayCopy::arraycopy(
     templateModeStackCopy, templateModeStack, templateModeStackLen);
--- a/parser/html/nsHtml5TreeBuilder.h
+++ b/parser/html/nsHtml5TreeBuilder.h
@@ -587,19 +587,17 @@ public:
   void setScriptingEnabled(bool scriptingEnabled);
   void setIsSrcdocDocument(bool isSrcdocDocument);
   void flushCharacters();
 private:
   bool charBufferContainsNonWhitespace();
 public:
   nsAHtml5TreeBuilderState* newSnapshot();
   bool snapshotMatches(nsAHtml5TreeBuilderState* snapshot);
-  void loadState(nsAHtml5TreeBuilderState* snapshot,
-                 nsHtml5AtomTable* interner);
-
+  void loadState(nsAHtml5TreeBuilderState* snapshot);
 private:
   int32_t findInArray(nsHtml5StackNode* node,
                       jArray<nsHtml5StackNode*, int32_t> arr);
 
 public:
   nsIContentHandle* getFormPointer() override;
   nsIContentHandle* getHeadPointer() override;
   nsIContentHandle* getDeepTreeSurrogateParent() override;