Closed Bug 85798 Opened 23 years ago Closed 21 years ago

INUSE_ATTRIBUTE_ERR expected when using setNamedItem()

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: stummala, Assigned: peterv)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1)
Gecko/20010607 Netscape6/6.1b1
BuildID:    2001-06-07-13-0.9.1

no exception was thrown when using setNamedItem() . i attached testcase to
demonstrate this bug.


Reproducible: Always
Steps to Reproduce:
1.load the page http://h-208-12-38-201/cdex049.html
2.
3.

Actual Results:  no exception thrown

Expected Results:  expected "INUSE_ATTRIBUTE_ERR" to be thrown
Attached file testcase
Not a show stopper, Future.
Target Milestone: --- → Future
Here's why I think the testcase in this bug is invalid:
SetNamedItem() (and SetNamedItemNS()) throw the following exceptions:
* NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
* INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of
another Element object. The DOM user must explicitly clone Attr nodes to re-use
them in other elements.

Since the NamedNodeMap we are talking about is Node.attributes, which is
readonly, we have to throw NO_MODIFICATION_ALLOWED_ERR (which is the subject of
bug 85776), so we shouldn't throw INUSE_ATTRIBUTE_ERR.

However this bug could be valid if we morphed it to be a bug about
nsXMLNamedNodeMap which needs to throw this exception (and the patch I attached
in bug 123232 doesn't do it)
Keywords: testcase
Priority: -- → P5
Whiteboard: [invalid?]
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
The testcase is valid, see bug 85776 comment 7.
Assignee: dom_bugs → peterv
Priority: P5 → P3
Target Milestone: Future → mozilla1.6alpha
There's two problems in setNamedItem (and setNamedItemNS). The code doesn't
check if the node that's passed in has an ownerElement and it doesn't set the
ownerElement on the node after it's been added.
Status: NEW → ASSIGNED
Whiteboard: [invalid?]
Attached patch v1Splinter Review
Attachment #131794 - Flags: superreview?(jst)
Attachment #131794 - Flags: review?(bugmail)
Blocks: 125665
Comment on attachment 131794 [details] [diff] [review]
v1

sr=jst
Attachment #131794 - Flags: superreview?(jst) → superreview+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
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: