Index: Source/bindings/core/v8/ScriptController.cpp |
diff --git a/Source/bindings/core/v8/ScriptController.cpp b/Source/bindings/core/v8/ScriptController.cpp |
index 26f81df5fff5417f873c861135f85347b878354e..30482004680d0ffe285856ea4f2d91cca0fb404e 100644 |
--- a/Source/bindings/core/v8/ScriptController.cpp |
+++ b/Source/bindings/core/v8/ScriptController.cpp |
@@ -558,12 +558,7 @@ bool ScriptController::executeScriptIfJavaScriptURL(const KURL& url) |
if (!locationChangeBefore && m_frame->navigationScheduler().locationChangePending()) |
return true; |
- // DocumentWriter::replaceDocument can cause the DocumentLoader to get deref'ed and possible destroyed, |
- // so protect it with a RefPtr. |
- if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) { |
- UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaScriptURL); |
- loader->replaceDocument(scriptResult, ownerDocument.get()); |
- } |
+ m_frame->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, ownerDocument.get()); |
return true; |
} |