| 1 | = Back / Forward Cache |
| 2 | ''by Chris Dumez'' |
| 3 | |
| 4 | - Objectives |
| 5 | - Make pages suspendable most of the time (~98%) |
| 6 | - Allow for much faster back/forward navigation |
| 7 | - Means addressing most failures to suspend, not introducing new ones |
| 8 | - ActiveDOMObject |
| 9 | - Largest cause of failures |
| 10 | - Need to drop all shouldPreventEnteringBackForwardCache_DEPRECATED() overrides |
| 11 | - Queue tasks on the event loop for running script (e.g. event dispatch, promise resolution) |
| 12 | - Pause CPU-intensive work (e.g. animations) in suspend() and unpause it in resume() |
| 13 | - Abort work that cannot be paused in suspend() and make sure tasks to dispatch relevant error events are queued on the event loop |
| 14 | - Dedicated Workers |
| 15 | - Dedicated workers have their whole thread suspended when entering the back/forward cache |
| 16 | - ActiveDOMObject::suspend() / resume() do not get called |
| 17 | - Service Workers |
| 18 | - Service workers cannot be easily suspended because they can be shared |
| 19 | - When a client page goes into the back/forward cache, it gets disconnected as a client of the service worker |
| 20 | - When a service worker no longer has any clients, it is terminated |