diff --git a/src/main/browser/agent-browser/commands/agent-browser-bridge-key-commands.ts b/src/main/browser/agent-browser/commands/agent-browser-bridge-key-commands.ts index c0cd2df9b20..4faf5baef24 100644 --- a/src/main/browser/agent-browser/commands/agent-browser-bridge-key-commands.ts +++ b/src/main/browser/agent-browser/commands/agent-browser-bridge-key-commands.ts @@ -14,9 +14,9 @@ import { import type { ResolvedBrowserCommandTarget } from '../session-routing/agent-browser-command-target' import { dispatchPageKeyEvents, - routePageTextInsertion, - type GuestCdpSender + routePageTextInsertion } from '../../cdp/input/guest-direct-key-input' +import type { GuestSessionCdpSender } from '../../cdp/input/guest-frame-input-sessions' import { assertExpectedPageUrlForStep } from '../../cdp/input/browser-expected-page-url' import { sendGuestCdpCommand } from '../../cdp/debugger/guest-cdp-command' import { AgentBrowserBridgeCaptureCommands } from './agent-browser-bridge-capture-commands' @@ -76,7 +76,7 @@ export abstract class AgentBrowserBridgeKeyCommands extends AgentBrowserBridgeCa try { releaseDebugger = acquireElectronDebugger(wc).release await this.waitForPagePaint(wc, target.webContentsId) - const send: GuestCdpSender = (method, params, sessionId) => + const send: GuestSessionCdpSender = (method, params, sessionId) => sendGuestCdpCommand(wc, method, params, sessionId) const guardFocus = (): Promise<() => void> => this.browserManager.guardUserFocusForAgentInput(target.webContentsId) diff --git a/src/main/browser/cdp/commands/cdp-page-input-commands.ts b/src/main/browser/cdp/commands/cdp-page-input-commands.ts index ba293ed23c6..dbe1ab8dc9b 100644 --- a/src/main/browser/cdp/commands/cdp-page-input-commands.ts +++ b/src/main/browser/cdp/commands/cdp-page-input-commands.ts @@ -12,9 +12,9 @@ import { import { dispatchPageKeyEvent, isEmbeddedGuest, - routePageTextInsertion, - type GuestCdpSender + routePageTextInsertion } from '../input/guest-direct-key-input' +import type { GuestSessionCdpSender } from '../input/guest-frame-input-sessions' import { withAgentInputInjection } from '../input/agent-input-injection' import type { AgentPointerInput } from '../../guest-lifecycle/page-activity/browser-agent-activity' import type { CapturePaintHold } from './cdp-screenshot' @@ -147,7 +147,7 @@ export class CdpPageInputCommands { ) } - private readonly sendRoot: GuestCdpSender = (method, params, sessionId) => + private readonly sendRoot: GuestSessionCdpSender = (method, params, sessionId) => this.debuggerChannel.sendDebuggerCommand(method, params, sessionId) // Focus awaits must not reorder pipelined key, text, or pointer events. diff --git a/src/main/browser/cdp/debugger/guest-first-paint.ts b/src/main/browser/cdp/debugger/guest-first-paint.ts index 6d3527147bb..21e84036817 100644 --- a/src/main/browser/cdp/debugger/guest-first-paint.ts +++ b/src/main/browser/cdp/debugger/guest-first-paint.ts @@ -1,7 +1,11 @@ import type { WebContents } from 'electron' import type { CapturePaintHold } from '../commands/cdp-screenshot' -import { isEmbeddedGuest, type GuestCdpSender } from '../input/guest-direct-key-input' -import { readRecord, settleWithin } from '../input/guest-frame-input-sessions' +import { isEmbeddedGuest } from '../input/guest-direct-key-input' +import { + readRecord, + settleWithin, + type GuestSessionCdpSender +} from '../input/guest-frame-input-sessions' const PAINTED_EXPRESSION = "performance.getEntriesByType('paint').length > 0" const AWAIT_FIRST_PAINT_EXPRESSION = `new Promise((resolve) => { @@ -14,7 +18,7 @@ const AWAIT_FIRST_PAINT_EXPRESSION = `new Promise((resolve) => { const gatedDocumentByGuest = new WeakMap() // Answers the document to gate, or null. A failed or timed-out probe means a busy page. -async function unpaintedDocument(send: GuestCdpSender): Promise { +async function unpaintedDocument(send: GuestSessionCdpSender): Promise { const response = await settleWithin( send('Runtime.evaluate', { expression: `[${PAINTED_EXPRESSION}, performance.timeOrigin]`, @@ -35,7 +39,7 @@ async function unpaintedDocument(send: GuestCdpSender): Promise { */ export async function waitForGuestFirstPaint( guest: WebContents, - send: GuestCdpSender, + send: GuestSessionCdpSender, holdPaint: CapturePaintHold ): Promise { if (!isEmbeddedGuest(guest)) { diff --git a/src/main/browser/cdp/input/guest-direct-key-input.ts b/src/main/browser/cdp/input/guest-direct-key-input.ts index c4d0c32b6e1..01ca2355541 100644 --- a/src/main/browser/cdp/input/guest-direct-key-input.ts +++ b/src/main/browser/cdp/input/guest-direct-key-input.ts @@ -21,15 +21,13 @@ import { // Main-session CDP keys follow window focus; guest widget events protect the user's input (#20595). -export type GuestCdpSender = GuestSessionCdpSender - // Offscreen and headless pages lack a host frame tree, so CDP already targets them. export function isEmbeddedGuest(webContents: WebContents): boolean { return webContents.getType() === 'webview' } // Wait for widget input handling before callers read its effects, matching CDP behavior. -async function waitForPageToHandleInput(send: GuestCdpSender): Promise { +async function waitForPageToHandleInput(send: GuestSessionCdpSender): Promise { await settleWithin( send('Runtime.evaluate', { // MessageChannel avoids hidden-page timer throttling. @@ -73,7 +71,7 @@ const NO_FOCUS_GUARD: AgentInputFocusGuard = async () => () => {} // Restore user focus after CDP fallback; emulation keeps the page from seeing blur. async function focusGuestForCdpInput( webContents: WebContents, - send: GuestCdpSender, + send: GuestSessionCdpSender, guardFocus: AgentInputFocusGuard ): Promise<() => void> { await enablePageFocusEmulation(send) @@ -85,7 +83,7 @@ async function focusGuestForCdpInput( // Cross-site frame sessions route CDP input without borrowing user focus. async function sendToFrameSession( webContents: WebContents, - send: GuestCdpSender, + send: GuestSessionCdpSender, sessionId: string, method: string, params: Record @@ -99,7 +97,7 @@ async function sendToFrameSession( export async function dispatchPageKeyEvent( webContents: WebContents, params: Record, - send: GuestCdpSender, + send: GuestSessionCdpSender, guardFocus: AgentInputFocusGuard = NO_FOCUS_GUARD ): Promise { return await dispatchPageKeyEvents(webContents, [params], send, guardFocus) @@ -112,7 +110,7 @@ const isTabDown = (params: Record): boolean => export async function dispatchPageKeyEvents( webContents: WebContents, events: readonly Record[], - send: GuestCdpSender, + send: GuestSessionCdpSender, guardFocus: AgentInputFocusGuard = NO_FOCUS_GUARD ): Promise { let result: unknown = {} @@ -211,7 +209,7 @@ export async function releaseHeldPageInput( release: HeldInputRelease, guardFocus: AgentInputFocusGuard ): Promise { - const send: GuestCdpSender = (method, params, sessionId) => + const send: GuestSessionCdpSender = (method, params, sessionId) => sendGuestCdpCommand(webContents, method, params, sessionId) // The command's debugger lease may already have detached. const lease = acquireElectronDebugger(webContents) @@ -245,7 +243,7 @@ export type TextInsertionRoute = { export async function routePageTextInsertion( webContents: WebContents, params: Record, - send: GuestCdpSender, + send: GuestSessionCdpSender, guardFocus: AgentInputFocusGuard = NO_FOCUS_GUARD ): Promise { const sendText = (insertParams: Record): Promise => diff --git a/src/main/browser/cookies/browser-partition-cookie-copy.ts b/src/main/browser/cookies/browser-partition-cookie-copy.ts index 33881252749..2e1a7eff573 100644 --- a/src/main/browser/cookies/browser-partition-cookie-copy.ts +++ b/src/main/browser/cookies/browser-partition-cookie-copy.ts @@ -15,12 +15,10 @@ import type { CookieClearIdentity } from './storage/cookie-store-contracts' import { isNonTransplantableCookieDomain } from './policy/cookie-import-exclusions' import { normalizeCookieDomain } from './policy/cookie-domain' -export type BrowserPartitionCookieCopyCounts = WslMoveBrowserCookieCopyCounts - export type BrowserPartitionCookieCopyPlan = { writes: CookieClearIdentity[] /** Skip and reject counts; the copy adds the write results. */ - counts: BrowserPartitionCookieCopyCounts + counts: WslMoveBrowserCookieCopyCounts } /** Pure: what to write from `source` into a jar that already holds `destination`. */ @@ -76,7 +74,7 @@ export function planBrowserPartitionCookieCopy( export async function copyBrowserPartitionCookies( sourcePartition: string, destinationPartition: string -): Promise { +): Promise { if (sourcePartition === destinationPartition) { throw new Error('browser_partition_cookie_copy_same_partition') }