Bug 1940688 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

For testing purposes, I would like to propose adding a mechanism to disable the throttling of `window.requestAnimationFrame` invocations when a tab is in the background. Currently, background tabs throttle `requestAnimationFrame` to 1 frame per second. Additionally, I observe that each invocation introduce a cumulative factor of 2, which further increases the slowdown for code relying on this method.

```
pw:browser [pid=53296][out] 1736338119512	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 30 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 30 http://localhost:8907/empty.html\n","timestamp":1736338119510}} +994ms
pw:browser [pid=53296][out] 1736338120513	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 29 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 29 http://localhost:8907/empty.html\n","timestamp":1736338120513}} +1s
pw:browser [pid=53296][out] 1736338122519	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 28 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 28 http://localhost:8907/empty.html\n","timestamp":1736338122518}} +2s
pw:browser [pid=53296][out] 1736338126523	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 27 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 27 http://localhost:8907/empty.html\n","timestamp":1736338126522}} +
```
The motivation for this request originates from the needs of testing tools, such as Playwright, which run tests in parallel across multiple user contexts (containers). These tools require consistent execution speeds for all tests, regardless of whether a tab is in the foreground or background. With throttling in place, tests running in background tabs experience significant slowdowns, often leading to timeouts and degraded testing performance.
For testing purposes, I would like to propose adding a mechanism to disable the throttling of `window.requestAnimationFrame` invocations when a tab is in the background. Currently, background tabs throttle `requestAnimationFrame` to 1 frame per second. Additionally, I observe that each invocation introduce a cumulative factor of 2, which further increases the slowdown for code relying on this method.

```
pw:browser [pid=53296][out] 1736338119512	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 30 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 30 http://localhost:8907/empty.html\n","timestamp":1736338119510}} +994ms
pw:browser [pid=53296][out] 1736338120513	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 29 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 29 http://localhost:8907/empty.html\n","timestamp":1736338120513}} +1s
pw:browser [pid=53296][out] 1736338122519	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 28 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 28 http://localhost:8907/empty.html\n","timestamp":1736338122518}} +2s
pw:browser [pid=53296][out] 1736338126523	RemoteAgent	DEBUG	WebDriverBiDiConnection 16d6a9a7-9754-4f27-b9e7-3d96dc2f096a <- {"type":"event","method":"log.entryAdded","params":{"type":"console","method":"log","source":{"realm":"d6556ad5-8984-41d8-9427-cda4c19893fd","context":"fe3776fd-358b-4866-bf70-83c656e519f7"},"args":[{"type":"string","value":"\n** animation frame count 27 http://localhost:8907/empty.html\n"}],"level":"info","text":"\n** animation frame count 27 http://localhost:8907/empty.html\n","timestamp":1736338126522}} +4s
```
The motivation for this request originates from the needs of testing tools, such as Playwright, which run tests in parallel across multiple user contexts (containers). These tools require consistent execution speeds for all tests, regardless of whether a tab is in the foreground or background. With throttling in place, tests running in background tabs experience significant slowdowns, often leading to timeouts and degraded testing performance.

Back to Bug 1940688 Comment 0