You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New Persistent Context indexes only the first page, and a failed close leaves the persistent context open #5324
Describe the bug
Two bugs in how Browser handles a persistent context. Both are fixed in #5318.
Only the first page is indexed.New Persistent Context indexed only the first page the context starts with (context.pages()[0]). If the persistent context opened several pages, for example from a restored session, Browser did not know the other pages. Get Page Ids did not list them, and Switch Page could not switch to them.
A failed close leaves the context and its browser on the stack. When closing a persistent context failed, closeContext neither removed the context nor closed the browser that holds it. The browser was also closed without waiting for it, so the keyword could return before the browser was closed.
New Persistent Context indexes every page the context starts with. The first page is still the active page.
closeContext closes the browser of a persistent context in a finally block and waits for it, so the browser is removed from the stack even if closing the context fails.
Release notes
These are behaviour changes for persistent contexts:
Get Page Ids lists all pages a persistent context starts with, not only the first.
When closing a persistent context fails, its browser is still closed and removed.
Found while reviewing #5318 (adoptContext, #5317), which uses the same code for adopted contexts.
Activity
aaltat commentedon Oct 11, 2026
#5318 is merged, closing the issue.