Contact email:
sza...@chromium.org
Summary: window.isFramePending() returns a boolean indicating whether the browser intends to update the visual display – including updating animations and running requestAnimationFrame callbacks – at the next opportunity (i.e., after the currently-running javascript task yields back to the browser).
Motivation: This provides developers with better information for making decisions in code about when to defer work and yield back to the browser's event loop.
Risks: This API reveals the fact that the browser has scheduled an animation frame, indicating that the page contents are dirty. More investigation is needed to ensure that this information is not exploitable (discussion is ongoing in the WICG proposal issue).
Interop/Compat: The way in which browsers determine when a "rendering opportunity" occurs is an un-specified implementation detail, so it's not immediately clear how much consistency there will be between browsers. Nevertheless, there are some useful invariants that can be included in web platform tests (see below).
Ergonomics: Should be pretty simple to use; follows the conventions of
isInputPending.
Activation: To use this API effectively, developers should have a good understanding of the document lifecycle and how rendering updates happen.
Debuggability: No special features planned for debugging. The implementation includes a tracing variable that can show state changes.
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, Android WebView): yes
Is this feature fully tested by web-platform-tests: Not yet, but a testing plan would probably include verifying the following:
- When isFramePending() transitions from false to true, the only javascript tasks that are permitted to run before reqeuestAnimationFrame callbacks are input event handlers.
- isFramePending() must always return false during the execution of a requestAnimationFrame callback.
Requesting approval to ship: no.