The window.requestIdleCallback()
API can schedule background tasks
such that they do not introduce delays to other high priority tasks
that share the same event loop, such as input processing, animations
and frame compositing.
But the API leaks information about the other tasks running in the browser as it leaks information on currently scheduled tasks, vsync deadlines, user-interaction and so on.
JShelter modifies the return call to:
- Never leak the information that the call was triggered by an expired timeout.
- Fake the information on remaining time in synchronization with the
Date.now()
wrapper. Returns up to 50% more time compared to the original value.