Repository navigation
fix: let adoptContext and Connect To Browser index contexts like New Context - #5370
Merged
Merged
Conversation
…Context - adoptContext gives the adopted context the default timeout of the extension call, so an extension no longer calls setDefaultTimeout itself. - adoptContext returns the video path of the active page as videoPath, so an extension no longer reads it from the page itself. - Connect To Browser indexes the pages that already exist in the connected browser with their close listener, so a closed page leaves the page stack instead of staying the active page. The last page stays active, as before. - New Context on a browser without a browser object says that its context is persistent or adopted. Fixes MarketSquare#5368 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d-biehl
pushed a commit
to robotcodedev/robotframework-electron-vscode
that referenced
this pull request
Oct 22, 2026
Browser registers an adopted context itself now, from the report that adoptContext writes on the stream of the extension call (MarketSquare/robotframework-browser#5372). It gives the context the library timeout, returns the video of its active page (MarketSquare/robotframework-browser#5370), and adoptContext takes the page to make active. electron.js passes the first window's own page as activePage, so Browser makes the window the active page, not a WebContentsView or <webview> that Playwright saw first, and reports the window's video. Start Electron Application no longer switches pages after the start and no longer calls register_adopted_context; it returns the page id and the video path that Browser reported. When the first window closes during the start, Browser keeps the page that Playwright saw first, and the returned video is that page's. Co-authored-by: Tatu Aalto <aalto.tatu@gmail.com>
d-biehl
added a commit
to d-biehl/robotframework-browser.org
that referenced
this pull request
Oct 22, 2026
…itself Browser now registers an adopted context from the report of the extension call (MarketSquare/robotframework-browser#5372), gives it the library timeout and returns the video of its active page (MarketSquare/robotframework-browser#5370), and adoptContext takes an activePage. The examples no longer set the timeout, read the video path or call register_adopted_context, and the page describes activePage, the registration and videoPath.
d-biehl
added a commit
to robotcodedev/robotframework-electron-vscode
that referenced
this pull request
Oct 23, 2026
MarketSquare/robotframework-browser#5372 replaced register_adopted_context before any release: call_js_keyword registers an adopted context from the report of the extension call. The background notes now say so, together with the timeout, the video and the activePage that adoptContext handles since MarketSquare/robotframework-browser#5370.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Node only, no proto change. A follow-up to #5318 and #5326, and the second step of moving the
registration of adopted contexts into Browser (#5369 was the first).
adoptContextnow does two things that every extension had to do itself:async function openAdoptedPersistentContext(..., playwright, adoptContext) { ... - context.setDefaultTimeout(defaultTimeout); return adoptContext(context, { onClose });Connect To Browser indexed the pages that already exist in the connected browser without their
closelistener (#5368). It now indexes each page through_newPage; the last page stays active,as before:
New Contexton a persistent or adopted browser says so:Fixes #5368
Evidence
browser, then
Switch Browserto the connected one:page.bringToFront: Target page, context or browser has been closed.After: the closed page leaves the page stack;
Get Page Idsreturns[].adoptContextreturns the video path of the active page;nullwithout video or pagesaddBrowserremoves a page that existed when the browser was connected once it closesaddBrowserindexes a page once when the context reports it while the browser is addedNew Contexton an adopted browser explains why it failsAn Adopted Context Gets The Library Timeoutand the recording tests from test: pin the video size of an adopted context through a library built on Browser #5369 now cover boththrough the extension call.
05_JS_Tests61/61;01_Browser_Managementpasses except twoFirefox tests whose browser fails to launch locally (CI runs them).
Merge Danger
Door: two-way
Blast Radius: Connect To Browser
adoptContextis unreleased, so its changes reach no users. Connect To Browser is released: aclosed page that existed at connect time no longer stays in the catalog or stays the active page.
The changed error message of
New Contextbreaks a test that matches the old text.🤖 Generated with Claude Code