Skip to content

fix: don't abort the process when a JS accessor throws during value conversion - #53069

Merged
MarshallOfSound merged 12 commits into
mainfrom
fix/context-bridge-array-throwing-getter
Aug 21, 2026
Merged

MarshallOfSound merged 12 commits into
mainfrom
fix/context-bridge-array-throwing-getter

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Description of Change

A number of places unwrap a v8::MaybeLocal with ToLocalChecked() (or a v8::Maybe with Check() / ToChecked()) on a value that JavaScript controls. If the read runs a user accessor or Proxy trap that throws, the MaybeLocal is empty and the process aborts instead of raising a catchable error. One commit per site:

  • contextBridge array copy: a renderer crash reachable from sandboxed web content by passing an array with a throwing index getter (or any nested such array) to an exposed function, or returning one from it. Spec added for both directions.
  • contextBridge DeepFreeze: throwing accessors on page-controlled objects reached by the freeze walk.
  • contextBridge internalContextBridge.override* helpers: failed conversions were ToLocalChecked()'d.
  • HttpResponseHeaders converter (webRequest.onHeadersReceived result): throwing header getters / ownKeys traps.
  • std::set / std::map converters (webRequest filters, session.downloadURL headers, utilityProcess.fork env): throwing index accessors / ownKeys traps.
  • header-pair converter (net.request / WebSocket headers): throwing ownKeys trap.
  • gin_helper::Dictionary::IsEmptyObject (webContents.print options): throwing ownKeys trap.
  • webFrame.setSpellCheckProvider: throwing has trap.
  • sharedTexture nativePixmap.planes: throwing index accessor, plus a missing object check.
  • pooled worker contexts (nodeIntegrationInWorker): CHECK on reading a redefined process / require global.
  • utility-process LanguageModel bridge: malformed stream chunks / throwing getters now report an error instead of CHECKing.
  • Set().Check() on freshly created arrays and error objects → CreateDataProperty, so a throwing setter installed on Array.prototype / Error.prototype cannot abort.

Verified locally: each case crashes the pre-fix build with Fatal error in V8: v8::ToLocalChecked Empty MaybeLocal and surfaces as a normal JS error on the fixed build.

Checklist

Release Notes

Notes: Fixed a renderer crash when an array with a throwing property getter is passed across contextBridge, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps.

…ng getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.
`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.
…errides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.
…rter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.
…rters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.
`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.
`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.
…trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.
…rter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.
…equire

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.
The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.
…rrors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.
@MarshallOfSound MarshallOfSound added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. labels Aug 21, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 21, 2026
@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) August 21, 2026 08:15
@MarshallOfSound
MarshallOfSound merged commit 13c8c5a into main Aug 21, 2026
126 of 127 checks passed
@release-clerk

release-clerk Bot commented Aug 21, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a renderer crash when an array with a throwing property getter is passed across contextBridge, and several main/utility-process crashes when option objects passed to Electron APIs contain throwing accessors or Proxy traps.

@MarshallOfSound
MarshallOfSound deleted the fix/context-bridge-array-throwing-getter branch August 21, 2026 09:57
@trop

trop Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "42-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "43-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "44-x-y" cleanly;
you will need to perform this backport manually.

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "42-x-y", please check out #53329

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "43-x-y", please check out #53330

@trop

trop Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@MarshallOfSound has manually backported this PR to "44-x-y", please check out #53331

MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…onversion (#53329)

fix: don't abort the process when a JS accessor throws during value conversion (#53069)

* fix: don't crash the renderer when a contextBridge array has a throwing getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.

* fix: handle throwing accessors while deep-freezing contextBridge values

`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.

* fix: don't ToLocalChecked() an empty proxy in contextBridge global overrides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.

* fix: don't crash on throwing getters in the HttpResponseHeaders converter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.

* fix: don't crash on throwing accessors in the std::set/std::map converters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.

* fix: don't crash on a throwing ownKeys trap in the header-pair converter

`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.

* fix: don't crash in Dictionary::IsEmptyObject when enumeration throws

`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.

