From 0ce08b418d84a57bae22a0aa395fecb7412ed931 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 4 Sep 2019 15:27:40 +0200 Subject: Fix an issue with the html5 tokenizer and tree builder. --- parser/html/nsHtml5Tokenizer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'parser/html/nsHtml5Tokenizer.cpp') diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index e70c081bf..8aae5613a 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2005-2007 Henri Sivonen * Copyright (c) 2007-2015 Mozilla Foundation + * Copyright (c) 2019 Moonchild Productions * Portions of comments Copyright 2004-2010 Apple Computer, Inc., Mozilla * Foundation, and Opera Software ASA. * @@ -127,15 +128,11 @@ nsHtml5Tokenizer::isViewingXmlSource() } void -nsHtml5Tokenizer::setStateAndEndTagExpectation(int32_t specialTokenizerState, nsIAtom* endTagExpectation) +nsHtml5Tokenizer::setState(int32_t specialTokenizerState) { this->stateSave = specialTokenizerState; - if (specialTokenizerState == NS_HTML5TOKENIZER_DATA) { - return; - } - autoJArray asArray = nsHtml5Portability::newCharArrayFromLocal(endTagExpectation); - this->endTagExpectation = nsHtml5ElementName::elementNameByBuffer(asArray, 0, asArray.length, interner); - endTagExpectationToArray(); + this->endTagExpectation = nullptr; + this->endTagExpectationAsArray = nullptr; } void @@ -2040,7 +2037,13 @@ nsHtml5Tokenizer::stateLoop(int32_t state, char16_t c, int32_t pos, char16_t* bu NS_HTML5_BREAK(stateloop); } c = checkChar(buf, pos); - if (index < endTagExpectationAsArray.length) { + if (!endTagExpectationAsArray) { + tokenHandler->characters(nsHtml5Tokenizer::LT_SOLIDUS, 0, 2); + cstart = pos; + reconsume = true; + state = P::transition(mViewSource, returnState, reconsume, pos); + NS_HTML5_CONTINUE(stateloop); + } else if (index < endTagExpectationAsArray.length) { char16_t e = endTagExpectationAsArray[index]; char16_t folded = c; if (c >= 'A' && c <= 'Z') { -- cgit v1.2.3