Bug 391960, null check document of anchor node, r+sr=bz,a=damon

git-svn-id: svn://10.0.0.236/trunk@232343 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
enndeakin%sympatico.ca 2007-08-19 16:55:18 +00:00
parent d8f1734dec
commit 32148a6f5f

View File

@ -861,18 +861,20 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame)
if (!aAnchorFrame) {
if (mAnchorContent) {
nsCOMPtr<nsIDocument> document = mAnchorContent->GetDocument();
nsIPresShell *shell = document->GetPrimaryShell();
if (!shell)
return NS_ERROR_FAILURE;
aAnchorFrame = shell->GetPrimaryFrameFor(mAnchorContent);
}
else {
aAnchorFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
if (document) {
nsIPresShell *shell = document->GetPrimaryShell();
if (!shell)
return NS_ERROR_FAILURE;
aAnchorFrame = shell->GetPrimaryFrameFor(mAnchorContent);
}
}
if (!aAnchorFrame)
return NS_OK;
if (!aAnchorFrame) {
aAnchorFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
if (!aAnchorFrame)
return NS_OK;
}
}
if (aAnchorFrame->GetContent()) {