* fix: don't crash in webFrame.setSpellCheckProvider on a throwing has trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.

* fix: validate nativePixmap.planes entries in the shared texture converter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.

* fix: don't CHECK when a pooled worker context has redefined process/require

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.

* fix: don't crash the utility process on malformed LanguageModel results

The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.

* fix: use CreateDataProperty when filling freshly created arrays and errors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.

(cherry picked from commit 13c8c5a)
@trop trop Bot added merged/42-x-y PR was merged to the "42-x-y" branch. and removed in-flight/42-x-y labels Aug 31, 2026
MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…onversion (#53331)

fix: don't abort the process when a JS accessor throws during value conversion (#53069)

* fix: don't crash the renderer when a contextBridge array has a throwing getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.

* fix: handle throwing accessors while deep-freezing contextBridge values

`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.

* fix: don't ToLocalChecked() an empty proxy in contextBridge global overrides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.

* fix: don't crash on throwing getters in the HttpResponseHeaders converter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.

* fix: don't crash on throwing accessors in the std::set/std::map converters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.

* fix: don't crash on a throwing ownKeys trap in the header-pair converter

`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.

* fix: don't crash in Dictionary::IsEmptyObject when enumeration throws

`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.

* fix: don't crash in webFrame.setSpellCheckProvider on a throwing has trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.

* fix: validate nativePixmap.planes entries in the shared texture converter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.

* fix: don't CHECK when a pooled worker context has redefined process/require

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.

* fix: don't crash the utility process on malformed LanguageModel results

The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.

* fix: use CreateDataProperty when filling freshly created arrays and errors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.

(cherry picked from commit 13c8c5a)
@trop trop Bot added merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/44-x-y labels Aug 31, 2026
MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…onversion (#53069)

* fix: don't crash the renderer when a contextBridge array has a throwing getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.

* fix: handle throwing accessors while deep-freezing contextBridge values

`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.

* fix: don't ToLocalChecked() an empty proxy in contextBridge global overrides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.

* fix: don't crash on throwing getters in the HttpResponseHeaders converter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.

* fix: don't crash on throwing accessors in the std::set/std::map converters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.

* fix: don't crash on a throwing ownKeys trap in the header-pair converter

`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.

* fix: don't crash in Dictionary::IsEmptyObject when enumeration throws

`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.

* fix: don't crash in webFrame.setSpellCheckProvider on a throwing has trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.

* fix: validate nativePixmap.planes entries in the shared texture converter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.

* fix: don't CHECK when a pooled worker context has redefined process/require

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.

* fix: don't crash the utility process on malformed LanguageModel results

The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.

* fix: use CreateDataProperty when filling freshly created arrays and errors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.

(cherry picked from commit 13c8c5a)
MarshallOfSound added a commit that referenced this pull request Aug 31, 2026
…onversion (#53330)

fix: don't abort the process when a JS accessor throws during value conversion (#53069)

* fix: don't crash the renderer when a contextBridge array has a throwing getter

When a value crossing the context bridge contains a plain array, each index
is read with `arr->Get(context, i).ToLocalChecked()`. If the index is an
accessor that throws (e.g. `Object.defineProperty(arr, 0, { get() { throw
... } })`), `Get()` returns an empty `MaybeLocal` and `ToLocalChecked()`
aborts the renderer process. Web content in a sandboxed, context-isolated
renderer can trigger this just by passing such an array to any exposed
function, since the crash happens during argument marshaling.

Use `ToLocal()` and bail out of the copy, so the pending exception is
surfaced to the caller as a normal catchable error, the same way a
non-cloneable value is handled.

* fix: handle throwing accessors while deep-freezing contextBridge values

`DeepFreeze` walks every own property of the object exposed to the main
world with `ToLocalChecked()` reads. The walk can reach objects the page
controls (a DOM element or a main-world function handed back through the
bridge), and a throwing accessor on one of those aborts the renderer.

Check every `GetOwnPropertyNames`/`Get` result and stop freezing when one
fails, leaving the exception for the caller.

* fix: don't ToLocalChecked() an empty proxy in contextBridge global overrides

`OverrideGlobalValueFromIsolatedWorld` and
`OverrideGlobalPropertyFromIsolatedWorld` assume `PassValueToOtherContext`
never fails and unwrap its result with `ToLocalChecked()`. The conversion
can fail (for example on a value nested too deep or an array index whose
getter throws), which turned into a renderer abort. Return early instead.

* fix: don't crash on throwing getters in the HttpResponseHeaders converter

The `responseHeaders` object returned from a `webRequest.onHeadersReceived`
callback is read with `ToLocalChecked()` for the key list, each value, and
each element of an array value. A getter that throws (or a Proxy whose
`ownKeys` trap throws) left an empty `MaybeLocal` and aborted the main
process. Use checked reads and fail the conversion instead.

* fix: don't crash on throwing accessors in the std::set/std::map converters

`Converter<std::set<T>>` reads each array index and `Converter<std::map>`
enumerates property names with `ToLocalChecked()`. An array with a throwing
index accessor (e.g. `webRequest.onBeforeRequest({ urls })`) or a Proxy
whose `ownKeys` trap throws (e.g. `session.downloadURL(url, { headers })`,
`utilityProcess.fork(..., { env })`) aborted the process. Return false from
the conversion so the caller reports a normal error.

* fix: don't crash on a throwing ownKeys trap in the header-pair converter

`Converter<std::vector<std::pair<K, V>>>` (used for `net.request` and
`WebSocket` header options) unwrapped `GetPropertyNames()` with
`ToLocalChecked()`; a Proxy whose `ownKeys` trap throws aborted the process.
Check the result like the rest of the loop already does.

* fix: don't crash in Dictionary::IsEmptyObject when enumeration throws

`webContents.print(new Proxy({}, { ownKeys() { throw ... } }))` aborted the
main process because `IsEmptyObject()` unwrapped `GetOwnPropertyNames()`
with `ToLocalChecked()`. Treat a failed enumeration as "not empty" and let
the caller's later reads surface the exception.

* fix: don't crash in webFrame.setSpellCheckProvider on a throwing has trap

`provider->Has(...).ToChecked()` aborts the renderer when the provider is a
Proxy whose `has` trap throws. Use `FromMaybe(false)` so it is reported as
the existing "spellCheck has to be defined" error instead.

* fix: validate nativePixmap.planes entries in the shared texture converter

Each `planes` element was read with `ToLocalChecked()` and cast to an object
without checking. A throwing index accessor aborted the process and a
non-object element was a type confusion. Fail the conversion in both cases.

* fix: don't CHECK when a pooled worker context has redefined process/require

When a second worklet scope is pooled onto a thread that already has a Node
environment, `ShareEnvironmentWithContext` copies `process` and `require`
from the first context's global and `CHECK`s that the reads succeed. Script
in that first context can redefine either global with a throwing accessor
(both are configurable), which turned a script error into a renderer crash.
Read them under a `TryCatch` and fall back to the environment's own process
object / undefined.

* fix: don't crash the utility process on malformed LanguageModel results

The utility-process AI bridge trusted values coming back from the app's
`LanguageModel` implementation: stream chunks were `CHECK`ed to be objects
with a boolean `done`, `contextUsage` and `value` were read with
`ToLocalChecked()`, and the JS type predicates and `responseConstraint`
parsing unwrapped their results unchecked. A throwing getter, a non-object
chunk, or a predicate that throws aborted the utility process. Report an
error to the responder (or fall back to a safe default) instead.

* fix: use CreateDataProperty when filling freshly created arrays and errors

`Set(...).Check()` on a brand-new array or error object still runs setters
inherited from `Array.prototype` / `Error.prototype`. If app code has
installed a throwing setter there (for example on `Error.prototype.code`),
the `.Check()` aborts the main process. `CreateDataProperty` defines an own
data property without consulting the prototype chain, so it cannot throw
on these fresh objects.

(cherry picked from commit 13c8c5a)
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. and removed in-flight/43-x-y labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

45-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. new-pr 🌱 PR opened recently semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants