fix(server): dispose temporary iframe element handles after hit-target checks - #42655
Conversation
| await page.evaluate(() => document.querySelector('iframe')!.remove()); | ||
| // Move the mouse away to release Chromium's own last-hovered-node retention. | ||
| await page.mouse.move(500, 500); | ||
| const session = await page.context().newCDPSession(page); |
There was a problem hiding this comment.
You can do page.requestGC everywhere.
There was a problem hiding this comment.
Done — switched to page.requestGC() and dropped the chromium-only skip, so the test runs on all browsers now. Verified locally on chromium and firefox; webkit via CI.
|
Ashraf Ali (@ashrafiucse) I enabled using notation for convenience and removed one of the disposes from your patch to avoid conflict. I'm not sure it'll rebase it though and make the test pass. You might need to push a rebase. Sorry for trouble. |
…t checks ElementHandle._checkFrameIsHitTarget and FrameSession._framePosition create temporary iframe element handles via DOM.resolveNode and never dispose them, so Chromium retains detached iframes after clicks inside frames. Dispose them in finally, covering early returns and exceptions. Fixes: microsoft#42653
e9bc08e to
43e12f4
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Test results for "tests 1"5 flaky51551 passed, 1247 skipped Merge workflow run. |
Test results for "MCP"2 failed 8346 passed, 1376 skipped Merge workflow run. |
b99b75d
into
microsoft:main
ElementHandle._checkFrameIsHitTarget(including early-return and exception paths) and inFrameSession._framePosition, so Chromium does not retain detached iframes after clicks inside framesDiagnosis and reproduction in the issue by Jan Doležel (@dolezel).
Fixes #42653