This allows a native thread to suspend its Duktape thread while for
example calling out to an external blocking API, allowing other native
threads to cooperatively run code on the same heap in the meantime.
It is left up to the application to synchronize its native threads so
only a single native thread executes code at a time, each taking care to
use distinct Duktape threads while doing so.
Related to #834.
duk_require_heapptr() call now throws a TypeError instead of a RangeError for
an invalid index. This is not ideal, but is more consistent with other API
call behavior (at the moment; it'd be better if RangeErrors were used for
index errors in general).
The call returns a non-NULL duk_tval pointer to a static DUK_TAG_UNUSED so
that a call site can avoid an unnecessary NULL check. This is useful for
e.g. calls like duk_get_boolean().
Previous implementation avoided side effects during string table resize.
This is sufficient in most cases but not in the following:
- Caller pushes a string using duk_push_lstring(), with the data and
length referencing the data area of a dynamic or external buffer.
- When allocating a new duk_hstring a side effect triggers a finalizer.
- The finalizer resizes or reconfigures the dynamic/external buffer so
that the original duk_push_lstring() arguments are invalidated.
- When it's time to copy the data over into the duk_hstring, the pointer
and/or length are invalid and memory unsafe behavior follows.
Avoid this problem by preventing mark-and-sweep side effects for the duration
of the entire string intern processing.
* Tolerate Proxy setup errors in case Proxy throws (= disabled).
* Fix bug in JX encoding error handling. Incorrect quote marks caused
value to be number coerced (+v) rather than string coerced (''+v).