Closed
Bug 413127
Opened 18 years ago
Closed 18 years ago
adoptNode + removeChild + GC + ditching browser/iframe == unpredictable ownerDocument
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 335998
People
(Reporter: Gijs, Unassigned)
Details
Attachments
(1 file)
|
693 bytes,
text/html
|
Details |
(anyone who thinks themselves willing and able, please fix the summary)
On current trunk (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b3pre) Gecko/2008011623 Minefield/3.0b3pre):
STR:
1. Add node to iframe from parent document.
2. Keep ref to node.
3. removeChild(node) from iframe's document.
4. Kill iframe.
4b. Wait 5 seconds to give GC a chance (if someone has a better method, please go for it).
ER:
5. node.ownerDocument still holds on to the iframe's document
AR:
5. node.ownerDocument /might/ be null (I blame GC for the unpredictability).
I'm attaching a testcase, which seems to alert(null) on the second alert about 3/4 times on my debug (!) build. YMMV. :-(
This is causing a nasty ChatZilla bug (marked blocking), and isn't the behaviour you would expect given the DOM spec which says
"The Document object associated with this node. This is also the Document object used to create new nodes. When this node is a Document or a DocumentType which is not used with any Document yet, this is null."
Which, at least to me, implies that removing the child from the document shouldn't be nulling out the ownerDocument. We also don't seem to be doing this if the document stays around, which seems strange, too. If we did, as far as I can tell removeChild followed by appendChild would fail (because we yell if the ownerDocument of the new child is not the same as that of the parent, and also do so if it is null and the node in question is not a document type - http://mxr.mozilla.org/seamonkey/source/content/base/src/nsGenericElement.cpp#2627, line 2653-54).
Comment 1•18 years ago
|
||
This is a dup of bug 335998. Although the summary of that bug is about
parentNode, the issue is just the same.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•