Merge remote-tracking branch 'origin/main' into fix/watcher-termination-safety-followup

This commit is contained in:
Brennan Benson
2026-07-13 21:19:21 -07:00
3 changed files with 11 additions and 2 deletions
@@ -53,6 +53,11 @@ const { fakeElectron } = vi.hoisted(() => {
webContents: FakeWebContents
setBounds = vi.fn()
constructor(options: { webContents?: FakeWebContents; webPreferences?: unknown }) {
// Why: Electron rejects explicit undefined instead of treating it as
// omitted, which the popup fallback path depends on.
if (Object.hasOwn(options, 'webContents') && options.webContents === undefined) {
throw new TypeError('options.webContents must be a WebContents')
}
this.options = options
this.webContents = options.webContents ?? createFakeWebContents()
FakeWebContentsView.instances.push(this)
@@ -186,6 +191,7 @@ describe('openPopupWithOriginBar', () => {
it('loads the target itself only when no pre-created contents were provided', () => {
const popup = openPopupWithOriginBar({}, 'https://example.com/login')
expect(lastViews().content.options).not.toHaveProperty('webContents')
expect(popup.contentWebContents.loadURL).toHaveBeenCalledWith('https://example.com/login')
})
+3 -1
View File
@@ -120,7 +120,9 @@ export function openPopupWithOriginBar(
webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true }
})
const contentView = new WebContentsView({
webContents: options.webContents,
// Why: Electron rejects an explicitly undefined webContents; omitting it
// lets WebContentsView create contents for Cmd/Ctrl-click popups.
...(options.webContents === undefined ? {} : { webContents: options.webContents }),
webPreferences: options.webPreferences
})
window.contentView.addChildView(contentView)
@@ -35,7 +35,8 @@ function activityDotState(status: TerminalTabActivityStatus): AgentDotState | nu
return 'permission'
case 'done':
return 'done'
default:
case 'active':
case 'inactive':
return null
}
}