Gracefully handle XMLDocumentParser being detached by mutation events.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Oct 2015 23:45:11 +0000 (23:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Oct 2015 23:45:11 +0000 (23:45 +0000)
commit82c91d3404dcc27944088049b6ec930c88c434a9
tree97e751d5b72e440bd05b8c71323c077540668897
parent84bad63eab5d557dc5a6ec8e9973e5ec4ddd733f
Gracefully handle XMLDocumentParser being detached by mutation events.
https://bugs.webkit.org/show_bug.cgi?id=149485
<rdar://problem/22811489>

Source/WebCore:

This is a merge of Blink change 200026,
https://codereview.chromium.org/1267283002

Patch by Jiewen Tan <jiewen_tan@apple.com> on 2015-10-08
Reviewed by Darin Adler.

Test: fast/parser/xhtml-dom-character-data-modified-crash.html

* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::createLeafTextNode):
Renamed from enterText() to make it more descriptive.

(WebCore::XMLDocumentParser::updateLeafTextNode):
Renamed from exitText to firm up this stage.

(WebCore::XMLDocumentParser::end):
Gracefully handle stopped states.

(WebCore::XMLDocumentParser::enterText): Deleted.
(WebCore::XMLDocumentParser::exitText): Deleted.

* xml/parser/XMLDocumentParser.h:
Rename enterText to createLeafTextNode.
Rename exitText to updateLeafTextNode.

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):
(WebCore::XMLDocumentParser::endElementNs):
(WebCore::XMLDocumentParser::characters):
(WebCore::XMLDocumentParser::processingInstruction):
(WebCore::XMLDocumentParser::cdataBlock):
(WebCore::XMLDocumentParser::comment):
(WebCore::XMLDocumentParser::endDocument):
Rename function calls and firm up updateLeafTextNode stage accordingly.

LayoutTests:

Patch by Jiewen Tan <jiewen_tan@apple.com> on 2015-10-08
Reviewed by Darin Adler.

* fast/parser/resources/xhtml-overwrite-frame.xhtml: Added.
* fast/parser/xhtml-dom-character-data-modified-crash-expected.txt: Added.
* fast/parser/xhtml-dom-character-data-modified-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/parser/resources/xhtml-overwrite-frame.xhtml [new file with mode: 0644]
LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/parser/xhtml-dom-character-data-modified-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/xml/parser/XMLDocumentParser.cpp
Source/WebCore/xml/parser/XMLDocumentParser.h
Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp