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
Closing pages with nested frames leaves stale frame ownership references #3240
A reused browser context retains references to closed pages through its child-frame ownership map. Repeatedly opening and closing pages with nested frames accumulates stale entries.
Inspect the extension's internal BrowserContext.frameOwnerPage map after page-close cleanup, or take a heap snapshot and inspect retained closed Page instances.
For a deterministic internal reproduction, register a page with a main frame, child frame, and grandchild frame; populate their ownership entries; then call cleanupByTarget for that page. Repeat 100 times.
Actual behavior
The internal cleanup fixture retained 200 stale child-frame ownership entries after closing 100 pages with two descendant frames each.
Removing a nested frame subtree can also leave descendant ownership and cached-frame entries behind.
Expected behavior
Closing a page should remove ownership entries for every frame belonging to it. Removing a frame subtree should clear all removed descendants and associated caches.
Pages still open in the context should retain their entries. Frame process swaps should preserve ownership needed by the replacement session.
Context shutdown should dispose page listeners and finish clearing bookkeeping even if an individual cleanup operation fails.
@vishalanton16, thanks for the deterministic breakdown. If you are not already preparing the fix, I would like to take this. I would first reproduce it with the internal fixture, then make cleanup remove descendant frame ownership and associated caches while preserving live pages and process swaps. Tests would cover page closure, nested subtree removal, repeated open and close cycles, and cleanup after a partial failure. Does that scope fit?
Activity
oliarmak-web commentedon Oct 19, 2026
@vishalanton16, thanks for the deterministic breakdown. If you are not already preparing the fix, I would like to take this. I would first reproduce it with the internal fixture, then make cleanup remove descendant frame ownership and associated caches while preserving live pages and process swaps. Tests would cover page closure, nested subtree removal, repeated open and close cycles, and cleanup after a partial failure. Does that scope fit?