Skip to content

Commit aadc9c1

Browse files
committed
Mozilla bug 1515066 - Mark SVG script without an end tag malformed. r=smaug.
1 parent 1bd56bb commit aadc9c1

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3360,14 +3360,15 @@ public final void endTag(ElementName elementName) throws SAXException {
33603360
}
33613361
}
33623362
eltPos = currentPtr;
3363+
int origPos = currentPtr;
33633364
for (;;) {
33643365
if (eltPos == 0) {
33653366
assert fragment: "We can get this close to the root of the stack in foreign content only in the fragment case.";
33663367
break endtagloop;
33673368
}
33683369
if (stack[eltPos].name == name) {
33693370
while (currentPtr >= eltPos) {
3370-
pop();
3371+
popForeign(origPos);
33713372
}
33723373
break endtagloop;
33733374
}
@@ -5226,6 +5227,17 @@ private void pop() throws SAXException {
52265227
node.release(this);
52275228
}
52285229

5230+
private void popForeign(int origPos) throws SAXException {
5231+
StackNode<T> node = stack[currentPtr];
5232+
if (origPos != currentPtr) {
5233+
markMalformedIfScript(node.node);
5234+
}
5235+
assert debugOnlyClearLastStackSlot();
5236+
currentPtr--;
5237+
elementPopped(node.ns, node.popName, node.node);
5238+
node.release(this);
5239+
}
5240+
52295241
private void silentPop() throws SAXException {
52305242
StackNode<T> node = stack[currentPtr];
52315243
assert debugOnlyClearLastStackSlot();

0 commit comments

Comments
 (0)