Closed Bug 379093 Opened 18 years ago Closed 18 years ago

[FIX]Onload can fire before page layout is complete

Categories

(Core :: Layout, defect, P1)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha5

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(2 files, 1 obsolete file)

See bug 378975 comment 6. I guess we could try dealing with this by revoking reflow events when a reflow flush occurs. Or we could explicitly flush out layout before invoking the onload handler.
Blocks: 378975
A third option is to block onload while there is a reflow event pending (and make sure to call DoneRemovingDirtyRoots() from ProcessReflowCommands even if we didn't remove any, since that may just indicate that the reflow event fired). I don't quite like this approach because there is no guarantee that it converges: if reflows keep posting new reflow events, onload will never fire. That seems undesirable.
Attached patch Proposed fix (obsolete) — Splinter Review
In general we don't want to keep revoking reflow events to keep down on the churn during, say, DHTML animations that also flush layout all the time. But during pageload, I think we need to do this...
Attachment #263094 - Flags: superreview?(roc)
Attachment #263094 - Flags: review?(roc)
Attachment #263094 - Attachment description: Proposd fix → Proposed fix
Priority: -- → P1
Summary: Onload can fire before page layout is complete → [FIX]Onload can fire before page layout is complete
Target Milestone: --- → mozilla1.9alpha5
Attachment #263094 - Flags: superreview?(roc)
Attachment #263094 - Flags: superreview+
Attachment #263094 - Flags: review?(roc)
Attachment #263094 - Flags: review+
Attached patch Simpler optionSplinter Review
This just goes ahead and flushes out reflow before firing the onload event. This is simpler than trying to maintain the document loading state, esp. since that breaks down if partway through the load a display:none iframe gets a presshell or some such.
Attachment #263094 - Attachment is obsolete: true
Attachment #263225 - Flags: superreview?(roc)
Attachment #263225 - Flags: review?(roc)
Attachment #263225 - Flags: superreview?(roc)
Attachment #263225 - Flags: superreview+
Attachment #263225 - Flags: review?(roc)
Attachment #263225 - Flags: review+
I don't think it's generally safe to be keeping around a raw pointer to the window through a FlushPendingNotifications call. Is there some reason it's safe here?
Attached patch Good catchSplinter Review
Patch on top of "simpler option" (which I checked in).
Attachment #263233 - Flags: superreview?(roc)
Attachment #263233 - Flags: review?(roc)
Note: the checkin of the "simpler option" patch didn't significantly affect Tp or Tp2 on the Linux boxen... Which is interesting, since it certainly affected pageload times here.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Attachment #263233 - Flags: superreview?(roc)
Attachment #263233 - Flags: superreview+
Attachment #263233 - Flags: review?(roc)
Attachment #263233 - Flags: review+
Is this needed on branches? If it's a bug on branches, then I think perhaps we should take this on branches, for the sake of being able to compare Tp between trunk and branch.
It probably _could_ be useful on branches, though I'm not sure we're hitting this problem on branches on Tp per se. But as far as comparing Tp, we want to compare to various 1.9 milestones as well, so I filed bug 379233 a few days ago.
Checked in the second patch too.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: