jkleinsc

#56022: test: isolate matchOriginAsFallback preload spec across retries

Merged
Created: Nov 23, 2026, 12:25:34 PM
Merged: Nov 24, 2026, 10:15:05 AM
4 comments
Target: main

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 neighboring chrome-extension:// test), and the helper unregisters the preloads it adds in its finally block.
  • Retries are disabled for the whole BrowserWindow module suite ({ retry: 0 }), as already done in api-session.spec.ts and api-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: 0 added: the injected failure failed immediately, with no retry.

Checklist

Release Notes

🤖 Generated with Claude Code

Notes: none

Backports

44-x-y
Merged
PR Number
#56038
Merged At
Nov 24, 2026, 12:28:49 PM
Released In
Not yet
Release Date
Not yet
45-x-y
Merged
PR Number
#56039
Merged At
Nov 24, 2026, 12:29:09 PM
Released In
Not yet
Release Date
Not yet
46-x-y
In-flight
PR Number
#56037
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

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