In bug 1334642, sfoster is removing a synchronous style flush that we're doing via script when activating and deactivating browser windows. It'd be great if we had some way of writing tests to ensure that between two points of interest in script, that no style flushes have occurred. That way, we could add tests for "critical user interactions" and ensure only the minimum number of flushes required occur (and no new ones get introduced). Something similar was added for reflows in bug 453650.
Summary: Add styling flush observer → Add styling flush notification
Hey ehsan, this is what we talked about this morning.
So one existing way we have to add tests for things like this is on DOMWindowUtils: it has an "elementsRestyled" property that's just a counter that increments every time we restyle an element. So if you want to assert that no elements have had their style recomputed in an interval, you can check that the counter at the end of that interval is the same as the counter at the beginning of the interval. (It has similar framesConstructed and framesReflowed counters.) See https://searchfox.org/mozilla-central/rev/7419b368156a6efa24777b21b0e5706be89a9c2f/dom/interfaces/base/nsIDOMWindowUtils.idl#1865
(The counter is per-window.)
(And, FWIW, an observer seems like it's going to have more overhead than the incrementing counter, so if there's a reason the counter doesn't work and you actually need an observer instead, you should say so.)
Yes, I think we can work with those counters. Thank you for pointing those out!
I think what dbaron pointed out is sufficient for now. Going to WONTFIX unless there's a good reason to add a new notification that the counters don't satisfy.
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.