Repository navigation
Fix browser login popups and menu actions in native windows - #28474
Conversation
e7c946c to
ce56cbe
Compare
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
09ffeee9-8eea-46aa-b8fe-eda35c724cf3
📒 Files selected for processing: 29
config/scripts/vitest-node-runtime-files.mjssrc/main/browser/browser-guest-input-gesture.tssrc/main/browser/browser-manager-guest-popup-policy.tssrc/main/browser/browser-manager-navigation.tssrc/main/browser/browser-manager-popup-openerless-tab.test.tssrc/main/browser/browser-manager-popup-routing.test.tssrc/main/browser/browser-popup-background-cdp-probe.tssrc/main/browser/browser-popup-background-compatibility.electron.test.tssrc/main/browser/browser-popup-compatibility-cdp-fixture.tssrc/main/browser/browser-popup-compatibility-electron-fixture.tssrc/main/browser/browser-popup-compatibility.electron.test.tssrc/main/browser/browser-popup-native-compatibility.electron.test.tssrc/main/browser/browser-popup-native-electron-fixture.tssrc/main/browser/browser-popup-native-window.test.tssrc/main/browser/browser-popup-native-window.tssrc/main/browser/browser-popup-new-tab-intent.test.tssrc/main/browser/browser-popup-new-tab-intent.tssrc/main/browser/browser-route-guest-lifecycle.tssrc/main/browser/browser-route-guest-popups.test.tssrc/main/browser/browser-route-guest-popups.tssrc/main/browser/browser-route-webcontents-registry.tssrc/main/browser/native-browser-popup-windows.tssrc/main/browser/popup-origin-bar-window.test.tssrc/main/browser/popup-origin-bar-window.tssrc/main/menu/app-menu-selection-item.tssrc/main/menu/register-app-menu.test.tssrc/main/menu/register-app-menu.tssrc/main/startup/main-window-actions-menu-target.test.tssrc/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.
abe017f to
f5e3b9b
Compare
- 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.
f544438 to
a3009fc
Compare
…#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)
* 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)
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.
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.tsandbrowser-route-guest-popups.tsnow use a shared rule inbrowser-popup-new-tab-intent.tsto decide between tab and child window, including OAuth authorization URLs and POST bodies. Newbrowser-popup-native-window.tshandles native pop-ups.popup-origin-bar-window.tsdiscards rejected content with a navigation veto instead of a plain close.register-app-menu.ts,app-menu-selection-item.ts, andmain-window-actions.tsroute 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:
TODO: Record which platforms were manually tested (macOS / Linux / Windows / SSH).
AI Disclosure
TODO: Fill in if an AI model was used.
Review
Agent skill upstream boundary
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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)