This will make it more probable that the initial compilation works without
investigating a linker error.
Ideally the Makefile would detect readline availability, but that would
require `uname` or some other platform hackery, which is probably too
heavyweight for a simple example Makefile.
Fix a few edge cases related to local time handling near the valid Ecmascript
time value limits. Two test262 test cases failed due to recently added sanity
checks (which were necessary to avoid integer overflows in extreme cases), and
one assert was broken.
There's no need for a release note because this merge fixes issues introduced
by other changes in the release.
Tzoffset calculations would be skipped if a temporary time value was just
outside the Ecmascript range. This can happen in some legitimate cases,
so a +/- 24h leeway was added to the check. This fixes a few test262
cases documented in test-bug-date-timeval-edges.js.
Similarly, add a +/- 24h leeway for an assert in local-time-to-parts
conversion. When converting a time value to parts and the parts are
requested in local time, a temporary time value (simulating local time) can
be just outside the Ecmascript range. Allow +/- 24h leeway in the assert
to avoid triggering it in valid edge cases.
See test-bug-date-timeval-edges.js for demonstration of both issues.
Two test262 cases failed. The tests use Date constructor to create timestamps
near the Ecmascript valid range edge. The Date constructor operates with local
time values, which caused some previous sanity checks to trigger: temporary
time values which have a local tzoffset can be just outside the valid Ecmascript
range which trigger some invalid behavior and one assert failure.
Reorganize Makefiles and a few other files both in the repo itself and
in the resulting dist package. This should make it clearer which makefiles
are intended to work from the dist directory only (as opposed to the Duktape
repo itself).
Fix value stack resize handling after a function call.
Call handling must ensure that whatever value stack size has been requested
by the application (with duk_{check,require}_stack()) is guaranteed also
after a function call returns. Previously the guaranteed size might have
been reduced (there's a testcase demonstrating this in the commit).
Without compact flag, valstack resize helper would always add more spare,
which would accumulate. This luckily broke test-bi-array-proto-join.js.
The commit also removes one helper layer from valstack resizing.
Add an overview section on how Duktape is compiled, with specific emphasis on:
- no official Makefile or build script
- Duktape can be compiled as a static or dynamic library too
- application MUST include duktape.h; all API calls can be macros
C++ discussion is moved into Compiling section.
Without this, newer Emscripten will emit a memory init file which is more
awkward than passing around a single file. This change fixes the current
Dukweb REPL page. Using an explicit memory init file would of course also
be possible and a better fix might be to use the Emscripten default.
Fix a few overflow issues in Date handling. This caused an assert failure
and some incorrect behavior when operating with years outside the valid
Ecmascript range.
Avoid doing tzoffset computations when timevalue is outside Ecmascript
range. If we don't, some integer overflows happen and some internal
asserts will fail. This fixes test-bug-date-insane-setyear.js.
Avoid integer overflow in duk__make_day() when year is outside valid
Ecmascript range. Return NaN directly instead. This fixes
test-bug-date-setyear-overflow.js.
Fix bug in duk_set_global_object(): must create a new global lexical env
object instead of just overwriting _target property of the current one.
Otherwise the _target change will affect other contexts with the same
(initial) global object incorrectly.
Add a lot more tests to duk duk_set_global_object() testcase.
Add a note on the API being experimental for now. The detailed semantics
can change with other sandboxing changes.
Must create a new scope instead of just setting _target of the existing one:
if just _target is set, it will affect other threads which share the same
(initial) built-ins. Instead, we must create a new scope object and replace
it entirely.
Fix bug for Proxy finalizer handling at heap destruction. If a Proxy
was reachable and its target had a finalizer, the finalizer would get
executed both for the target and for the Proxy object.