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 9f79b05e40110b02fdf360f9829b6a420e7c9d8c..c189c330cb88c94488c21bebf9da97b0465ab9ba 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() |