Skip to content

Commit 24571ca

Browse files
emiliohsivonen
authored andcommitted
Mozilla bug 1506133 - Remove Portability.newLocalFromLocal, and interner argument from cloneAttributes. r=hsivonen.
1 parent 0469088 commit 24571ca

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,7 @@ public void adjustForSvg() {
435435
mode = AttributeName.SVG;
436436
}
437437

438-
public HtmlAttributes cloneAttributes(Interner interner)
439-
throws SAXException {
438+
public HtmlAttributes cloneAttributes() throws SAXException {
440439
assert (length == 0
441440
&& xmlnsLength == 0
442441
)

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ public static char[] newCharArrayFromString(String string) {
6666
return string.toCharArray();
6767
}
6868

69-
public static @Local String newLocalFromLocal(@Local String local, Interner interner) {
70-
return local;
71-
}
72-
7369
// Deallocation methods
7470

7571
public static void releaseString(String str) {

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6859,13 +6859,7 @@ public void loadState(Tokenizer other) throws SAXException {
68596859
seenDigits = other.seenDigits;
68606860
endTag = other.endTag;
68616861
shouldSuspend = false;
6862-
6863-
if (other.doctypeName == null) {
6864-
doctypeName = null;
6865-
} else {
6866-
doctypeName = Portability.newLocalFromLocal(other.doctypeName,
6867-
interner);
6868-
}
6862+
doctypeName = other.doctypeName;
68696863

68706864
Portability.releaseString(systemIdentifier);
68716865
if (other.systemIdentifier == null) {
@@ -6890,7 +6884,7 @@ public void loadState(Tokenizer other) throws SAXException {
68906884
// In the C++ case, the atoms in the other tokenizer are from a
68916885
// different tokenizer-scoped atom table. Therefore, we have to
68926886
// obtain the correspoding atom from our own atom table.
6893-
nonInternedTagName.setNameForNonInterned(Portability.newLocalFromLocal(other.tagName.getName(), interner)
6887+
nonInternedTagName.setNameForNonInterned(other.tagName.getName()
68946888
// CPPONLY: , other.tagName.isCustom()
68956889
);
68966890
tagName = nonInternedTagName;
@@ -6907,15 +6901,15 @@ public void loadState(Tokenizer other) throws SAXException {
69076901
// CPPONLY: // In the C++ case, the atoms in the other tokenizer are from a
69086902
// CPPONLY: // different tokenizer-scoped atom table. Therefore, we have to
69096903
// CPPONLY: // obtain the correspoding atom from our own atom table.
6910-
// CPPONLY: nonInternedAttributeName.setNameForNonInterned(Portability.newLocalFromLocal(other.attributeName.getLocal(AttributeName.HTML), interner));
6904+
// CPPONLY: nonInternedAttributeName.setNameForNonInterned(other.attributeName.getLocal(AttributeName.HTML));
69116905
// CPPONLY: attributeName = nonInternedAttributeName;
69126906
// CPPONLY: }
69136907

69146908
Portability.delete(attributes);
69156909
if (other.attributes == null) {
69166910
attributes = null;
69176911
} else {
6918-
attributes = other.attributes.cloneAttributes(interner);
6912+
attributes = other.attributes.cloneAttributes();
69196913
}
69206914
}
69216915

@@ -7151,8 +7145,9 @@ public void setEncodingDeclarationHandler(
71517145

71527146
void destructor() {
71537147
Portability.delete(nonInternedTagName);
7154-
// CPPONLY: Portability.delete(nonInternedAttributeName);
71557148
nonInternedTagName = null;
7149+
// CPPONLY: Portability.delete(nonInternedAttributeName);
7150+
// CPPONLY: nonInternedAttributeName = null;
71567151
// The translator will write refcount tracing stuff here
71577152
Portability.delete(attributes);
71587153
attributes = null;

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4786,7 +4786,7 @@ private boolean adoptionAgencyEndTag(@Local String name) throws SAXException {
47864786
assert node == listOfActiveFormattingElements[nodeListPos];
47874787
assert node == stack[nodePos];
47884788
T clone = createElement("http://www.w3.org/1999/xhtml",
4789-
node.name, node.attributes.cloneAttributes(null), commonAncestor.node
4789+
node.name, node.attributes.cloneAttributes(), commonAncestor.node
47904790
// CPPONLY: , htmlCreator(node.getHtmlCreator())
47914791
);
47924792
StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
@@ -4818,7 +4818,7 @@ private boolean adoptionAgencyEndTag(@Local String name) throws SAXException {
48184818
}
48194819
T clone = createElement("http://www.w3.org/1999/xhtml",
48204820
formattingElt.name,
4821-
formattingElt.attributes.cloneAttributes(null), furthestBlock.node
4821+
formattingElt.attributes.cloneAttributes(), furthestBlock.node
48224822
// CPPONLY: , htmlCreator(formattingElt.getHtmlCreator())
48234823
);
48244824
StackNode<T> formattingClone = createStackNode(
@@ -5005,12 +5005,12 @@ private void reconstructTheActiveFormattingElements() throws SAXException {
50055005
T clone;
50065006
if (currentNode.isFosterParenting()) {
50075007
clone = createAndInsertFosterParentedElement("http://www.w3.org/1999/xhtml", entry.name,
5008-
entry.attributes.cloneAttributes(null)
5008+
entry.attributes.cloneAttributes()
50095009
// CPPONLY: , htmlCreator(entry.getHtmlCreator())
50105010
);
50115011
} else {
50125012
clone = createElement("http://www.w3.org/1999/xhtml", entry.name,
5013-
entry.attributes.cloneAttributes(null), currentNode.node
5013+
entry.attributes.cloneAttributes(), currentNode.node
50145014
// CPPONLY: , htmlCreator(entry.getHtmlCreator())
50155015
);
50165016
appendElement(clone, currentNode.node);
@@ -5424,7 +5424,7 @@ private void appendToCurrentNodeAndPushFormattingElementMayFoster(
54245424
checkAttributes(attributes, "http://www.w3.org/1999/xhtml");
54255425
// ]NOCPP]
54265426
// This method can't be called for custom elements
5427-
HtmlAttributes clone = attributes.cloneAttributes(null);
5427+
HtmlAttributes clone = attributes.cloneAttributes();
54285428
// Attributes must not be read after calling createElement, because
54295429
// createElement may delete attributes in C++.
54305430
T elt;
@@ -6130,7 +6130,7 @@ private boolean charBufferContainsNonWhitespace() {
61306130
StackNode<T> newNode = new StackNode<T>(-1);
61316131
newNode.setValues(node.getFlags(), node.ns,
61326132
node.name, node.node, node.popName,
6133-
node.attributes.cloneAttributes(null)
6133+
node.attributes.cloneAttributes()
61346134
// CPPONLY: , node.getHtmlCreator()
61356135
// [NOCPP[
61366136
, node.getLocator()
@@ -6217,7 +6217,7 @@ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
62176217
}
62186218

62196219
@SuppressWarnings("unchecked") public void loadState(
6220-
TreeBuilderState<T> snapshot, Interner interner)
6220+
TreeBuilderState<T> snapshot)
62216221
throws SAXException {
62226222
// CPPONLY: mCurrentHtmlScriptIsAsyncOrDefer = false;
62236223
StackNode<T>[] stackCopy = snapshot.getStack();
@@ -6254,9 +6254,9 @@ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
62546254
StackNode<T> node = listCopy[i];
62556255
if (node != null) {
62566256
StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
6257-
Portability.newLocalFromLocal(node.name, interner), node.node,
6258-
Portability.newLocalFromLocal(node.popName, interner),
6259-
node.attributes.cloneAttributes(null)
6257+
node.name, node.node,
6258+
node.popName,
6259+
node.attributes.cloneAttributes()
62606260
// CPPONLY: , node.getHtmlCreator()
62616261
// [NOCPP[
62626262
, node.getLocator()
@@ -6272,8 +6272,8 @@ public boolean snapshotMatches(TreeBuilderState<T> snapshot) {
62726272
int listIndex = findInArray(node, listCopy);
62736273
if (listIndex == -1) {
62746274
StackNode<T> newNode = createStackNode(node.getFlags(), node.ns,
6275-
Portability.newLocalFromLocal(node.name, interner), node.node,
6276-
Portability.newLocalFromLocal(node.popName, interner),
6275+
node.name, node.node,
6276+
node.popName,
62776277
null
62786278
// CPPONLY: , node.getHtmlCreator()
62796279
// [NOCPP[

0 commit comments

Comments
 (0)