Skip to content

Fix browser login popups and menu actions in native windows - #28474

Merged
AmethystLiang merged 12 commits into
mainfrom
browser-login-compatibility
Oct 14, 2026
Merged

AmethystLiang merged 12 commits into
mainfrom
browser-login-compatibility

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1989 $\color{#cf222e}{\Huge{\mathbf{−}}}$​28 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1961
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1516 $\color{#cf222e}{\Huge{\mathbf{−}}}$​103 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1413

Problem

Some websites sign you in with a pop-up window, like "Sign in with Google". In Orca's embedded browser, these sign-in pop-ups often broke. Some opened the wrong way, some lost the page's connection to the window that opened them, and some ended up without a working session. Copy, paste, and Select All in the Edit menu could also act on the wrong surface when a pop-up was focused.

Solution

In plain terms: Orca now sorts each pop-up request into one of three paths, and each path keeps the parts the sign-in flow needs.

  • Sign-in and other links that do not need the old page open as normal Orca tabs.
  • Sign-in pop-ups that need to talk back to the page that opened them stay real child windows, so the handshake still works.
  • Native pop-ups (for example a Shift-click POST or a background-tab open) are created as real windows. Orca attaches its security rules before the page starts loading, and fails closed if that setup cannot finish.

The Edit menu and Help menu actions now target the focused native pop-up, or the main Orca window, instead of the wrong renderer.

Mechanism: browser-manager-guest-popup-policy.ts and browser-route-guest-popups.ts now use a shared rule in browser-popup-new-tab-intent.ts to decide between tab and child window, including OAuth authorization URLs and POST bodies. New browser-popup-native-window.ts handles native pop-ups. popup-origin-bar-window.ts discards rejected content with a navigation veto instead of a plain close. register-app-menu.ts, app-menu-selection-item.ts, and main-window-actions.ts route menu actions to the right window.

Why

A plain "open as tab" fixes most links, but it breaks OAuth. The page that opened a sign-in window needs to keep its handle to that window, and a tab cannot provide it. A plain "always child window" keeps OAuth working but makes ordinary links open clutter windows. The split above keeps each flow on the path it needs.

Linked Issue

TODO: No issue is linked. Add one if this PR needs it.

Fixes #

Visual Proof

TODO: Attach before and after captures for the pop-up and Edit menu behavior. Videos are preferred.

Testing

Automated tests were added or updated, but they have not been run as part of writing this description. Coverage includes:

  • Unit tests for popup routing, OAuth detection, native pop-up admission, origin-bar behavior, route pop-up ownership, and the menu target.
  • Hidden Electron CDP tests for popup compatibility: OAuth and blank handles, POST and multipart bodies, cookie jars, background-tab and Shift-click behavior, and fail-closed creation.

TODO: Record which platforms were manually tested (macOS / Linux / Windows / SSH).

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

TODO: Fill in if an AI model was used.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security, cross-platform (Linux, Windows, macOS), remote SSH, mobile, backwards compatibility, and performance still need review. The native pop-up path and the new Electron tests depend on platform-specific display behavior.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@AmethystLiang
AmethystLiang force-pushed the browser-login-compatibility branch from e7c946c to ce56cbe Compare October 13, 2026 23:46
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6d78077-3b83-427b-8c94-6f6432015896
📥 Commits

Reviewing files that changed from the base of the PR and between abe017f and f5e3b9b.

📒 Files selected for processing: 1
  • config/scripts/vitest-node-runtime-files.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

Popup handling now classifies requests by URL, disposition, and POST body. Route and native popup paths add checks for gestures, navigation authority, child creation, and content preparation. New Electron and CDP fixtures exercise popup behavior, request metadata, and child-window lifecycle. Menu actions also handle native browser popup windows explicitly.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to f5e3b

The added compatibility suites have their stated WebSocket prerequisite on the supported Node runtime. No concrete merge-blocking issue is established by the reviewed change.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the problem, solution, rationale, implementation, and test coverage. However, required information is incomplete: no linked issue is provided, visual proof is still marked TOD… Add a real issue link after “Fixes #”. Attach before-and-after screenshots or videos, or provide the required N/A explanation if applicable. Report manual testing for relevant platforms and environments. Complete the AI Disclosure, Review, …
Docstring Coverage Warning Docstring coverage is 20.34% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 30 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the main changes: browser login popup handling and menu actions in native windows.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, rationale, implementation, and test coverage. However, required information is incomplete: no linked issue is provided, visual proof is still marked TODO for behavior and menu changes, manual platform testing is not reported, and several checklist items remain unchecked.

Resolution

Add a real issue link after “Fixes #”. Attach before-and-after screenshots or videos, or provide the required N/A explanation if applicable. Report manual testing for relevant platforms and environments. Complete the AI Disclosure, Review, Notes, and remaining checklist items, including validation of lint, typecheck, tests, and build.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 09ffeee9-8eea-46aa-b8fe-eda35c724cf3
📥 Commits

Reviewing files that changed from the base of the PR and between 8b0fa15 and ce56cbe.

📒 Files selected for processing: 29
  • config/scripts/vitest-node-runtime-files.mjs
  • src/main/browser/browser-guest-input-gesture.ts
  • src/main/browser/browser-manager-guest-popup-policy.ts
  • src/main/browser/browser-manager-navigation.ts
  • src/main/browser/browser-manager-popup-openerless-tab.test.ts
  • src/main/browser/browser-manager-popup-routing.test.ts
  • src/main/browser/browser-popup-background-cdp-probe.ts
  • src/main/browser/browser-popup-background-compatibility.electron.test.ts
  • src/main/browser/browser-popup-compatibility-cdp-fixture.ts
  • src/main/browser/browser-popup-compatibility-electron-fixture.ts
  • src/main/browser/browser-popup-compatibility.electron.test.ts
  • src/main/browser/browser-popup-native-compatibility.electron.test.ts
  • src/main/browser/browser-popup-native-electron-fixture.ts
  • src/main/browser/browser-popup-native-window.test.ts
  • src/main/browser/browser-popup-native-window.ts
  • src/main/browser/browser-popup-new-tab-intent.test.ts
  • src/main/browser/browser-popup-new-tab-intent.ts
  • src/main/browser/browser-route-guest-lifecycle.ts
  • src/main/browser/browser-route-guest-popups.test.ts
  • src/main/browser/browser-route-guest-popups.ts
  • src/main/browser/browser-route-webcontents-registry.ts
  • src/main/browser/native-browser-popup-windows.ts
  • src/main/browser/popup-origin-bar-window.test.ts
  • src/main/browser/popup-origin-bar-window.ts
  • src/main/menu/app-menu-selection-item.ts
  • src/main/menu/register-app-menu.test.ts
  • src/main/menu/register-app-menu.ts
  • src/main/startup/main-window-actions-menu-target.test.ts
  • src/main/startup/main-window-actions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@AmethystLiang
AmethystLiang force-pushed the browser-login-compatibility branch 2 times, most recently from abe017f to f5e3b9b Compare October 14, 2026 04:49
- 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.
- 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.
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.
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.
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.
@AmethystLiang
AmethystLiang force-pushed the browser-login-compatibility branch from f544438 to a3009fc Compare October 14, 2026 06:09
@AmethystLiang
AmethystLiang enabled auto-merge (squash) October 14, 2026 06:09
@AmethystLiang
AmethystLiang merged commit d8458f1 into main Oct 14, 2026
25 of 27 checks passed
registered2nd pushed a commit to registered2nd/orca that referenced this pull request Oct 14, 2026
…#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.

(cherry picked from commit d8458f1)
brennanb2025 pushed a commit that referenced this pull request Oct 15, 2026
* 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.

(cherry picked from commit d8458f1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant