Closed Bug 1396097 Opened 7 years ago Closed 4 years ago

Add a console warning for calls to synchronous layout flushes which may result in FOUC

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1623968

People

(Reporter: ehsan.akhgari, Assigned: bradwerth)

References

(Blocks 1 open bug)

Details

Attachments

(2 obsolete files)

We should add a console warning here <http://searchfox.org/mozilla-central/rev/51b3d67a5ec1758bd2fe7d7b6e75ad6b6b5da223/dom/base/nsContentSink.cpp#1252> if aIgnorePendingSheets && WaitForPendingSheets() to catch the cases where the content calls APIs which perform synchronous layout flushes with pending stylesheet loads which can result in FOUC.  Ideally we would tell the developer which API call resulted in the warning as well.
So just to be clear, this would warn somewhat racily, based on whether the API call happens at the point before the sheets finish loading or not.

Actually, we should probably warn any time aIgnorePendingSheets is true there, even if there are no pending sheets: we haven't started layout yet (because mLayoutStarted is false), and someone is asking for layout info, so it's FOUC.  In particular, that would catch script asking for layout info before <body> has been seen...
I'll work on it.
Assignee: nobody → bwerth
Now working on a test.
Would it be possible to include a script stack trace with the console warning? That would make it easier to diagnose and suggest fixes for issues.
(In reply to Thomas Wisniewski from comment #5)
> Would it be possible to include a script stack trace with the console
> warning? That would make it easier to diagnose and suggest fixes for issues.

I agree that would be valuable. As I get the test working, I'll update the part 1 patch to also output a stack strace.
P3 isn't meant to demean the great boon this will be to people experiencing it!
Priority: -- → P3
Component: DOM → DOM: Core & HTML

Still working on an effective test.

Attachment #8903830 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Attachment #9051177 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: