119044 - Prevent a crash when trying to append/insert the current element or one of its ancestors into itself. Throw the correct exception in this case per the DOM spec.

Thanks to Neil Deakin <ndeakin@sympatico.ca> for pinpointing this and providing a patch.
r=bryner/caillon sr=jst
This commit is contained in:
caillon%returnzero.com 2002-08-17 01:43:07 +00:00
Родитель 8be45362ae
Коммит cbbdd9ee40
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -993,6 +993,11 @@ nsXULElement::InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
if (NS_FAILED(rv))
return rv;
// We can't insert an ancestor or ourself.
if (IsAncestor(aNewChild, this)) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsCOMPtr<nsIContent> newcontent = do_QueryInterface(aNewChild);
NS_ASSERTION(newcontent != nsnull, "not an nsIContent");
if (! newcontent)