How we built it

Intervention: Throttle timers in out-of-view frames

As an intervention we want to limit the rate at which timers in out-of-view, cross-origin frames are able to fire. Until very recently it wasn't possible for script authors to easily determine whether their content was visible to the user or not. A common pattern therefore is to use a continuous setTimeout() loop for driving animations without considering visibility, which can be very costly for performance.

Comments

A potential compatibility risk is that a site can observe timers firing out-of-order if the timers are scheduled from a mix of visible and hidden frames. To reduce this risk, we propose to only throttle timers in cross-origin frames.

Demo

Documentation

Status in Chromium

Enabled by default (launch bug) in:

  • Chrome for desktop release 56
  • Chrome for Android release 56
  • Android WebView release 56
  • Opera release 56
  • Opera for Android release 45

Consensus & Standardization

Owner

Last updated on 2016-11-17