3 Commits

Author SHA1 Message Date
Greg Darke
f4f2f8d725 Expose WakeLockManager state transitions for tests
Dispatch an event on each state transition inside the WakeLockManager.
This gives the unit tests something to synchronise on, allowing us to
write fast, flake-free tests.
2025-12-06 19:00:42 +11:00
Greg Darke
077c54f312 Add error state for wakelock testing.
Add an error state to the WakeLockManager state machine. This adds a
transition that can be detected from tests (it otherwise serves no
purpose, and the system immediatly transitions back into the released
state).
2025-12-06 19:00:42 +11:00
Greg Darke
8341fdf846 Add wakelock support
Add a new configuration option `keep_device_awake` to allow noVNC to
stop the local display from going to sleep. This is especially useful
with view-only sessions.

This new option has been added to the configuration UI, making it easier
for users to configure. When this option is changed at runtime, we will
request/release the wake lock.

We only hold the view lock while connected to a server. We will also
attempt to reacquire the wakelock if we lost it due to a visibility
change (the tab becoming inactive, or during the transition into/from
fullscreen).

All existing unittests have been run, and the change has been manually
tested in Firefox 145. Additional tests will be added later.
2025-12-06 19:00:42 +11:00