Repository navigation
Conversation
The drag handler resolved both element handles before the try/finally: fromHandle, then toHandle. If getElementByUid(to_uid) threw - which it does for a stale or invalid to_uid - the try was never entered, so fromHandle was never disposed, leaking a remote object for the life of the page's execution context. Acquire toHandle inside a nested try so fromHandle is disposed on every path. Adds a regression test that fails on the previous behavior. Fixes ChromeDevTools#2440
pull Bot
pushed a commit
to Stars1233/chrome-devtools-mcp
that referenced
this pull request
Jul 30, 2026
…#2443) Re-export the Puppeteer helpers as we have tested those. This should also be a small performance improvement as we don't await any of the disposals. Will also fix memory leaking for some methods. With the added benefit of make the code look cleaner (no try/catch.) Also Fixes ChromeDevTools#2440, Closes ChromeDevTools#2441
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.
Fixes #2440
Problem
The
draghandler resolved both element handles before itstry/finally:If
getElementByUid(to_uid)throws — which it does for a stale/invalidto_uid— thetryis never entered andfromHandle(a fresh remote object) is never disposed, leaking it for the life of the page's execution context. Same class as the merged #2422;fill_formalready handles this correctly, sodragwas the only affected input tool.Fix
Acquire
toHandleinside a nestedtrysofromHandleis disposed on every path:Testing
disposes the source handle when the target lookup fails: stubsgetElementByUidso the target lookup rejects, and asserts the source handle'sdisposewas still called. Fails onmain(disposecalled 0 times) and passes with this change.npm run test tests/tools/input.test.ts— all pass.