This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
Commit fa84e76
fix(File): revert to
ThrowAsJavaScriptException avoids the Chakra heap-corruption on
throw-from-constructor, but JSI's napi shim implements
`Error::ThrowAsJavaScriptException` as a no-op that only stores the
error in `env->last_exception` without raising it. The script then
continues normally with an incompletely-initialized File wrapper, the
`expect(...).to.throw()` matcher sees no JS error, and the unhandled
exception is later reported through AppRuntime's
UnhandledExceptionHandler, failing the test harness exit code.
Use the JRH-wide convention `throw Napi::TypeError::New(env, msg)`
(matches Blob, XHR, URL, AbortSignal, TextDecoder, FileReader). On
engines whose Node-API shim properly translates a C++ throw into a JS
exception at the ObjectWrap construction boundary (V8 / JSC / JSI),
this propagates as expected.
Chakra cannot handle throwing from a constructor — there are five
pre-existing TODOs in tests.ts noting this same limitation for URL
parse() error cases. Apply the same workaround here: keep the
WebIDL-conformant throw in C++, but comment out the test that
exercises it (it would corrupt the Chakra heap on every CI run).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>throw Napi::TypeError; comment-out throw test on Chakra1 parent e0ab15b commit fa84e76
1 file changed
Lines changed: 12 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1427 | 1427 | | |
1428 | 1428 | | |
1429 | 1429 | | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
1441 | 1442 | | |
1442 | 1443 | | |
1443 | 1444 | | |
| |||
0 commit comments