Fix crash on certain pages. b=118829 r=jag sr=waterson

This commit is contained in:
dbaron%fas.harvard.edu 2002-01-09 02:36:49 +00:00
Родитель 86023b43eb
Коммит 5f67a2f0fd
2 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -2438,12 +2438,15 @@ FindCanvasBackground(nsIPresContext* aPresContext,
nsCOMPtr<nsIDOMHTMLElement> body;
htmlDoc->GetBody(getter_AddRefs(body));
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame *bodyFrame;
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (bodyFrame)
::GetStyleData(bodyFrame, &result);
NS_ASSERTION(bodyContent, "no body node"); // bug 118829
if (bodyContent) {
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame *bodyFrame;
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (NS_SUCCEEDED(rv) && bodyFrame)
::GetStyleData(bodyFrame, &result);
}
}
}
}

Просмотреть файл

@ -2438,12 +2438,15 @@ FindCanvasBackground(nsIPresContext* aPresContext,
nsCOMPtr<nsIDOMHTMLElement> body;
htmlDoc->GetBody(getter_AddRefs(body));
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame *bodyFrame;
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (bodyFrame)
::GetStyleData(bodyFrame, &result);
NS_ASSERTION(bodyContent, "no body node"); // bug 118829
if (bodyContent) {
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));
nsIFrame *bodyFrame;
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (NS_SUCCEEDED(rv) && bodyFrame)
::GetStyleData(bodyFrame, &result);
}
}
}
}