Created attachment 289679 [details] testcase I'm seeing this assertion in current debug trunk build with the testcase: ###!!! ASSERTION: element has no document: 'doc', file c:/mozilla-build/mozilla/ content/xul/templates/src/nsXULTemplateBuilder.cpp, line 403
Related to bug 384740?
I still see this on trunk, even with bug 384740 WFM. Firefox doesn't paint the page when I click 'testcase'! It still shows this bug report, with the new URL showing in the address bar!
The builder is likely delaying the initialization of the template builder until parsing is complete at which point the node is no longer in a document. Since that could actually be a valid situataion, for the assertion, we should probably just check the current document in nsXULDocument::CreateTemplateBuilder (instead of the owner document as it does currently) and return successfully if null. However, I would say that the latter behaviour of not showing a blank page was a more problematic bug here.
The patch here fixes the assertion, but doesn't fix the issue where the page doesn't even appear. That problem is caused because nsXULDocument::StartLayout returns early if it encounters a document with no root element, preventing InitialReflow from being called. I don't know if there's a reason it should be doing this; removing it causes to blank page to display but causes assertions at nsPresShell.cpp:5810 when mousing over it.
Yeah, I have no idea what all nsXULDocument::StartLayout is trying to do. That assertion is bogus, imo.
Created attachment 373692 [details] [diff] [review] updated patch that fixes the document displaying
Comment on attachment 373692 [details] [diff] [review] updated patch that fixes the document displaying Looks ok to me. Could you perhaps file a followup to fix event handling when document doesn't have documentElement. (or maybe there is already such bug)
Checked in. Filed bug 489562 on event handling.