qjs 0.2.1
qjs: ^0.2.1 copied to clipboard
QuickJS bindings for Dart.
0.2.1 #
Fixes #
- Using a
JSRuntimeafterrelease()now throws aStateErrorinstead of crashing the process. This includes aJSPromise.fromAsyncFunctioncallback that builds its result after the runtime was released while it was awaiting. - Updated the code examples in the API docs to the current API.
0.2.0 #
Breaking changes #
- With
enableEval: false(includingJSRuntimeConfig.hardened()), theFunction,AsyncFunction,GeneratorFunctionandAsyncGeneratorFunctionconstructors now throw. Previously, code could still be compiled through them. - A microtask that fails while draining (for example, because the script was interrupted) is now reported instead of dropped.
evaluateJavascript,evaluatePreparedJavaScriptand function calls throw aJSException, anddrainMicrotasks()throws instead of returningfalse. - Errors thrown by
setTimeout/setIntervalcallbacks installed byJSTimersno longer surface as uncaught Dart errors. They go toJSRuntime.onUncaughtError, and are dropped if it is not set. - Calling
setNativeStateagain on the same object now replaces the state. Previously the second call was silently ignored. JSRuntimeuses a DartFinalizerinstead of aNativeFinalizer. Releasing a runtime that is never released explicitly is best effort; always callrelease().
Features #
- Sandbox controls on
JSRuntime:setDeadline/clearDeadlineinterrupt long-running scripts with an uncatchableInternalError: interrupted.requestInterruptand the sendableinterruptHandlecancel a script from another isolate.memoryUsagereports heap usage as aJSMemoryUsage.onUnhandledRejectiontracks promises rejected without a handler.onUncaughtErrorreceives errors from JavaScript that runs with no Dart caller.runGCruns the garbage collector.
JSHostObject.hasanswersinand per-key checks without rebuilding the key list.- Updated QuickJS-ng to v0.17.0.
Fixes #
- Fixed a deadlock between
JSRuntime.release()and pointer finalizers running during GC, and a use-after-free on the runtime in those finalizers. - Fixed a crash (double free) when JavaScript used
in,Object.keysorfor...inon a host object. Object.keys,for...in,JSON.stringifyandhasOwnPropertynow see host object keys.- Fixed
JSValue.fromJsonUtf8intermittently failing on valid JSON. - JavaScript errors are no longer lost in array element reads, key conversion, property name listing and object creation.
getNativeStateno longer returns state inherited from a prototype, and native state is no longer visible to JavaScript.JSArray.createaccepts lengths up to 2³² − 1 and throws aRangeErrorabove that, instead of truncating the length.- Fixed a race in
JSObject.fromIdwith finalizers running during GC. - Strings returned by the native library are freed with the library's own allocator, which matters on Windows.
- Handled native allocation failures that previously crashed or leaked.
0.1.0 #
- Initial version.