Open Bug 1368132 Opened 3 years ago Updated 3 years ago

Reflow tests should account for flushes that occur within timers, idle callbacks, and thread dispatches

Categories

(Testing :: Mochitest, enhancement)

enhancement
Not set

Tracking

(Not tracked)

People

(Reporter: mconley, Unassigned)

References

Details

In bug 1354194, I added reflow tests for some key interactions. Those tests work, roughly, by dirtying the DOM before any JavaScript event is handled, in the hopes that we can deterministically trigger reflows anytime that a reflow _might_ be triggered.

This works okay, but has a few blind spots. For one thing, it's possible for JS to run inside a timer, or an idleCallback, or be dispatched as a runnable to the main thread. In those cases, there's no great way for me to hook in and dirty the DOM before those functions run.

We should find a way of doing that so we can flush out reflows in these types of callbacks.
(In reply to Mike Conley (:mconley) from comment #0)

> This works okay, but has a few blind spots. For one thing, it's possible for
> JS to run inside a timer, or an idleCallback, or be dispatched as a runnable
> to the main thread. In those cases, there's no great way for me to hook in
> and dirty the DOM before those functions run.

How bad would it be to do:

(function alwaysDirty() {
  dirtyDOM();
  Services.tm.dispatchToMainThread(alwaysDirty);
})();

?
You need to log in before you can comment on or make changes to this bug.