[Bug]: _electron.launch intermittently loses a packaged app's first window since 1.64.0 #43247
Description
Version
1.64.0 (regression from 1.63.0)
Steps to reproduce
-
Package an Electron app (we're on Electron 44.5.1) whose
readyhandler creates a hiddenBrowserWindowand only callsloadURLon it after anawait:app.on("ready", async () => { const win = new BrowserWindow({ show: false, title: "My App" }); await new Promise((r) => setTimeout(r, 1000)); await win.loadURL(`file://${__dirname}/index.html`); win.once("ready-to-show", () => win.show()); });
-
Launch the packaged executable (packaged with
@electron/packager) and wait for the window:const app = await electron.launch({ executablePath: "/path/to/packaged/app" }); const page = await app.firstWindow();
Expected behavior
The window is reported in app.windows() / firstWindow(), as in 1.63.0.
Actual behavior
Intermittently, the window is never reported. app.windows() stays empty and firstWindow() times out, while the app itself is running normally. In our CI, the packaged app running is running in mcr.microsoft.com/playwright:v1.64.0.
Additional context
Likely cause: #43075, the follow-up to #42936.
- For packaged apps,
electron.tsdoes not injectloader.js, so thereadyevent is not deferred until__playwright_run(). The app creates its windows whileCRBrowser.connectis still running with_isConnecting = true. - Since chore(chromium): close pages that crashed before connecting over CDP #43075,
Inspector.enableis sent to every page attached while_isConnecting, and_onTargetCrashedcloses and removes any page that is not yet initialized. - A hidden
BrowserWindowthat has not navigated yet has no renderer, so it is treated as crashed and dropped. Its target stays attached, so it is never reported again, even after it navigates.
#42936 explicitly noted that "a new page might not have a renderer yet, e.g. an Electron window before its first navigation, and must not be treated as crashed". Its CI caught the Electron firstWindow delayed-navigation test timing out, and the fix limited the check to pre-existing pages. #43075 widened the condition to _isConnecting. Playwright's Electron tests launch unpackaged apps, where the loader defers ready until after connecting, so they don't cover this path.
Environment
System: Ubuntu 24.04 (mcr.microsoft.com/playwright:v1.64.0), GitHub Actions ubuntu-latest
Node: 24.21.0
Electron: 44.5.1 (packaged app using @electron/packager, launched via executablePath)
@playwright/test: 1.64.0
Activity
dgozman commentedon Oct 14, 2026
Upstream fix: https://chromium-review.googlesource.com/c/chromium/src/+/8479173.