Open Bug 452961 Opened 11 years ago Updated 2 years ago

make it easier to use DOM windows/nodes as hash keys (for JS objects)

Categories

(Core :: DOM: Core & HTML, enhancement, P5)

enhancement

Tracking

()

REOPENED

People

(Reporter: zeniko, Unassigned)

References

Details

Proposal: Add an ID/hashCode (AString or long) attribute to their interfaces.

We need to associate data with DOM windows and DOM nodes e.g. for Session Restore. However the windows/nodes themselves can't be used as keys, since their toString representation is always the same and since they don't provide an ID/hashCode themselves.

The current options seem thus to be to either set an attribute on the node (won't persist through XPCNativeWrappers though and leaks e.g. out of XPCOM components) or to keep two arrays in sync and then perform linear searches through the "hash"-array (risk of arrays getting out of sync and of accidentally leaking memory when holding on too long to the DOM objects).
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 307795
Not a DUPE, since implementing hashCode isn't the only acceptable solution for fixing this bug (see e.g. the alternative suggestion by bug 307795 comment #2).
Status: RESOLVED → REOPENED
Depends on: 307795
Resolution: DUPLICATE → ---
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.