12 Commits

Author SHA1 Message Date
Jack Franklin d05cbc0511 fix(performance): prevent memory leak by scoping trace engine model per parse (#2720)
## Rationale

DevTools' `TraceEngine.TraceModel.Model` permanently retains parsed
traces in an internal recordings array (`#traces`). Calling
`engine.resetProcessor()` between runs only resets the underlying
processor and does not clear `#traces`.

Because `engine` was previously instantiated as a module-scoped
singleton, every performance trace recorded or parsed in a session
remained permanently held in heap memory for the lifetime of the
process.

## Changes

- In `src/processors/PerformanceTrace.ts`, instantiate
`DevTools.TraceEngine.TraceModel.Model.createWithAllHandlers()` per
invocation of `parseRawTraceBuffer()`.
- Remove the module-scoped `engine` singleton and the obsolete
`engine.resetProcessor()` call.
- Add a unit test in `tests/trace-processing/parse.test.ts` verifying
that consecutive trace parses construct isolated `Model` instances and
keep internal trace retention bounded at 1.
- Add a profiling regression scenario in
`scripts/profile/scenarios/performance_trace.ts` to guard against memory
retention across consecutive traces during `npm run test:memory`.
2026-09-10 15:37:28 +00:00
Nikolay Vitkov 06b7a5c320 refactor: move files to folders that better represent their use (#2564) 2026-08-12 14:21:27 +00:00
Nikolay Vitkov bede4fbdfa chore: install HostBindingAdapter (#2186)
This PR introduces the HostBindingAdapter to utilize the functions
usually available to DevTools.
Additionally I moved all the DevTools related files under a `devtools`
directory to better separate the extractor logic.
The patch scripts for DevTools were moved under a function to remove the
side-effect nature of the file.
Now gets called in a the creation of the McpContext (and a before hook
in test.)
2026-06-09 12:18:25 +00:00
Alex Rudenko f8fb2a9236 test: drop node20 code in tests (#2146) 2026-05-27 11:12:22 +00:00
zyzyzyryxy 94752ffade fix: prevent dropping license notices on some files when publishing (#604)
This PR prevents license notices being dropped when creating package for
publication.

This can happen when first import in the file is type-only import that
gets removed during build. When there is no empty line between the
license block comment and such import, the comment is treated as related
to the import and gets removed alongside it.
Adding an empty line between copyright notice and the import fixes the
issue.

Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
2025-11-24 12:38:30 +00:00
Alex Rudenko a5c40d14a9 chore: remove i18n mocks (#576)
i18n can now run in node.js.
2025-11-19 09:32:54 +00:00
Nikolay Vitkov 15277541d8 chore: add additional EsLint rule (#147) 2025-09-25 17:20:01 +02:00
Alex Rudenko adfcecf987 fix: validate and report incompatible Node versions (#113)
Ref https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/92
2025-09-24 14:45:27 +02:00
Jack Franklin e8fb30c1bf fix: rework performance parsing & error handling (#75)
This PR tidies up the code around performance parsing and what we
respond with from our tools. It introduces the ability to have no
Insights from a trace (relatively rare, but can happen), and also adds
more information to the output in the event that something went wrong.

Previously we just logged errors, but if we respond with them here that
will also help users report issues and increase the chances that we can
debug them.
2025-09-23 15:42:35 +02:00
Jack Franklin 21e175b862 feat: add performance_analyze_insight tool. (#42) 2025-09-17 12:25:40 +00:00
Jack Franklin 0cb6147b87 feat: use Performance Trace Formatter in trace output (#36)
Note: this will error until a chrome-devtools-frontend with this change

https://chromiumdash.appspot.com/commit/62e1652b2bf044ec53a2ec212cf53b1a62bc357e
is released on npm.
2025-09-16 17:07:58 +00:00
Alex Rudenko 31a0bdce26 feat: initial version 2025-09-11 12:46:05 +02:00