xml documents in iframes in xml documents doesn't always work

Assigned to



Layout: Misc Code
14 years ago
11 years ago


(Reporter: sicking, Assigned: sicking)


Bug Flags:
blocking1.9 -
wanted1.9 +

Firefox Tracking Flags

(Not tracked)



(2 attachments, 1 obsolete attachment)

If an xhtml document contains an iframe pointing to another xml document we
sometimes start layout too early on the inner document. What happens is that
when the outer document finishes loading we will perform initial reflow causing
the iframe-frame to be created and initialized.

However initializing the frame causes it to call it to tell the inner docshell
to show itself which will perform initial reflow on the inner document. But
since the inner document is an xmldocument we're not supposed to do initial
reflow until the document finishes loading so all hell breaks loose.

In the xhtml-in-xhtml case the worst that seems to happen is that we don't
render the inner document (or we probably render what was loaded so far). But in
xslt this causes crashes (bug 182460).

Here's the top of the stack when we start the initial reflow on the inner document:

PresShell::InitialReflow(PresShell * const 0x03611ca0, int 0, int 0) line 2667
DocumentViewerImpl::InitPresentationStuff(int 1) line 687
DocumentViewerImpl::Show(DocumentViewerImpl * const 0x035a29a0) line 1529 + 10 bytes
nsDocShell::SetVisibility(nsDocShell * const 0x036abfd4, int 1) line 3628
nsSubDocumentFrame::ShowDocShell() line 703
nsSubDocumentFrame::Init(nsSubDocumentFrame * const 0x036cf634, nsPresContext *
0x035ee918, nsIContent * 0x036ae758, nsIFrame * 0x036cf560, nsStyleContext *
0x036cf510, nsIFrame * 0x00000000) line 275 + 8 bytes

If either of the documents is an html document rather then xhtml things does
work. If the outer document is a html document we fire off the notification to
create the iframe-frame early enough that the inner document doesn't have an
nsDocumentViewer yet so we don't get any further then nsDocShell::SetVisibility.
If the inner document is an html document we're saved by the fact that it's fine
to perform initial reflow even though the document hasn't loaded yet.

I'm guessing that the way to fix this is to let nsDocumentViewer::Show bail if
it's containing an xml-document that hasn't finished loading yet.
Created attachment 174438 [details]
outer xhtml

I can't reproduce this loading directly from b.m.o (probably due to timing of
when things finishes to load) so you'll have to download if you want to test.

I think the script ensures that we start loading the inner xml so that it gets
a documentviewer before we finish loading the outer xml. Come to think of it,
that's probably why this doesn't always work loading the inner frame from bmo
since we won't get the first data and create the documentviewer before the
outer is fully loaded.
Created attachment 174439 [details]
outer xhtml

opps, the previous version I attached linked to the bmo version of inner.xml.
This one links locally and is fit for download.
Attachment #174438 - Attachment is obsolete: true
All of which begs the question... why is the iframe calling SetVisibility on the
docshell at all?  Does anything break if you remove that?

I suppose an empty iframe (say no src) may do weird things then....
I think this was caused by the fix for bug 138012. We used to have a check to
only set visibility if we weren't currently loading something into the frame.
I'll try to reinstate that check.
Flags: blocking1.9? → blocking1.9-
Whiteboard: [wanted-1.9]
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
You need to log in before you can comment on or make changes to this bug.