Skip to content

fix(extensions): honor transient popup dismissal - #35360

Merged
OrcaWin merged 3 commits into
mainfrom
OrcaWin/extension-action-popup-close-veto-independent
Oct 29, 2026
Merged

OrcaWin merged 3 commits into
mainfrom
OrcaWin/extension-action-popup-close-veto-independent

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16

An extension action popup can veto BrowserWindow.close() through beforeunload after Orca has already cleared its owner. Repeated toggle/replace actions then leave live, untracked native popup windows. Permit the existing close sequence to proceed when these transient popups emit will-prevent-unload.

The handler reuses the guest allowPageUnload policy and is registered only on each action popup's own WebContents (a fresh BrowserWindow per open, so it never reaches tabs, the main window or other extension pages, and it goes away with the popup). Normal beforeunload and unload callbacks still run. Existing close routing, replacement identity checks, geometry and ordinary browser/main-window policies use their current implementations. This defect is pre-existing since #30940.

Real hidden Electron 43.8.1 windows with a locally loaded MV3 extension reproduce 1/1 and 10/10 abandoned popup windows on base; the change leaves zero and observes all 1/10 normal unload callbacks. Seven native scenarios cover healthy close, toggle, replacement identity, and the actual registered Escape/blur handlers. Five regression postconditions fail on base and pass with the proposal. Escape/blur are controlled event emissions; physical keyboard/focus delivery is not claimed. Both native arms exit 0, remove owned profiles/descendants and leave zero windows.

In-repo coverage: the native toolbar fixture (browser-extension-toolbar.electron.test.ts, real hidden Electron) now opens a popup whose page vetoes unload after a user gesture and asserts the popup window is destroyed on dismissal. It fails on base (popup never closes) and passes with the handler. The 1/10 abandoned-window counts above come from out-of-tree audit artifacts, not from in-repo tests.

ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 passed on the author head before review (19/19 checks, 385.9s, 29d7927 vs bbd635e). It was re-run on the rebased head with the reuse refactor and test: 21/21 checks passed in 930.7s on d75f4d0 (vs origin/main 601bf63), with the Linux native fixture on an isolated Xvfb display.

The native proof uses the actual popup-host module with a real hidden parent and a presentation seam that forbids showing or focusing windows. It is lifecycle evidence, with no rendered Orca flow/screenshot, CPU, heap-byte, latency, visible desktop or native macOS/Windows claim. The change has no remote wire, mobile or git/folder-workspace assumptions.

Evidence: /home/neil/.local/state/orca-electron-audit/extension-action-popup-close-veto-candidate/report.md, before/after results, source manifests and artifact seal; author validation logs and commit bundle in implementation/.

@OrcaWin
OrcaWin force-pushed the OrcaWin/extension-action-popup-close-veto-independent branch from 29d7927 to d75f4d0 Compare October 29, 2026 01:48
@OrcaWin
OrcaWin marked this pull request as ready for review October 29, 2026 01:48
@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 49787805-bf09-4697-9c9e-c9c0d142b28b
Commits

Reviewing files that changed from the base of the PR and between f5c84ea and d75f4d0.

Files selected for processing: 3
  • src/main/browser/extensions/browser-extension-popup-host.ts
  • src/main/browser/extensions/browser-extension-toolbar-electron-fixture.ts
  • src/main/browser/extensions/browser-extension-toolbar.electron.test.ts
  • 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.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Action popups now use allowPageUnload so a page cannot block dismissal through beforeunload.

  • Extension action popups close when their pages veto unloading.

Reviews (1) · Last reviewed commit: "test(extensions): cover action popup clo..." · Reviewed by Greptile

@OrcaWin
OrcaWin merged commit cb49a37 into main Oct 29, 2026
83 of 85 checks passed
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