Index: third_party/WebKit/Source/core/html/MediaDocument.cpp |
diff --git a/third_party/WebKit/Source/core/html/MediaDocument.cpp b/third_party/WebKit/Source/core/html/MediaDocument.cpp |
index 525d869dbb2ff380d5110f98d9e9b3d3e17ac593..3435ebd037dbe23c5481dda4aebc720cc748087e 100644 |
--- a/third_party/WebKit/Source/core/html/MediaDocument.cpp |
+++ b/third_party/WebKit/Source/core/html/MediaDocument.cpp |
@@ -75,8 +75,10 @@ void MediaDocumentParser::createDocumentStructure() |
rootElement->insertedByParser(); |
document()->appendChild(rootElement); |
- if (document()->frame()) |
- document()->frame()->loader().dispatchDocumentElementAvailable(); |
+ document()->frame()->loader().dispatchDocumentElementAvailable(); |
+ document()->frame()->loader().runScriptsAtDocumentElementAvailable(); |
+ if (isDetached()) |
+ return; // runScriptsAtDocumentElementAvailable can detach the frame. |
RefPtrWillBeRawPtr<HTMLHeadElement> head = HTMLHeadElement::create(*document()); |
RefPtrWillBeRawPtr<HTMLMetaElement> meta = HTMLMetaElement::create(*document()); |