Repository navigation
fix(browser): label popups from committed document origins - #30540
Conversation
ca92669 to
094481c
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:
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · 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:
d149ba9c-a13e-4ac2-b18c-45db11e59d92
📥 Commits
Reviewing files that changed from the base of the PR and between feba21d and aa326a31760e05130027d9c4afd57eb19b41c2b7.
📒 Files selected for processing: 21
.github/workflows/pr.ymlconfig/scripts/ci-unit-files.mjsconfig/scripts/pr-package-test-paths.mjsconfig/scripts/vitest-node-runtime-files.mjsdocs/review-evidence/youtube-popup-origin-preparation/PR_BODY.mddocs/review-evidence/youtube-popup-origin-preparation/README.mdsrc/main/browser/browser-link-materialization-electron-fixture.tssrc/main/browser/browser-link-materialization.electron.test.tssrc/main/browser/browser-popup-background-cdp-probe.tssrc/main/browser/browser-popup-native-compatibility.electron.test.tssrc/main/browser/browser-popup-native-window.test.tssrc/main/browser/browser-popup-native-window.tssrc/main/browser/popup-committed-document-url.tssrc/main/browser/popup-identity-electron-probe.tssrc/main/browser/popup-origin-bar-window.test.tssrc/main/browser/popup-origin-bar-window.tssrc/main/browser/popup-origin-chrome-electron-fixture.tssrc/main/browser/popup-origin-chrome.electron.test.tssrc/main/browser/popup-origin-description.tssrc/renderer/src/hooks/ipc-events/browser-link-materialization-probe.tsxsrc/renderer/src/hooks/ipc-events/browser-state-open-link-profile.test.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.
aa326a3 to
7c8b8e7
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Prevent page titles from replacing the committed-origin… · popup-origin-bar-window.ts:247-252
src/main/browser/popup-origin-bar-window.ts:247-252
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPrevent page titles from replacing the committed-origin title.
When a committed page emits
page-title-updated,handlePageTitleUpdatedcallswindow.setTitle(title). This replaces the title derived from the committed document origin, while the origin bar still shows the committed origin. Prevent the event before setting the title from page content.Suggested fix
- const handlePageTitleUpdated = (_event: Electron.Event, title: string): void => { + const handlePageTitleUpdated = (event: Electron.Event, title: string): void => { + event.preventDefault() if (!window.isDestroyed() && title && currentUrl !== 'about:blank') { window.setTitle(title) }
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3b6cd271-6184-4947-a905-2683a3cbd1d7
📥 Commits
Reviewing files that changed from the base of the PR and between 7c8b8e7471cbb645a12c38a382195819c4414120 and a46e3e7680e221eebe980e038d8a6cc6996e81aa.
📒 Files selected for processing: 2
src/main/browser/popup-identity-electron-probe.test.tssrc/main/browser/popup-identity-electron-probe.ts
🚧 Files skipped from review as they are similar to previous changes: 1
- src/main/browser/popup-identity-electron-probe.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
a46e3e7 to
5be5857
Compare
|
@coderabbitai Fixing. Will be in the next commit |
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/main/browser/popup-origin-chrome.electron.test.ts: 1
177-177: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winWait for each held request before asserting retention.
page.evaluateschedules/hold-initial, and the fixture startsloadURLwithout awaiting it. The redirect path also startsloadURLwithout waiting for/hold-redirect. Therefore,expectOrigincan observe the previous label before the held request begins, andstop()can run without testing a pending navigation.Track the request count before each navigation and wait for it to increase before the assertion.
Suggested synchronization
+ const initialHeldCount = requestedPaths.filter( + (path) => path === '/hold-initial' + ).length await page.evaluate((url) => { const child = window.open('about:blank', '', 'width=600,height=400') @@ child.location.href = url }, `${origin}/hold-initial`) + await expect + .poll( + () => requestedPaths.filter((path) => path === '/hold-initial').length, + { timeout: 10_000 } + ) + .toBeGreaterThan(initialHeldCount) const initial = await expectOrigin('about:blank', kind) @@ expect(requestedPaths).not.toContain('/blocked') await command('navigate', { url: `${origin}/committed` }) await expectOrigin(origin, kind) const otherOrigin = origin.replace('127.0.0.1', 'localhost') + const redirectHeldCount = requestedPaths.filter( + (path) => path === '/hold-redirect' + ).length await command('navigate', { url: `${otherOrigin}/redirect` }) + await expect + .poll( + () => requestedPaths.filter((path) => path === '/hold-redirect').length, + { timeout: 10_000 } + ) + .toBeGreaterThan(redirectHeldCount) await expectOrigin(origin, kind)
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9209ebbb-93f3-4e29-8250-9153b65003b5
📥 Commits
Reviewing files that changed from the base of the PR and between a46e3e7680e221eebe980e038d8a6cc6996e81aa and 5be58579f17ae10e7d367eb8313a1713dc2a73e5.
📒 Files selected for processing: 1
src/main/browser/popup-origin-chrome.electron.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
Tip For best results, initiate chat on the files or code changes. @AmethystLiang Thanks for the update. The finding remains open pending the next commit. You are interacting with an AI system. |
5be5857 to
5244266
Compare
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:
5b40c610-c970-4b10-bf09-eb7be604de94
📥 Commits
Reviewing files that changed from the base of the PR and between 5be58579f17ae10e7d367eb8313a1713dc2a73e5 and 5244266.
📒 Files selected for processing: 10
src/main/browser/browser-manager-guest-popup-policy.tssrc/main/browser/browser-popup-adapter-probe-fixture.tssrc/main/browser/browser-popup-native-window.test.tssrc/main/browser/browser-popup-native-window.tssrc/main/browser/browser-route-guest-popups.tssrc/main/browser/popup-committed-origin.tssrc/main/browser/popup-origin-bar-window.test.tssrc/main/browser/popup-origin-bar-window.tssrc/main/browser/popup-origin-chrome-electron-fixture.tssrc/main/browser/popup-origin-chrome.electron.test.ts
💤 Files with no reviewable changes: 3
- src/main/browser/browser-manager-guest-popup-policy.ts
- src/main/browser/browser-popup-adapter-probe-fixture.ts
- src/main/browser/browser-route-guest-popups.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
@coderabbitai Fixing. Will be in the next commit |
|
Tip For best results, initiate chat on the files or code changes. @AmethystLiang Thanks for the update. The finding remains open until the fix is complete. You are interacting with an AI system. |
ELI5
A popup could show the site it intended to load while an opener-written blank page was still running. Both popup presenters now start at
about:blankand show an origin only after a document commits. An opaque error page stays neutral even when Electron retains the failed HTTPS URL.What Changed
The origin bar and native window title read the committed main frame and its security origin. Pending or canceled navigation retains the prior label; page-controlled titles cannot replace the native trust title. Both presenters reuse the existing origin formatter.
Added hidden Electron checks and a harness using the production preload subscription, renderer bridge, store, and mounted browser guest. The harness records current profile-handoff failures for the dependent repair.
Why
The requested URL and load-completion events cannot establish which document is running. Reading committed frame state preserves the original popup and its settings while preventing an uncommitted destination or opaque error page from borrowing a site's label.
Linked Issue
Internal YouTube Studio reauthentication investigation; no existing issue was supplied for this preparation.
Visual Proof
Actual candidate origin-bar renderers captured through CDP, with every window hidden. A baseline screenshot is unavailable; baseline initialization from the requested URL is source-backed.
Pending navigation:
Committed origin:
Opaque error document:
Native title checks use hidden main-process snapshots.
Testing
Detailed commands, observations, tested scope and limits: preparation evidence.
Review
This implements the committed-origin portion of the design. The opener-preservation, routing, ownership-lifetime and tab-handoff repair remains blocked by the prerequisite findings in #30537. The YouTube routing defect remains present, and a fresh YouTube challenge has not been validated.
The harness deliberately records three unsafe baseline profile cases; they are not passing repair gates. It starts at synthetic main dispatch and does not prove modifier association or first-navigation authorization.
Agent skill upstream boundary
Notes
The existing Linux Electron boundary job includes the new suites, with aggregate/check names preserved. Linux/Windows runtime, SSH/server-hosted authentication, full CI/build and visible/native-focus behavior remain unverified locally. No remote protocol or persistence format changed.
Checklist