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; nsCOMPtr<nsIDOMHTMLElement> body;
htmlDoc->GetBody(getter_AddRefs(body)); htmlDoc->GetBody(getter_AddRefs(body));
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body); nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
nsCOMPtr<nsIPresShell> shell; NS_ASSERTION(bodyContent, "no body node"); // bug 118829
aPresContext->GetShell(getter_AddRefs(shell)); if (bodyContent) {
nsIFrame *bodyFrame; nsCOMPtr<nsIPresShell> shell;
shell->GetPrimaryFrameFor(bodyContent, &bodyFrame); aPresContext->GetShell(getter_AddRefs(shell));
if (bodyFrame) nsIFrame *bodyFrame;
::GetStyleData(bodyFrame, &result); nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
if (NS_SUCCEEDED(rv) && bodyFrame)
::GetStyleData(bodyFrame, &result);
}
} }
} }
} }

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

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