mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 536789. Null-check the body, since we might not have one. r=dbaron
This commit is contained in:
parent
e76b6c5c78
commit
797cfc02f1
11
layout/style/crashtests/536789-1.html
Normal file
11
layout/style/crashtests/536789-1.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!-- Must be in quirks mode -->
|
||||
<html>
|
||||
<body>
|
||||
<script>
|
||||
var docEl = document.documentElement;
|
||||
var b = document.body;
|
||||
docEl.removeChild(b);
|
||||
docEl.appendChild(document.createElement("table"));
|
||||
docEl.offsetWidth;
|
||||
</script>
|
||||
</html>
|
@ -49,3 +49,4 @@ load 509155-1.html
|
||||
load 509156-1.html
|
||||
load 524252-1.html
|
||||
load font-face-truncated-src.html
|
||||
load 536789-1.html
|
||||
|
@ -63,7 +63,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsRuleWalker.h"
|
||||
@ -404,12 +404,12 @@ NS_IMPL_ISUPPORTS2(nsHTMLStyleSheet, nsIStyleSheet, nsIStyleRuleProcessor)
|
||||
static nsresult GetBodyColor(nsPresContext* aPresContext, nscolor* aColor)
|
||||
{
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsCOMPtr<nsIDOMHTMLDocument> domdoc = do_QueryInterface(shell->GetDocument());
|
||||
if (!domdoc)
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(shell->GetDocument());
|
||||
if (!htmlDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
|
||||
if (!bodyContent)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||
domdoc->GetBody(getter_AddRefs(body));
|
||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||
nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
|
||||
if (!bodyFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user