#50556: fix: add missing HandleScope in contentTracing.getTraceBufferUsage()
Description of Change
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.
Checklist
- PR description included
- I have built and tested this PR
-
npm testpasses - tests are added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed a crash when calling contentTracing.getTraceBufferUsage() while a trace session is active.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron