Tor Andersson
42e29f6816
Simplify Array.prototype.sort by sorting in place using quicksort.
...
Don't use libc qsort (which uses malloc on gnu libc) which can leak
memory if the callback throws an exception.
2024-11-22 15:28:10 +01:00
Tor Andersson
0df0707f2f
Release 1.3.5.
1.3.5
2024-06-20 13:01:41 +02:00
Tor Andersson
40556b31c6
Issue #130 : Fix bug with String.prototype.split(RegExp).
...
The "empty string at end of last match" should only trigger if the match
is empty!
2024-01-26 14:18:54 +01:00
Tor Andersson
d2697fd643
Expose extended unicode characters as surrogate pairs in String methods.
...
Split extended characters into surrogate pairs for charCodeAt, string
indexing, and the string slice/subset functions.
Escape surrogate code points in JSON stringify.
2024-01-26 14:18:54 +01:00
Tor Andersson
a442a0418f
Issue #164 : Use correct scope for function declaration bindings.
...
TODO: Make binding for function expression names immutable!
2024-01-22 14:22:01 +01:00
Tor Andersson
7e27931468
Increase default stack sizes.
2024-01-19 14:43:08 +01:00
Tor Andersson
e0885b354c
regex: Dynamically allocate character class buffer.
...
Use a huge buffer for compilation, copy into exact size for program.
Merge overlapping and adjoining character class ranges.
This reduces the number of classes needed for badly constructed
character classes like [ABCDEFGHIJKLMNOPQRSTUVWXYZ].
2024-01-19 14:43:08 +01:00
Tor Andersson
a76d157bda
Release 1.3.4.
1.3.4
2023-11-21 16:27:50 +01:00
Tor Andersson
9f5bc0ff81
Finalize user data if object allocation fails.
2023-08-10 17:13:37 +02:00
Tor Andersson
9bd3edcbcd
Fix bug when cleaning up after allocation error.
2023-08-10 17:04:53 +02:00
Tor Andersson
ddd770933b
Handle sign when converting integer strings to numbers.
2023-05-08 12:38:46 +02:00
Tor Andersson
db212180bf
Allow disabling readline support in Makefile.
...
make HAVE_READLINE=no
2023-04-04 15:22:39 +02:00
Tor Andersson
57e3f01d5f
Add install-static and install-shared targets.
1.3.3
2023-01-10 12:11:11 +01:00
Tor Andersson
f190f88ee2
Simplify Makefile.
2023-01-09 16:09:28 +01:00
Tor Andersson
bb6a85a31c
Issue #171 : Compile sparse array initializers correctly.
...
Don't initialize the holes with "undefined".
Elided array entries should be skipped altogether.
2023-01-09 14:44:02 +01:00
Tor Andersson
32f3e71169
Issue #171 : Fix Object.keys implementation for flat arrays and strings.
...
Object.keys was not producing keys for the array part of a flat array.
It was also producing an array of numbers rather than strings for
string objects.
2023-01-05 15:48:28 +01:00
Tor Andersson
2e2738b293
Change js_Value to union to avoid some compiler optimization warnings.
...
Use a union of a union and the padding + type tag, to let the shrstr
object size be the full 16 bytes to avoid compiler complaints about
stepping out of bounds of the array when it optimizes heavily.
2023-01-05 15:32:41 +01:00
Tor Andersson
dd149b98bd
Split debug printing of bytecode etc into "pp" tool.
2023-01-05 15:32:41 +01:00
Tor Andersson
d283465777
Regenerate Unicode data from latest UnicodeData.txt
2023-01-04 17:29:22 +01:00
Tor Andersson
278590fcb4
Merge the small private header files into jsi.h
2023-01-04 17:29:22 +01:00
Tor Andersson
71ffe07495
Fix longjmp warnings.
2023-01-04 17:29:22 +01:00
Tor Andersson
88b31f342d
Allow holes at the end of a simple array.
...
Don't unflatten when creating with a = new Array(10).
Don't unflatten when deleting the last element.
2023-01-04 17:28:23 +01:00
Tor Andersson
7d9888b739
Return "undefined" from C functions if no return value is pushed.
...
Don't return the last input argument in this case.
2023-01-04 17:28:23 +01:00
Tor Andersson
bd037ab7aa
Bug 706081: Fix off by one in size calculation.
2022-11-16 21:12:23 +01:00
Tor Andersson
09b3fcb1e7
Bug 706075: Fix errors in property deletion.
...
1) Copy "level" from the replacement node.
2) Fix rebalancing by using exact algorithm from AA-tree paper.
2022-11-14 17:43:58 +01:00
Tor Andersson
f882c6c5fe
Rename private functions to avoid problems with MSYS stdio.h.
2022-11-09 16:01:43 +01:00
Tor Andersson
66d98a5f8e
Fix Array.prototype.slice when deleteCount is missing.
...
Use behavior from newer JS specifications.
2022-11-07 16:25:09 +01:00
Tor Andersson
c067e1299c
Avoid using the string interning table.
...
Make a copy of the property name in the same allocation as the property slot.
Make a copy of the internal string value of String objects.
2022-11-07 16:25:09 +01:00
Tor Andersson
0e611cdc0c
1.3.2 patch release for UAF bug fix.
1.3.2
2022-11-07 16:24:56 +01:00
Tor Andersson
edb50ad66f
Bug 706057: Fix use-after-free in getOwnPropertyDescriptor.
...
getOwnPropertyDescriptor should create the descriptor object by
using [[DefineOwnProperty]], and not by looking through the prototype
chain where it may invoke getters and setters on the Object.prototype.
If there exists an Object.prototype.get property with a setter, that method is
invoked when it shouldn't. A malicious getter here can delete the property
currently being processed in getOwnPropertyDescriptor, and we'll end up
with a use-after-free bug.
Avoid this problem by following the spec and use js_defproperty rather than
js_setproperty to define own properties in getOwnPropertyDescriptor and
related functions.
2022-11-07 13:44:24 +01:00
Tor Andersson
bf4ac94207
Set length of output array Array.prototype.map.
2022-10-26 20:42:29 +02:00
Tor Andersson
69e2767d0a
Make a patch release for important iterator bug fix.
1.3.1
2022-10-20 18:19:41 +02:00
Tor Andersson
8b5ba20957
Issue #166 : Use special iterator for string and array indices.
...
Add a scratch buffer to js_State to hold temporary strings.
2022-10-20 18:14:54 +02:00
Ismael Luceno
d592c785c0
Enable choice of library version for shell
...
Default behavior is unchanged, but enables to chose the dynamic version by
passing "libmujs=libmujs.so" to make.
2022-10-17 14:53:27 +02:00
Ismael Luceno
1138515255
Use $(@D) instead of $(dir $@)
2022-10-17 14:53:27 +02:00
Ismael Luceno
4d3165baf5
Bug 705905: Compute VERSION using Make.
2022-10-17 14:52:13 +02:00
Tor Andersson
ebf235bfea
Bump version number.
1.3.0
2022-10-11 18:18:55 +02:00
Sebastian Rasmussen
bbb2c511e5
Avoid freeing buffer twice in case of error.
2022-10-11 18:09:38 +02:00
Tor Andersson
3f71a1c946
Fast path for "simple" arrays.
...
An array without holes and with only integer properties can be represented
with a "flat" array part that allows for O(1) property access.
If we ever add a non-integer property, create holes in the array,
the whole array is unpacked into a normal string-keyed object.
Also add fast integer indexing to be used on these arrays, before falling
back to converting the integer to a string property lookup.
Use JS_ARRAYLIMIT to restrict size of arrays to avoid integer overflows and out
of memory thrashing.
2022-09-08 13:54:14 +02:00
Tor Andersson
ac03b95b18
Bug 705775: Fix double fclose in pretty-printing tool.
2022-08-23 11:16:42 +02:00
Wessel Dankers
1cbf19e7a9
Makefile: fix parallel builds
...
The parent directory wasn't created when generating the .pc file,
causing it to fail in highly parallel builds.
2022-08-05 13:13:21 +02:00
Tor Andersson
3451b6ca96
Guard state initialization with try to avoid panic in initialization.
2022-06-09 15:53:51 +02:00
Tor Andersson
88f6d86b6c
Add js_isbooleanobject and js_isdateobject functions.
2022-05-25 16:33:53 +02:00
Tor Andersson
f5b3c703e1
Issue #161 : Cope with empty programs in mujs-pp.
2022-05-17 15:57:55 +02:00
Tor Andersson
910acc807c
Issue #161 : Don't fclose a FILE that is NULL.
2022-05-17 15:53:30 +02:00
Tor Andersson
160ae29578
Issue #162 : Check stack overflow during regexp compilation.
...
Only bother checking during the first compilation pass that counts
the size of the program.
2022-05-17 15:32:16 +02:00
Tor Andersson
db110ea88e
Bug 705052: Don't use private STACK/TOP macros in jsstate.c
...
These convenience macros are defined and used in jsrun.c, and should not
be used in other files.
2022-03-16 11:34:18 +01:00
Tor Andersson
76e400fb67
Add "console" object to mujs shell.
2022-03-10 17:42:25 +01:00
Tor Andersson
434ae67268
Issue #156 : Fix check for duplicate formal parameters when strict.
...
Duplicate var and function declarations are still allowed.
2022-03-10 17:42:00 +01:00
Tor Andersson
4586e81832
Some minor optimizations to Ap_join.
2022-02-23 14:58:49 +01:00