Index: Source/core/dom/DocumentInit.cpp |
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp |
index c0fa775aada1cfadfbd1fc0e0bb7ebe21b524956..11b06ae136be1b143855ac425170907bc4686393 100644 |
--- a/Source/core/dom/DocumentInit.cpp |
+++ b/Source/core/dom/DocumentInit.cpp |
@@ -54,12 +54,12 @@ static Document* ownerDocument(LocalFrame* frame) |
if (!frame) |
return 0; |
- LocalFrame* ownerFrame = frame->tree().parent(); |
+ Frame* ownerFrame = frame->tree().parent(); |
if (!ownerFrame) |
ownerFrame = frame->loader().opener(); |
- if (!ownerFrame) |
+ if (!ownerFrame || !ownerFrame->isLocalFrame()) |
return 0; |
- return ownerFrame->document(); |
+ return toLocalFrame(ownerFrame)->document(); |
} |
DocumentInit::DocumentInit(const KURL& url, LocalFrame* frame, WeakPtrWillBeRawPtr<Document> contextDocument, HTMLImportsController* importsController) |