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 2d87cd5784e4a66a840126a9904ff9764e4b7a47..8f5516643920f3ef0a3898966ac619e353df9891 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() |