diff options
Diffstat (limited to 'dom')
-rw-r--r-- | dom/base/nsDocument.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 69cbff16c..3faa39ab3 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -6562,18 +6562,16 @@ nsIDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv) nsCOMPtr<Element> root = GetRootElement(); // The body element must be either a body tag or a frameset tag. And we must - // have a html root tag, otherwise GetBody will not return the newly set - // body. + // have a root element to be able to add kids to it. if (!newBody || !newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) || - !root || !root->IsHTMLElement() || - !root->IsHTMLElement(nsGkAtoms::html)) { + !root) { rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR); return; } // Use DOM methods so that we pass through the appropriate security checks. - nsCOMPtr<Element> currentBody = GetBodyElement(); + nsCOMPtr<Element> currentBody = GetBody(); if (currentBody) { root->ReplaceChild(*newBody, *currentBody, rv); } else { |