#56022: test: isolate matchOriginAsFallback preload spec across retries
Description of Change
Fixes a flaky test, BrowserWindow module > webPreferences > preload > delivery of the preload list > matches a popup's initial empty document by its opener's origin with matchOriginAsFallback (sandbox: false), which failed every attempt on 46-x-y's Windows x64 shard (job).
Why the retries could not recover: the first attempt failed when the local test page did not load (ERR_NO_BUFFER_SPACE, the Windows socket error behind other scattered first-load failures on these runners). The test's partition counter is declared inside the test body, so every attempt reused the same in-memory session partitions, and the preloads it registered were never unregistered. Each retry therefore also ran the preloads left over from earlier attempts and reported extra documents ([page, blank], then [page, blank×3], then [page, blank×4] against an expected ['about:blank']).
Changes
- Each attempt now uses its own partitions (a
crypto.randomUUID()suffix, like the neighboringchrome-extension://test), and the helper unregisters the preloads it adds in itsfinallyblock. - Retries are disabled for the whole
BrowserWindow modulesuite ({ retry: 0 }), as already done inapi-session.spec.tsandapi-web-contents.spec.ts, so other flakiness in this file is not masked. Note that this also means a one-off runner network error in this file will now fail the job instead of being retried.
Verification (local, Windows, CI=1 to enable retries): I injected a single failure before the first page load of the first attempt to simulate ERR_NO_BUFFER_SPACE.
- Old test: failed after 3 retries, with the same growing pattern of extra reports as CI.
- With the isolation fix: passed on the first retry.
- Fixed test with no injected failure: passed.
- With
retry: 0added: the injected failure failed immediately, with no retry.
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
🤖 Generated with Claude Code
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