Skip to content

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

Merged
codebytere merged 1 commit into42-x-yfrom
trop/42-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920112672
Mar 31, 2026
Merged

fix: add missing HandleScope in contentTracing.getTraceBufferUsage()#50592
codebytere merged 1 commit into42-x-yfrom
trop/42-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920112672

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 42-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 31, 2026
@codebytere codebytere merged commit 7f8e35c into 42-x-y Mar 31, 2026
123 of 124 checks passed
@codebytere codebytere deleted the trop/42-x-y-bp-fix-add-missing-handlescope-in-contenttracing-gettracebufferusage--1774920112672 branch March 31, 2026 10: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

42-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