21 мая 2018 г.

Background tab in Chrome browser: how it affects JS

This presentation from Chrome developers shows technical details regarding what happens to a web page when it goes into background (the user switches to another tab)

Freezing:

  • ~2013: timers are stopped on mobile after 5 minutes
  • M67: loading tasks are stopped on mobile after 5 minutes
  • M68 (experiment): page is frozen on desktop after 1 hour without network activity
  • M69: page will be frozen or discarded based on the API it uses
  • ~2020: page will be frozen after loading
Throttling:
  • 2011: setTimeout/setInterval are fired once a second
  • M56: timers are delayed to limit CPU usage to 1%
  • M68: workers are throttled
  • 2018: non-timer tasks are throttled
  • ~2020: page will be throttled during loading depending on the foreground activity