Closed Bug 511084 Opened 15 years ago Closed 9 years ago

Figure out what to do with iframe/frame as a root element

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: smaug, Assigned: bzbarsky)

References

Details

Attachments

(3 files)

Currently nsGenericHTMLFrameElement::EnsureFrameLoader() doesn't create
frame loader if there is no parent element.

Opera and Webkit allow <iframe> as a root element.

Opera doesn't seem to load anything when <frame> is the root.
Webkit seems to load something but paints just random garbage (both Safari and Chrome).
Attached file iframe testcase
Attached file frame testcase
I'm not sure there is a problem offhand with creating a frameloader even if !GetParent(), though we'll have to audit the frameloader code to ensure it doesn't assume mContent has a parent.

Looking at the blame, the GetParent() check dates back to bug 170588 for the frame case and bug 52334 for the iframe case.  I doubt jst remembers why he added the null-check there at the time, but needinfoing him just in case.

Note that before bug 170588 the frameloader was created by the subdocument frame, so a root <iframe> didn't do it, since the root element doesn't ever get a subdocument frame.
Flags: needinfo?(jst)
Don't we need subdocument frame to get sane size information about the iframe.
I unfortunately do not remember why that null check was added, could very well have been as a precautionary measure w/o any evidence of a real need. Hard to say, was a few years ago :(
Flags: needinfo?(jst)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8557311 [details] [diff] [review]
Make frame/iframe create a browsing context even if it's the root element

So the patch is fine, but I think we should not land this without having
at least some reftest to ensure layout can handle this case.
(Wouldn't make much sense to have support for iframe as document element, but
not able to render it properly.)
Attachment #8557311 - Flags: review?(bugs) → review+
Layout won't render it with a subdocument frame.

But this is no different from what happens if you use <img> as a root element: the image loads, but doesn't get rendered.  So I don't think it's a problem per se.
ok, fine. (It is still a problem, since iframe and img should just work normally.)
https://hg.mozilla.org/mozilla-central/rev/32d9b3fa982d
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: