Closed Bug 16585 Opened 25 years ago Closed 24 years ago

insertBefore, replaceChild, and appendChild should throw exception if given ancestor

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: dbaron, Assigned: vidur)

References

()

Details

(Whiteboard: [HAVE FIX])

Attachments

(2 files)

DESCRIPTION:  If one attempts to use insertBefore() to insert an element's
ancestor as a child of that element (which would thus remove the ancestor from
the tree), a HIERARCHY_REQUEST_ERROR should be thrown.  This is currently not
happening, and, depending on which element you're using, this can cause a crash.

STEPS TO REPRODUCE:
 * load attached test case
 * hit test

ACTUAL RESULTS:
 * either crash or one line of red output

EXPECTED RESULTS:
 * green output

DOES NOT WORK CORRECTLY ON:
 * Linux, apprunner, 1999-10-15-11-M11

ADDITIONAL INFORMATION:
The test case that causes the crash does so by removing the body element from
the tree (or otherwise messing it up somehow).

I haven't tested this with appendChild(), etc., but there could be similar
problems.
Note to myself:  I should update the test page once this is fixed by adding the
crash-causing test back in.
replaceChild() causes the same problem.
Severity: critical → normal
I made the removing body node causing a crash a separate bug - bug 16585.

However, the first test case here shouldn't remove the body node.  It should
throw an exception.

Reducing severity to normal.
appendChild() has the same problem.
Severity: normal → major
Summary: insertBefore should throw exception if given ancestor → insertBefore, replaceChild, and appendChild should throw exception if given ancestor
Retitling and raising to major since this can really mess up the document
tree...
In an attempt to get my bug list in order again, marking all the bugs I have
currently as ASSIGNED.
I've got a fix for this one, I'm working with Vidur on getting it checked in.
OS: Linux → All
Hardware: PC → All
Target Milestone: M15
Whiteboard: [HAVE FIX]
The fix for this is checked in, marking FIXED.

Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Mass update of qa contact
QA Contact: gerardok → janc
Component: DOM Level 1 → DOM Core
QA contact Update
QA Contact: janc → desale
Updating QA contact to Shivakiran Tummala.
QA Contact: desale → stummala
verified on windows 2000 for build 2001-07-09-09 
marking as verified...
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: