Index: Source/WebCore/bindings/ScriptControllerBase.cpp |
=================================================================== |
--- Source/WebCore/bindings/ScriptControllerBase.cpp (revision 88811) |
+++ Source/WebCore/bindings/ScriptControllerBase.cpp (working copy) |
@@ -107,9 +107,12 @@ |
// FIXME: We should always replace the document, but doing so |
// synchronously can cause crashes: |
// http://bugs.webkit.org/show_bug.cgi?id=16782 |
- if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) |
- m_frame->document()->loader()->writer()->replaceDocument(scriptResult); |
- |
+ if (shouldReplaceDocumentIfJavaScriptURL == ReplaceDocumentIfJavaScriptURL) { |
+ // We're still in a frame, so there should be a DocumentLoader. |
+ ASSERT(m_frame->document()->loader()); |
+ if (DocumentLoader* loader = m_frame->document()->loader()) |
+ loader->writer()->replaceDocument(scriptResult); |
+ } |
return true; |
} |