Index: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
index 4f4869917e785f7345b73ff31324900d6d8a4ecf..e69c65c8a4fa4edec342176a647f5af7dc239bc3 100644 |
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp |
@@ -1071,8 +1071,11 @@ void XMLDocumentParser::startElementNs(const AtomicString& localName, const Atom |
if (isHTMLHtmlElement(*newElement)) |
toHTMLHtmlElement(*newElement).insertedByParser(); |
- if (!m_parsingFragment && isFirstElement && document()->frame()) |
+ if (!m_parsingFragment && isFirstElement && document()->frame()) { |
document()->frame()->loader().dispatchDocumentElementAvailable(); |
+ document()->frame()->loader().runScriptsAtDocumentElementAvailable(); |
+ // runScriptsAtDocumentElementAvailable might have invalidated the document. |
+ } |
} |
void XMLDocumentParser::endElementNs() |