Repository navigation
fix(ego-browser): map frames inside nested OOPIFs to their OOPIF session - #809
wuwei-citro[bot] wants to merge 13 commits into
Conversation
Under site isolation, Page.getFrameTree on a session lists only the frames its renderer hosts. ensureFrameSessions read only the top Page's frame tree, so a same-site iframe rendered inside an OOPIF (for example 127.0.0.1 -> localhost -> 127.0.0.1 -> 127.0.0.1:other-port) had no entry in the frame-to-session map. Snapshot refs in that frame were then sent to the Page session, and click/fill failed with "Node with given id does not belong to the document". Read each attached OOPIF's own frame tree as well, map its local frames to that OOPIF's session, and record their parents. Expand one OOPIF level at a time so an OOPIF whose parent frame is known only to another OOPIF is also discovered and attached. Co-Authored-By: Claude <noreply@anthropic.com>
Verification on
|
🤖 Codex Review ·
|
…t parentId Co-Authored-By: Claude <noreply@anthropic.com>
Review round 1
|
Verification on
|
🤖 Codex Review ·
|
…hild frames Frames inside an OOPIF now map to the OOPIF session, so pageContexts treated each local child as another root context of that session and unique locators matched twice. A frame whose parent maps to the same session now gets its own frame-scoped context. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 2
|
Verification on
|
🤖 Codex Review ·
|
…f an OOPIF Locator validation still expected an OOPIF-session frame to use the session's default context, so locators of elements in a same-process child of an OOPIF were rejected and stripped from snapshots. Share the root-versus-child decision between pageContexts and the validation check. Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Codex Review ·
|
Verification on
|
…n OOPIF Input for a frame inside an OOPIF goes to the OOPIF session, whose viewport is the OOPIF root. A same-process child frame's local point must therefore be offset by its iframe box in that session, as frames of the Page session already are; otherwise a click lands at the child-local coordinates in the OOPIF root. The agent cursor now starts from that session-root point too. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 3
|
Verification on
|
🤖 Codex Review ·
|
… an OOPIF Co-Authored-By: Claude <noreply@anthropic.com>
Review round 4
|
Verification on
|
🤖 Codex Review ·
|
…frame inside an OOPIF When an OOPIF hosts nested same-process frames, the AX tree of an outer frame can also list a descendant frame's nodes. Dedupe now keeps the match whose owning frame is deepest in the parent map, so pointer offsets use the node's own iframe. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 5
|
Verification on
|
🤖 Codex Review ·
|
… validating snapshot locators Co-Authored-By: Claude <noreply@anthropic.com>
Review round 6
|
Verification on
|
🤖 Codex Review ·
|
… cannot spend the action budget Co-Authored-By: Claude <noreply@anthropic.com>
Review round 7
|
Verification on
|
🤖 Codex Review ·
|
… and cap OOPIF discovery to half the budget A frame whose isolated world cannot be created no longer aborts resolution before the Page document is searched; its FrameNotReadyError surfaces only when that frame has to be searched, and waits for hidden or detached retry it instead of reading it as absence. Optional OOPIF frame-tree discovery now shares one budget of at most 1s and at most half of what is left. Co-Authored-By: Claude <noreply@anthropic.com>
Review round 8
|
Verification on
|
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # package/ego-browser/src/snapshot-result.test.mjs Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Resolved in merge commit |
🤖 Codex Review ·
|
Problem
CITRO-5635: snapshot refs for elements in a same-site iframe nested inside a cross-site iframe (e.g.
127.0.0.1->localhost->127.0.0.1->127.0.0.1:other-port) appear correctly inpage.snapshot(), butpage.click()/page.fill()on them fail withNode with given id does not belong to the document.Under site isolation,
Page.getFrameTreeon a session lists only the frames its renderer hosts.ensureFrameSessionsread only the top Page's frame tree, so the innermost frame, which is rendered inside the middle OOPIF and has no target of its own, had no entry in the frame-to-session map. Ref resolution then fell back to the Page session, where that node id does not exist.Fix
ensureFrameSessions(browser-runtime.ts) now also reads each attached OOPIF's own frame tree. It maps that OOPIF's local frames to the OOPIF's session and records their parent frame ids, which the OOPIF cursor ancestry uses. Discovery expands one OOPIF level at a time, so an OOPIF whose parent frame is known only to another OOPIF is also found and attached. A failed frame-tree read for one OOPIF is skipped: the OOPIF itself stays mapped, as it was before. Element resolution and page actions are unchanged because they already look up the frame's session in this map.Verification
browser-runtime.test.mjssets up the ticket's layout with per-session frame trees: top -> runner OOPIF -> middle OOPIF -> leaf (same-process child), plus an OOPIF below the leaf. With the expansion disabled, the test fails because the leaf has no session. With the fix, the leaf maps to the middle OOPIF's session, and the deeper OOPIF is attached with the correct parent.npm --prefix package/ego-browser test: 672/672 pass; typecheck and the Prettier check are clean.npm run e2e) was not run here because no ego runtime was available.🤖 Generated with Claude Code