#54609: test: wait for the webview guest to load before navigating it
Description of Change
Fixes a flaky webContents module setIgnoreMenuShortcuts(ignore) uses the source settings for webview spec, added in #54014.
The spec navigates the <webview> guest to about:blank right after did-attach-webview, but the guest may still be loading its src. If that load has committed but not finished, the navigation aborts it, and the aborted page's did-fail-load (ERR_ABORTED, with an empty description) settles the pending loadURL() promise. The spec then fails with Error: (-3) loading '…/spec/fixtures/pages/zoom-factor.html'.
Hitting that window depends on timing, so it shows up on slower runners. Downstream CI on hosted macOS x64 agents fails this spec on most attempts; upstream only runs api-web-contents.spec.ts on macOS x64 for pushes, not PRs.
The fix waits for the guest's initial load to finish before navigating it, using the same isLoading() / did-finish-load idiom already used elsewhere in the specs. This changes only the spec.
Validation on Linux (Testing build of main, under Xvfb):
- The
setIgnoreMenuShortcutswebview and docked DevTools specs pass. - Reproduced the CI error deterministically by serving the guest page slowly and delaying the navigation by 500ms to mimic a slow runner. Without this change the spec fails with
(-3) loading '<guest url>'; with it, it passes. tsc -p spec/tsconfig.jsonand JS lint pass.
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
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
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