Closed Bug 558973 Opened 14 years ago Closed 14 years ago

"ASSERTION: Nodes that are not documents, document fragments or elements can't be parents!"

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5
Tracking Status
blocking2.0 --- final+

People

(Reporter: jruderman, Assigned: peterv)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files)

Attached file testcase
###!!! ASSERTION: Nodes that are not documents, document fragments or elements can't be parents!: 'aParent->IsNodeOfType(nsINode::eDOCUMENT) || aParent->IsNodeOfType(nsINode::eDOCUMENT_FRAGMENT) || aParent->IsNodeOfType(nsINode::eELEMENT)', file /Users/jruderman/mozilla-central/content/base/src/nsGenericElement.cpp, line 3574

This assertion was added in bug 540848 and is very easy to trigger.

There are already a bunch of mochitests (at least in part 2/5) that trigger this assertion, but assertions aren't fatal yet on Tinderbox :/
Flags: in-testsuite+
blocking2.0: --- → ?
Assignee: nobody → peterv
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Target Milestone: --- → mozilla1.9.3a5
Attached patch v1Splinter Review
Apparently the DOM testsuite doesn't test this :-/. I don't like adding those (virtual) IsNodeOfType calls, but don't have a better idea.
Attachment #438749 - Flags: review?(jst)
Do we have spare bits in nsINode? One could be used for
"DO_NOT_ALLOW_ADDING_CHILD_NODES" or some such.
Though, I'm not sure if GetFlags is much faster than IsNodeOfType
So wait.  Why do we need to call the generic methods from nsGenericDOMDataNode and add checks to them?  Because quickstubs calls those methods directly?
And we do want to make flag-getting fast (just have them as bitfield members?) and replace some of our IsNodeOfType with flag bits, imo.  But that's a separate bug.
Attachment #438749 - Flags: review?(jst) → review+
(In reply to comment #3)
> Why do we need to call the generic methods from nsGenericDOMDataNode

Technically we don't, but I personally like it better if all entry points end up running the same code.

> and add checks to them?

Quickstubs call the generic nsINode methods (through the inlined nsINode::InsertBefore/ReplaceChild/AppendChild). We could make the nsINode functions virtual and override them in nsGenericDOMDataNode if you like that better. That would remove one virtual function call overall for ReplaceOrInsertBefore (-2+1).

I think we need faster checks for nodetype, so that we can actually completely remove those virtual function calls (-2+0).
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
> I think we need faster checks for nodetype,

I'm adding a faster IsElement() right now; we can add others similarly as needed.
blocking2.0: ? → final+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: