Closed Bug 83363 Opened 24 years ago Closed 24 years ago

crash if insertNode tries to add non-existent node

Categories

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

x86
Windows 2000
defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: mail, Assigned: anthonyd)

References

Details

(Keywords: crash, Whiteboard: [range], FIX IN HAND; will check in soon)

Attachments

(3 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9+) Gecko/20010525 BuildID: 2001052504 Using the DOM 2 Range insertNode method, mozilla crashes if the node which is being inserted does not exist. I would think an exception should be raised, but I don't see one in the spec. Reproducible: Always Steps to Reproduce: 1. run testcase 2. browser crashes Actual Results: Crash Expected Results: Exception or script error
Attached file testcase
I've added two testcase... one with a try catch statement and one without. The one with the try-catch does not crash, while the one without crashes my machine. I'm not sure where to draw the line between what the developer should check for and what the browser should check for, but since this is a fundamental part of the spec. and it seems that there will be many accidental cases of trying to add a nonexistent node, then maybe it should throw an exception.
Blocks: 58969
I'm going to change the severity to critical since this is a crash bug report.
Severity: minor → critical
Keywords: crash
on it, i missed this. sorry. anthonyd
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.2
Also crashes if the node to insert is already a descendant of the Range as well, so it may crash upon any of the exceptions when not using try catch.
Whiteboard: [range]
i have a fix for this, need to patch it up and get it attached here. anthonyd
im attaching a patch for this, it is only a one liner, the rest of the patch is just other fixes for range that are descreibed in other bugs, and I didnt feel like breaking out just one line. I will however paste it here: nsRange::InsertNode line 1757: NS_ENSURE_ARG_POINTER(aN);
Whiteboard: [range] → [range], FIX IN HAND
Attached patch patchSplinter Review
Whiteboard: [range], FIX IN HAND → [range], FIX IN HAND need r=, sr=
got an r= from mjudge, and a sr= from kin. sending to drivers@mozilla.org for approval to check in. anthonyd
Blocks: 83989
a= asa@mozilla.org for checkin to the trunk. (on behalf of drivers)
Whiteboard: [range], FIX IN HAND need r=, sr= → [range], FIX IN HAND; will check in soon
fix checked in anthonyd
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
catching up on verifications
Status: RESOLVED → VERIFIED
Component: DOM: Traversal-Range → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: