зеркало из https://github.com/mozilla/pjs.git
Bug 536789. Null-check the body, since we might not have one. r=dbaron
This commit is contained in:
Родитель
d4e6ad8636
Коммит
24c3d645d9
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче