Index: third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp |
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp |
index cc5344d24e8ff07e7371e4340fbfbfc544fc5005..be72275e02a68dbe8831b25dd1cbe98a5638c44b 100644 |
--- a/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp |
+++ b/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp |
@@ -383,8 +383,11 @@ PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLConstructionSite::takeForm() |
void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() |
{ |
ASSERT(m_document); |
- if (m_document->frame() && !m_isParsingFragment) |
+ if (m_document->frame() && !m_isParsingFragment) { |
m_document->frame()->loader().dispatchDocumentElementAvailable(); |
+ m_document->frame()->loader().runScriptsAtDocumentElementAvailable(); |
+ // runScriptsAtDocumentElementAvailable might have invalidated m_document. |
+ } |
} |
void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* token) |