Closed Bug 737612 Opened 12 years ago Closed 12 years ago

Range.insertNode() on a detached text node throws nonstandard exception type

Categories

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

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: ayg, Assigned: ayg)

Details

Attachments

(1 file)

Test-case:

data:text/html,<!DOCTYPE html>
<script>
var text = document.createTextNode("abc");
var range = document.createRange();
range.setStart(text, 1);
try {
range.insertNode(document.head);
} catch(e) {
document.documentElement.textContent = e
}
</script>

Gecko outputs

"""
[Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMRange.insertNode]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: http://software.hixie.ch/utilities/js/live-dom-viewer/# :: <TOP_LEVEL> :: line 7" data: no]
"""

Chrome 19 dev is a HIERARCHY_REQUEST_ERR.  Opera Next 12.00 alpha is BAD_BOUNDARYPOINTS_ERR (which no longer exists).  IE10 Developer Preview actually succeeds (?!?).  The spec goes like Chrome:

"""
If start node is a Comment node, or a Text node whose parent is null, throw an "HierarchyRequestError" exception and terminate these steps.
"""
http://dvcs.w3.org/hg/domcore/raw-file/tip/dom-core.html#dom-range-insertnode

This causes failures here: http://w3c-test.org/webapps/DOMCore/tests/approved/Range-insertNode.html
Assignee: nobody → ayg
Status: NEW → ASSIGNED
Attached patch Patch v1Splinter Review
Attachment #607689 - Flags: review?(bugs)
Whiteboard: [autoland-try:-u all]
Whiteboard: [autoland-try:-u all] → [autoland-in-queue]
Autoland Patchset:
	Patches: 607689
	Branch: mozilla-central => try
	Destination: http://hg.mozilla.org/try/pushloghtml?changeset=584e5d522b3e
Try run started, revision 584e5d522b3e. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=584e5d522b3e
Attachment #607689 - Flags: review?(bugs) → review+
Try run for 584e5d522b3e is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=584e5d522b3e
Results (out of 179 total builds):
    exception: 3
    success: 143
    warnings: 23
    failure: 10
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-584e5d522b3e
 Timed out after 12 hours without completing.
Whiteboard: [autoland-in-queue]
http://hg.mozilla.org/integration/mozilla-inbound/rev/7e895f6e79e6
Flags: in-testsuite+
OS: Linux → All
Hardware: x86 → All
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/7e895f6e79e6
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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: