Open Bug 1688430 Opened 3 years ago Updated 3 years ago

Some tests may randomly fail due to forcibly reloaded by font-info-updated notification

Categories

(Core :: Layout, defect)

defect

Tracking

()

Tracking Status
firefox86 --- affected

People

(Reporter: masayuki, Unassigned)

References

Details

See bug 1541915 comment #39.

https://searchfox.org/mozilla-central/rev/d5e98892f9553f9113e69c585308008e681e19c9/gfx/thebes/gfxPlatform.cpp#2362

gfxPlatform::ForceGlobalReflow() may update all documents when font info is updated. That means that all scroll position may be reset to top-left-most. This occurs if a preceding test loads a font, and that is unloaded while another test is running.

I wonder, cannot do mochitest and WPT framework forcibly run the pending runnable event before starting next event?

It seems that bug 1632669 is also a victim of this.

What is the "problem" here? It is by design that the async fallback rendering triggers the global reflow at any time.

If other tests depend on that gfx.font_rendering.fallback.async is true, it is a bug itself unless they test the async fallback rendering itself. Since bug 1676966 did not add any new tests, we can safely assume that we have no such tests. (Yes, we should have a test, but it is a different problem.)

Flags: needinfo?(jfkthame)

See also this announcement:
https://lists.mozilla.org/pipermail/dev-platform/2021-January/025947.html

We could simply run all tests with the pref set to false, to avoid these issues

If other tests depend on that gfx.font_rendering.fallback.async is true, it is a bug itself unless they test the async fallback rendering itself.

All scroll positions may be reset. That's really terrible thing for the tests checking scroll behavior. And the unexpected global reflow may occur in some tests at start of each chunk even if font list hasn't been changed actually. Therefore, this causes increasing the frequency of intermittent failures of some tests.

It seems surprising to me that all scroll positions may be reset; shouldn't they generally be maintained across a reflow? If I trigger a similar reflow of all documents while using the browser (e.g. by installing a new font in my system, or deactivating a currently-installed one), I don't see scroll positions everywhere getting reset.

I do sometimes see a small visual glitch, where a scroll position seems to jump a bit, particularly if something scrollable is actively in motion at the time of the reflow. This seems like a bug, though a pretty minor one; it's quite sporadic, only a minor glitch, and this isn't something that will frequently happen in normal use.

Anyhow, it's certainly plausible that triggering reflow "glitches" the position of an in-progress scrolling operation, and this could cause unexpected test failures. I think the best solution to this will be to just run the scrolling tests in a directory with the fallback.async pref disabled. (In theory those tests could fail in the same way if the system's font configuration were to change during the test run, but obviously that doesn't happen in CI.)

As for explicitly testing the async fallback behavior: yes, it would be good to have tests for this, but it's hard to see how to do it reliably. Triggering and testing the fallback will be inherently fragile, as it depends on the installed fonts and on the behavior of OS APIs (e.g. Core Text or DirectWrite) that may evolve with every OS update, as well as on the behavior of any preceding testcases that have been run in the same browser instance and might have already triggered the loader.

Flags: needinfo?(jfkthame)
Severity: -- → S4
You need to log in before you can comment on or make changes to this bug.