#55442: test: keep the HTML fullscreen spec's page drawing while covered
Description of Change
BrowserWindow module > window states (excluding Linux) > fullscreen state > correctly remembers state prior to HTML fullscreen transition times out at 30 s on Windows arm64 CI, where a foreign topmost window can cover the test window. Chromium's native occlusion tracker then marks the covered page hidden.
Entering or leaving HTML fullscreen resizes the window before Electron updates the page's fullscreen state. Chromium holds that update back until the page has drawn a frame at the new size (visual_properties_ack_pending_). A hidden page doesn't draw, so requestFullscreen() or exitFullscreen() doesn't settle while the window is covered.
- The spec now calls
webContents.setBackgroundThrottling(false)after loading the page, so the page keeps drawing while covered.- Unlike the constructor option, which only stops later hides, the runtime call also shows a page that is already hidden. That happens when the window is covered after it is first shown but before the page commits.
- The spec checks the menu bar state around the transition, not the page's visibility.
- It focuses the page before each
requestFullscreen(). Shortly after leaving fullscreen, Chromium refuses the request from an unfocused page, so the second iteration would fail with "not granted" if a foreign window had taken focus. alwaysOnTop, which other specs use against covering console windows, wouldn't help here: on Windows it places the window below the taskbar's level, under a topmost window.
The spec only runs on Windows. To check the mechanism on Linux under Xvfb, I copied its flow into a throwaway spec and covered the window with another X client's window:
- With the default options,
requestFullscreen()stayed pending until the cover went away. - With the constructor option alone, it still stalled when the cover arrived before the page committed.
- With the runtime call, it settled while still covered in both cases.
This PR also brings back the focusWebContents import that #55230 removed from this file.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
Release Notes
Notes: none
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron