Skip to content

fix: add missing HandleScope in contentTracing.getTraceBufferUsage()#50594

Merged
codebytere merged 1 commit into41-x-yfrom
trop/41-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920114440
Mar 31, 2026
Merged

fix: add missing HandleScope in contentTracing.getTraceBufferUsage()#50594
codebytere merged 1 commit into41-x-yfrom
trop/41-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920114440

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop Bot commented Mar 31, 2026

Backport of #50556

See that PR for details.

Notes: Fixed a crash when calling contentTracing.getTraceBufferUsage() while a trace session is active.

The `OnTraceBufferUsageAvailable` callback creates V8 handles via
`Dictionary::CreateEmpty()` before `promise.Resolve()` enters its
`SettleScope` (which provides a `HandleScope`). When the callback
fires asynchronously from a Mojo response (i.e. when a trace session
is active), there is no `HandleScope` on the stack, causing a fatal
V8 error: "Cannot create a handle without a HandleScope".

Add an explicit `v8::HandleScope` at the top of the callback, matching
the pattern used by the other contentTracing APIs which resolve their
promises through `SettleScope` or the static `ResolvePromise` helper.

Made-with: Cursor

Co-authored-by: Alexey Kozy <alexey@anysphere.co>
@trop trop Bot requested a review from a team March 31, 2026 01:22
@trop trop Bot added 41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 31, 2026
@codebytere codebytere merged commit 90decd4 into 41-x-y Mar 31, 2026
70 checks passed
@codebytere codebytere deleted the trop/41-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920114440 branch March 31, 2026 08:15
@release-clerk
Copy link
Copy Markdown

release-clerk Bot commented Mar 31, 2026

Release Notes Persisted

Fixed a crash when calling contentTracing.getTraceBufferUsage() while a trace session is active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

41-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant