Closed Bug 12734 Opened 25 years ago Closed 25 years ago

Checking for duplicate insertions

Categories

(Core :: XUL, defect, P2)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: daniel, Assigned: waterson)

References

()

Details

The lines: PRInt32 i = mChildren->IndexOf(aKid); NS_ASSERTION(i < 0, "element is already a child"); if (i >= 0) return NS_ERROR_FAILURE; make little sense, either the interface supports checking for duplicate insertions and the NS_ASSERTION should be removed, or the interface doesn't support it and then the "return NS_ERROR_FAILURE" should be removed. I would suggest replacing these lines with NS_ASSERTION(mChildren->IndexOf(aKid) < 0, "element is already a child"); to prevent the IndexOf enumeration from happening in non-debug builds. (It's pretty minor, the only 50+ elements enumeration I could find was when starting up the editor)
Blocks: 11413
Status: NEW → ASSIGNED
Component: RDF → XUL
Target Milestone: M11
Yep, this is dumb. We should be checking in the implementations of the DOM APIs, not the content APIs. Good catch.
Target Milestone: M11 → M12
Priority: P3 → P2
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
QA Contact: phillip → waterson
Resolution: --- → FIXED
damn, i can't believe i've sat on this for so long. fix checked in. thanks zee.
QA Contact: waterson → ckritzer
Changing QA Contact to ckritzer@netscape.com
Status: RESOLVED → VERIFIED
QA Contact: ckritzer → paulmac
verified
BULK MOVE: Changing component from XUL to XP Toolkit/Widgets: XUL. XUL component will be deleted.
Component: XUL → XP Toolkit/Widgets: XUL
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: paulmac → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.