XMLDocumentParser doesn't parse <template> correctly.
https://bugs.webkit.org/show_bug.cgi?id=112328

Reviewed by Hajime Morrita.

Source/WebCore:

XMLDocumentParser should check whether a parent node is attached or not
when a new element is appended.

Test: fast/dom/HTMLTemplateElement/xhtml-with-titleElement-parsing-crash.xhtml

* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::startElementNs):
m_currentNode is a parent node of newElement, but it is updated by
pushCurrentNode. So firstly stored copied m_curretNode's value into
local currentNode and used the currentNode to check whether
newElement's parent is attached or not.

LayoutTests:

* fast/dom/HTMLTemplateElement/xhtml-with-titleElement-parsing-crash-expected.txt: Added.
* fast/dom/HTMLTemplateElement/xhtml-with-titleElement-parsing-crash.xhtml: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146562 268f45cc-cd09-0410-ab3c-d52691b4dbfc