Files
orca/config/scripts/vitest-node-runtime-files.mjs
T
Jinjing d8458f14f5 Fix browser login popups and menu actions in native windows (#28474)
* fix(browser): preserve unnamed OAuth login popups

* fix(browser): preserve form and blank popup sessions

* Preserve native request context for Shift popup navigation

* Validate route popups with production policy attachment order

* Fix browser background modifier request continuation

* Route opener-less OAuth popups to Orca tabs and fix menu targets in nati

- Plain links and Cmd/Ctrl+Shift-clicks open OAuth URLs as Orca tabs instead of native windows. Those popups have no opener, so they lose nothing by reloading the URL.
- Scripted popups that have an opener keep the existing origin-bar window, so their window.opener link still works.
- Discard pending popup contents with a navigation veto before closing, so a link's first request cannot reach the server.
- A POST with no page to hand over is still blocked, because reloading it by URL would drop its body.
- Edit, Help, and paste menu actions now target the main Orca window when a native browser popup has focus. The popup has no Orca renderer to receive those IPC messages.

* Cover opener-less OAuth popups and popup request provenance in tests

- Add Electron tests showing opener-less OAuth links open as local tabs without loading the discarded page, and that modifier-opened POSTs are never replayed.
- Add a test that a remote foreground modifier click keeps the native cross-site request context (cookies, referrer, fetch site).
- Add a test that the first adopted link request is blocked when route preparation fails during popup creation.
- Launch the CDP fixture through resolveElectronProbeLaunch so Linux runs use the display-aware launcher instead of a hardcoded xvfb-run.
- Replace `as` casts in the popup tests with typed declarations.

* Route Edit menu actions to native browser popups

Copy, Paste, and Select All from the app menu did nothing when a native
browser popup was focused. The popup has no Orca renderer to receive the
IPC, so the action was dropped. Those actions now go to the focused web
contents, falling back to the popup's own contents, so they reach the page
the user is in.

Also removes the popup request-provenance Electron test, which is no longer
part of this change.

* Fix static analysis failures in browser popup handling

* Handle unavailable permission probe in browser popup fixture

* Admit script-opened native popups and enforce minimum size

Modifier-clicked `window.open` children from page scripts reach Electron after the opener's first task, so the one-shot admission lapsed and they were left unprepared. Their first request then lacked popup context, and the origin title could be hidden by a hostile page title.

- Keep a per-opener pending admission that answers the next native child the opener reports. Unadmitted native children are discarded rather than left as bare windows.
- Route popup children through the contents whose window-open handler answered, since Electron reports script-opened children to that contents.
- Create native popups content-sized with a 360x200 minimum, matching origin-bar popups, so `resizeTo` cannot shrink the origin title out of view. The limits move to `popup-window-minimum-size.ts` so both paths share them.
- Tests: cover scripted admission timing, unadmitted discard, minimum size, and route popup caps. Fixture waits for hidden iframe loads and polls with a longer timeout for CI.

* Prime hidden Linux OOPIF hit testing for all opaque popups

The popup compatibility test clicked a frame gesture target only for the "route" case when the input was opaque. Hidden Linux OOPIFs need that priming click before hit testing works, and the route's root gesture gate depends on it too. Other opaque cases were skipping it and could fail for the same reason.

Apply the priming click to every opaque case and correct the comment to describe the real reason.
2026-10-13 23:37:47 -07:00

117 lines
6.8 KiB
JavaScript

import { SQLITE_RUNTIME_INCLUDE } from './vitest-sqlite-runtime-files.mjs'
// SQLite publication, native bindings, worker IPC, socket liveness, and V8 retention use Node.
export const NODE_RUNTIME_INCLUDE = [
'config/scripts/vitest-sqlite-runtime-boundary.test.ts',
'config/scripts/cloud-security-history-workflow.test.mjs',
'config/scripts/skill-recipe-shell.test.mjs',
'src/main/ssh/ssh-relay-endpoint-incumbent-shell.integration.test.ts',
'src/main/ssh/ssh-remote-commands.test.ts',
'src/packages/process-host/src/run-process.test.ts',
'tests/e2e/cursor-quota-transport.unit.test.ts',
'tests/e2e/helpers/electron-process-shutdown.unit.test.ts',
'src/main/ai-vault-search/session-search-index-writer.test.ts',
'src/main/ai-vault/session-scanner-unlimited-dedup.test.ts',
// Disk checkpoints require Node's iterable writeFile semantics.
'src/main/ai-vault/session-parse-cache-checkpoint.test.ts',
'src/main/ai-vault/session-parse-cache-save-lane.test.ts',
'src/main/ai-vault/session-parse-cache-metadata-checkpoint.test.ts',
// Electron main bridges streams with Node's implementation.
'src/main/host/electron-http-client.test.ts',
'src/main/daemon/daemon-init-provider-installation.test.ts',
'src/renderer/src/components/terminal-pane/pty-input-write-queue.test.ts',
'src/renderer/src/lib/react-commit-cascade-observer.test.ts',
'src/renderer/src/lib/react-commit-cascade-telemetry.test.ts',
...SQLITE_RUNTIME_INCLUDE,
'src/cli/**/*.test.ts',
'src/main/persistence/**/*.test.ts',
'src/main/persistence*.test.ts',
'src/main/sqlite/**/*.test.ts',
'src/main/orca-profiles/**/*.test.ts',
'src/main/managed-data-accounts/**/*.test.ts',
'src/main/quit-path-durable-write-blocking.test.ts',
'src/main/automations/automation-worker-durability.test.ts',
'src/**/*.node-pty.test.ts',
'src/**/node-pty-*.test.ts',
'src/**/*.live-shell.test.ts',
'src/**/*real-pty*.test.ts',
'src/**/*-native.test.ts',
'src/**/*retention*.test.ts',
'src/**/*lifetime*.test.ts',
'src/**/*memory*.test.ts',
'src/**/*allocation*.test.ts',
'src/**/*expiry*.test.ts',
'src/renderer/src/lib/flatten-retained-slice.test.ts',
'src/shared/own-retained-string.test.ts',
// Times V8 string flattening, which is what Electron main runs.
'src/main/runtime/terminal-tail-redraw-wall-time.test.ts',
'src/main/agent-hooks/server-transport-interference.test.ts',
'src/main/plugins/plugin-worker-supervision.integration.test.ts',
'src/main/usage/usage-scan-worker-event-loop.test.ts',
// Asserts Node's spawn-failure close signal and that a dead worker closes its children's pipes.
'src/main/worker-thread-child-process/worker-thread-child-process.test.ts',
'src/main/computer/macos-native-provider-client.test.ts',
'src/main/ai-vault-search/session-search-schema.test.ts',
'src/main/ai-vault-search/session-search-fts5-contract.test.ts',
'src/main/foreign-sqlite-readers/**/*.test.ts',
'src/main/browser/*cookie*.test.ts',
// Playwright's CDP transport needs Node's WebSocket implementation.
'src/main/browser/browser-popup-compatibility.electron.test.ts',
'src/main/browser/browser-popup-native-compatibility.electron.test.ts',
'src/main/browser/browser-popup-background-compatibility.electron.test.ts',
'src/main/ai-vault/session-scanner-devin-db.test.ts',
'src/shared/workspace-session-salvage.test.ts',
'src/main/git/repo-detection.test.ts',
'src/renderer/src/components/browser-pane/annotate/browser-grab-toast-owner-cleanup.test.tsx',
'src/main/window/native-chat-paste-files.test.ts',
'src/main/computer/desktop-script-serve-channel.test.ts',
'src/main/providers/local-pty-child-process-verdict.test.ts',
'src/main/providers/working-directory-validation.test.ts',
'src/main/pty/posix-pty-process-groups.integration.test.ts',
'src/shared/ephemeral-vm-recipe-output-capture.test.ts',
'src/main/gitlab/gitlab-known-host-retirement.test.ts',
'src/main/window/main-window-updater-deferred-setup.test.ts',
'src/renderer/src/lib/pane-manager/pane-dom-focus-class-sync-lifecycle.test.ts',
'src/renderer/src/components/terminal-pane/terminal-pane-host-state-memo.test.ts',
'src/renderer/src/components/automations/use-automation-runs-dashboard-payload.test.tsx',
'src/renderer/src/components/right-sidebar/parent-pr-checks-projection-selector.test.ts',
'src/renderer/src/store/github/cache-persistence.test.ts',
'src/main/native-chat/agent-session-journal/**/*.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-feed.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-conversation-name.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-status-first-input-identity.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-outgrown-child.test.ts',
'src/main/native-chat/agent-session-wire/structured-agent-session-permission-mode.test.ts',
'src/main/native-chat/structured-chat-naming-command-first.test.ts',
'src/main/native-chat/structured-chat-naming-status-hook.test.ts',
'src/main/runtime/agent-session-conversation-name-store.test.ts',
'src/main/runtime/structured-session-mail-redrive-wiring.test.ts',
'src/main/runtime/rpc/ws-transport.test.ts',
'src/main/runtime/rpc/dispatcher-transport-parity.test.ts',
// Bun resolves 'ws' to its built-in client, which bypasses the patched package.
'src/main/runtime/rpc/ws-empty-payload-frame-write.test.ts',
'src/shared/remote-runtime-client.test.ts',
'src/shared/remote-runtime-connect-bound.test.ts',
// Bun's built-in ws client ignores maxPayload; the product opener only runs on Node.
'src/shared/remote-runtime-request-websocket.test.ts',
'src/shared/remote-runtime-subscription-connect-bound.test.ts',
'src/main/codex/codex-shared-server-probe.test.ts',
'src/main/opencode/opencode-launch-model-context-supervision.test.ts',
'src/main/hermes/hermes-config-remote-adapter.test.ts',
'src/renderer/src/lib/monaco-languages/monarch-upstream-mdx-recursion.test.ts',
'src/main/ipc/orca-profiles-switch-persistence.test.ts',
'src/main/ipc/settings-delayed-response.test.ts',
'src/main/runtime/structured-agent-session-startup-tab-restore.test.ts',
'src/shared/remote-runtime-shared-control-connection.test.ts',
'src/main/runtime/relay/relay-control-client.test.ts',
'src/main/ipc/filesystem-watcher-ignore-real.test.ts',
'src/main/ipc/runtime-environment-preference.test.ts',
'src/main/ipc/runtime-environment-transport-routing-tailscale-hint.test.ts',
'src/renderer/src/components/emulator-pane/emulator-device-frame-visibility.test.tsx',
'src/main/claude/claude-agent-sdk-contract-pins.test.ts',
'config/scripts/profile-state-worker-smoke.test.mjs',
'config/scripts/process-host-dev-rebuild.test.ts',
'config/scripts/vitest-node-runtime-boundary.test.ts',
'config/scripts/vitest-node-runtime-pool.test.ts'
]