mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-26 01:08:39 +09:00
Bug 1276438 part 2. Move the implementation of the .body setter from nsHTMLDocument to nsIDocument.
Tag UXP Issue #1344 Tag UXP Issue #252
This commit is contained in:
parent
0ef352d74b
commit
c939244e89
4 changed files with 28 additions and 26 deletions
|
|
@ -1034,31 +1034,6 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
|
|||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLDocument::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.
|
||||
if (!newBody ||
|
||||
!newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) ||
|
||||
!root || !root->IsHTMLElement() ||
|
||||
!root->IsHTMLElement(nsGkAtoms::html)) {
|
||||
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();
|
||||
if (currentBody) {
|
||||
root->ReplaceChild(*newBody, *currentBody, rv);
|
||||
} else {
|
||||
root->AppendChild(*newBody, rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetHead(nsIDOMHTMLHeadElement** aHead)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue