Query_heapsnapshot_objects className finds nothing for class names that the other heap tools print, because it matches node names
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- devtools
Direzione di ricerca
Read the query_heapsnapshot_objects description and className parameter in docs/tool-reference.md, then inspect the worker's queryObjects in third_party/devtools-frontend/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts. Reproduce with the detached DOM fixture and heap snapshot steps in the issue. Done means class names from heap details select the corresponding objects, while the LeakyThing control still works.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description of the bug
query_heapsnapshot_objects documents className as matching the "object class name", but it matches each node's name instead. For JavaScript objects the two are the same, so LeakyThing works. For DOM and other native nodes they differ: get_heapsnapshot_details reports the class Detached <div> with 50 objects, yet className: "Detached <div>" (or ^Detached <div>$) returns 0 objects, because those nodes are named Detached <div class="detached-node">. Class names from the details output that contain regular-expression syntax, such as (array), also select unrelated nodes (Array, system / ArrayList, system / DescriptorArray). An agent that copies a class name from one heap tool into this query gets wrong or empty results without any error.
Actual behavior
Both builds (two snapshots per build: the fixture above and a larger leak fixture):
get_heapsnapshot_details (detached filter):
id,name,count,selfSize,retainedSize
1,Detached <div>,50,5.2 kB,10.8 kB
query className "Detached <div>" -> Showing 1-0 of 0 (main: Showing 0-0 of 0)
query className "^Detached <div>$" -> Showing 1-0 of 0 (main: Showing 0-0 of 0)
query className "Detached <div" -> 36383,Detached <div class="detached-node">,native,6,0.1 kB,0.2 kB ... Showing 1-2 of 50
query className "(array)" -> 37509,Array,object,5,...; 46611,system / DescriptorArray,object shape,7,... Showing 1-3 of 2292
With the larger fixture, className: "Detached" also returned a script source string whose text contains "detached" (the match is case-insensitive and against any node name, including string contents).
Reproduction
- Serve this page locally as
detached.html:
<!doctype html><title>Detached fixture</title>
<script>
window.kept = [];
for (let i = 0; i < 50; i++) { const d = document.createElement('div'); d.className = 'detached-node'; window.kept.push(d); }
</script>
- Send these tool calls:
{"name":"new_page","arguments":{"url":"http://127.0.0.1:<port>/detached.html"}}
{"name":"take_heapsnapshot","arguments":{"pageId":2,"filePath":"<workspace>/snaps/detached.heapsnapshot"}}
{"name":"get_heapsnapshot_details","arguments":{"filePath":"<workspace>/snaps/detached.heapsnapshot","filterName":"objectsRetainedByDetachedDomNodes","pageSize":5}}
{"name":"query_heapsnapshot_objects","arguments":{"filePath":"<workspace>/snaps/detached.heapsnapshot","className":"Detached <div>","pageSize":3}}
{"name":"query_heapsnapshot_objects","arguments":{"filePath":"<workspace>/snaps/detached.heapsnapshot","className":"^Detached <div>$","pageSize":3}}
{"name":"query_heapsnapshot_objects","arguments":{"filePath":"<workspace>/snaps/detached.heapsnapshot","className":"(array)","pageSize":3}}
{"name":"query_heapsnapshot_objects","arguments":{"filePath":"<workspace>/snaps/detached.heapsnapshot","className":"Detached <div","pageSize":2}}
Expectation
The className parameter is "Optional regex or text matching object class name", and the tool description lists it among the filters for "objects matching specific filters (className, ...)". The heap tools present class names in get_heapsnapshot_details and compare_heapsnapshots; a class name printed there, such as Detached <div> or (array), should select the objects of that class (50 detached div elements here), as the same name does for JavaScript classes such as LeakyThing.
MCP configuration
--headless --isolated --no-usage-statistics --no-performance-crux unless the reproduction states otherwise (update checks disabled with CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1).
Chrome DevTools MCP version
1.10.1 (npm) and main 5ddb0a3110c5059f8e5513e566196cce2a35c6d1 (local build)
Chrome version
154.0.8037.98 (stable)
Node version
v22.23.2
Operating system
macOS 27.0
Environment details
chrome-devtools-mcp1.10.1 from npm (the release build) and upstreammainat commit5ddb0a3110c5059f8e5513e566196cce2a35c6d1built from source (themainbuild).- Google Chrome 154.0.8037.98 (stable), Node.js v22.23.2, macOS 27.
- Server started with
--isolated --headless --no-usage-statistics --no-performance-crux --memoryDebuggingandCHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1, driven by a minimal stdio MCP client whose workspace root contains<workspace>/snaps/.
Evidence
- Expected source:
query_heapsnapshot_objectsdescription andclassNameparameter indocs/tool-reference.md, both builds; class names as printed byget_heapsnapshot_detailson the same snapshot. - Failure source: my runs of the steps above on both builds; static breadcrumb: the worker's
queryObjects(third_party/devtools-frontend/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.tson themainbuild) compilesnew RegExp(queryOptions.className, 'i')and tests it against the node name. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Fix check
Run the steps above. Failing: className: "Detached <div>" returns 0 objects while get_heapsnapshot_details reports 50 Detached <div> objects. Passing: the same query returns those 50 detached div nodes, and className: "(array)" returns the objects that get_heapsnapshot_details counts under (array) rather than Array objects. Control: className: "LeakyThing" (or ^LeakyThing$) on a page with that JavaScript class still returns the same instances as get_heapsnapshot_class_nodes for that class.
Additional context
The full open and closed issue and pull request corpus was screened as of 2026-10-06; no issue covers this. Merged pull request #2553 added the tool. If the maintainers prefer node-name matching, an alternative resolution is a className description that says it matches node names and explains how class names containing regular-expression syntax are treated. An invalid regular expression in className (for example () fails with an internal TypeError; that is a separate problem with its own fix and is not part of this report.
- Lingua principale
- TypeScript
- Stelle
- 59.8k
- Fork
- 4.8k
- Merge medio
- 2g 10h
- PR unite (30g)
- 162
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ChromeDevTools/chrome-devtools-mcp
-
feature
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#3689 ·
I maintainer di solito rispondono entro 1 giorno
-
`evaluate_script` `sourcePath` http(s) URLs are mangled into `file://` pathsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertacollecting-feedback
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#3453 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
collecting-feedback feature
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
ChromeDevTools/chrome-devtools-mcp#3225 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`wait_for` never finds visible text whose HTML source contains line breaks or repeated spacesApertaconfirmed p3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ChromeDevTools/chrome-devtools-mcp#2947 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Project Migration: Moving to devtools-frontendForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 1/100
ChromeDevTools/chrome-devtools-mcp#3648 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ChromeDevTools/chrome-devtools-mcp
Issue simili
-
[Bug]: Team (channel) avatars render noticeably smaller than agent avatars in the sidebar gridApertabug from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nightly-labs/openbot#21303 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ADORSYS-GIS/CoopData#282 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OHDSI/Data2Evidence#3816 ·
I maintainer di solito rispondono entro 3 giorni
-
`ovsx verify` fails for a version older than the 100 newest of an extensionForse già presa @trivikr l’ha presa oggi. Apertacli
Difficoltà 2/5 1-3 ore Idoneità per principianti 81/100
eclipse-openvsx/openvsx#2482 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug builder-vite hmr sev:S3
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
storybookjs/storybook#37965 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno