]> git.kaiwu.me - quickjs.git/log
quickjs.git
15 months agoFix multiarch CI builds
Nick Vatamaniuc [Tue, 18 Mar 2025 23:29:55 +0000 (19:29 -0400)]
Fix multiarch CI builds

Fix: https://github.com/bellard/quickjs/issues/390

15 months agocompilation fix
Fabrice Bellard [Tue, 18 Mar 2025 17:45:21 +0000 (18:45 +0100)]
compilation fix

15 months agoadded missing variable
Fabrice Bellard [Tue, 18 Mar 2025 17:34:05 +0000 (18:34 +0100)]
added missing variable

15 months agoremoved bignum support and qjscalc - added optimized BigInt implementation
Fabrice Bellard [Tue, 18 Mar 2025 17:29:10 +0000 (18:29 +0100)]
removed bignum support and qjscalc - added optimized BigInt implementation

15 months agoregexp: allow [\-] in unicode mode (#373)
Fabrice Bellard [Thu, 13 Mar 2025 18:00:25 +0000 (19:00 +0100)]
regexp: allow [\-] in unicode mode (#373)

15 months agofixed CONFIG_ALL_UNICODE compilation
Fabrice Bellard [Thu, 13 Mar 2025 17:13:25 +0000 (18:13 +0100)]
fixed CONFIG_ALL_UNICODE compilation

15 months agosimplified the handling of closures
Fabrice Bellard [Thu, 13 Mar 2025 16:44:55 +0000 (17:44 +0100)]
simplified the handling of closures

15 months agoadded missing stack overflow check in JSON.stringify()
Fabrice Bellard [Thu, 13 Mar 2025 16:27:38 +0000 (17:27 +0100)]
added missing stack overflow check in JSON.stringify()

15 months agoallow regexp interruption (e.g. with Ctrl-C in the REPL)
Fabrice Bellard [Thu, 13 Mar 2025 16:17:51 +0000 (17:17 +0100)]
allow regexp interruption (e.g. with Ctrl-C in the REPL)

15 months agofix crash when add_property() fails on build arguments (penneryu)
Fabrice Bellard [Thu, 13 Mar 2025 15:30:02 +0000 (16:30 +0100)]
fix crash when add_property()  fails on build arguments (penneryu)

15 months agomicrobench: use toFixed()
Fabrice Bellard [Thu, 13 Mar 2025 15:23:13 +0000 (16:23 +0100)]
microbench: use toFixed()

15 months agoJS_SetPropertyInternal(): avoid recursing thru the prototypes if the property is...
Fabrice Bellard [Thu, 13 Mar 2025 15:04:38 +0000 (16:04 +0100)]
JS_SetPropertyInternal(): avoid recursing thru the prototypes if the property is found in a prototype

15 months agofixed date parsing in case there is more than nine initial digits (initial patch...
Fabrice Bellard [Thu, 13 Mar 2025 14:52:53 +0000 (15:52 +0100)]
fixed date parsing in case there is more than nine initial digits (initial patch by nickva)

23 months agoFix termination in Worker test
Akos Kiss [Sat, 27 Jul 2024 09:34:49 +0000 (11:34 +0200)]
Fix termination in Worker test

Function names are case sensitive, `onMessage` is not the same as
`onmessage`.

Related to #98

23 months agoDefine a fallback PATH_MAX if not available
Pino Toscano [Sun, 9 Jun 2024 07:23:49 +0000 (09:23 +0200)]
Define a fallback PATH_MAX if not available

PATH_MAX is optional in POSIX, and it is not available on GNU/Hurd.
While it could be possible to not rely on PATH_MAX, for now provide a
fallback definition (which should be safe enough) to get quickjs built
on GNU/Hurd.

23 months agoUse ftello() & fseeko() on any OS based on GNU libc
Pino Toscano [Sun, 9 Jun 2024 07:21:01 +0000 (09:21 +0200)]
Use ftello() & fseeko() on any OS based on GNU libc

Strictly speaking, they are available in POSIX.1-2008 [1][2], so they
could be used on more platforms/OSes. To be cautious, enable them when
using GNU libc, since they have been available with that libc for a
very long time.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html

23 months agoUse malloc_usable_size() on any OS based on GNU libc
Pino Toscano [Sun, 9 Jun 2024 07:18:38 +0000 (09:18 +0200)]
Use malloc_usable_size() on any OS based on GNU libc

malloc_usable_size() is a GNU extension in GNU libc; hence, use it
every time GNU libc is used, rather than only on Linux.

23 months agoFix `JS_HasException()` when `null` is thrown (#313)
Kasper Isager Dalsgarð [Wed, 17 Jul 2024 11:58:08 +0000 (13:58 +0200)]
Fix `JS_HasException()` when `null` is thrown (#313)

Use `JS_UNINITIALIZED` instead of `JS_NULL` when no exception is pending, so `null` can be thrown and distinguished from no exception pending.

23 months agoFix GC leak in `js_proxy_get()` (#302)
Dmitry Volyntsev [Sun, 14 Jul 2024 22:08:40 +0000 (15:08 -0700)]
Fix GC leak in `js_proxy_get()` (#302)

Fixes #277

2 years agoregexp: fix non greedy quantizers with zero length matches
Fabrice Bellard [Thu, 30 May 2024 14:41:37 +0000 (16:41 +0200)]
regexp: fix non greedy quantizers with zero length matches

2 years agoupdated test262.patch
Fabrice Bellard [Thu, 30 May 2024 13:49:31 +0000 (15:49 +0200)]
updated test262.patch

2 years agofixed test of test262 directory
Fabrice Bellard [Thu, 30 May 2024 13:36:20 +0000 (15:36 +0200)]
fixed test of test262 directory

2 years agoImprove `js_os_exec` (#295)
Charlie Gordon [Thu, 9 May 2024 23:57:55 +0000 (01:57 +0200)]
Improve `js_os_exec` (#295)

- use $(shell) make command to test if closefrom() is available
- use closefrom() if available in js_os_exec()
- limit the fallback loop to 1024 handles to avoid costly loop on linux alpine.
PR inspired by @nicolas-duteil-nova

2 years agoAdd `js_resolve_proxy` (#293)
Charlie Gordon [Thu, 9 May 2024 12:14:50 +0000 (14:14 +0200)]
Add `js_resolve_proxy` (#293)

- simplify `JS_IsArray` for proxy chains
- remove `js_proxy_isArray`

2 years agoAdd `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` (#264)
Kasper Isager Dalsgarð [Thu, 9 May 2024 11:07:40 +0000 (13:07 +0200)]
Add `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` (#264)

* add `JS_StrictEq()`, `JS_SameValue()`, and `JS_SameValueZero()` all accepting `JSValueConst`
* make `js_strict_eq` accept `JSValueConst`, remove uses of this function internally and replace them with
`js_strict_eq2` instead.

2 years agoExpose `JS_SetUncatchableError()` (#262)
Kasper Isager Dalsgarð [Thu, 9 May 2024 10:45:47 +0000 (12:45 +0200)]
Expose `JS_SetUncatchableError()` (#262)

* Expose `JS_SetUncatchableError()`

* Remove unnecessary `JS_SetUncatchableError` declaration

2 years agoAdd the missing fuzz_common.c (#292)
Renáta Hodován [Thu, 9 May 2024 10:36:12 +0000 (12:36 +0200)]
Add the missing fuzz_common.c (#292)

2 years agoAdd `JS_HasException()` (#265)
Kasper Isager Dalsgarð [Wed, 8 May 2024 21:19:15 +0000 (23:19 +0200)]
Add `JS_HasException()` (#265)

2 years agoAdd `JS_NewTypedArray()` (#272)
Dmitry Volyntsev [Wed, 8 May 2024 21:17:00 +0000 (14:17 -0700)]
Add `JS_NewTypedArray()` (#272)

2 years agoOSS-Fuzz targets improvements (#267)
Renáta Hodován [Wed, 8 May 2024 16:19:48 +0000 (18:19 +0200)]
OSS-Fuzz targets improvements (#267)

* Move fuzz target sources from the oss-fuzz repository here

* Add support to build libFuzzer targets
* Simplify the fuzz_eval and fuzz_compile targets

The use of JS_NewContext instead of JS_NewContextRaw spares to call
JS_AddIntrinsic<XYZ> functions from the fuzz target, since the public
JS_NewContext API does exactly the same.

* Simplify the fuzz_regexp target

fuzz_regexp doesn't need to be dependant on libquickjs since the
runtime and the context - that were provided by libquickjs - were
only created to call two simple functions implemented in libquickjs
which could be mimicked by the fuzzer.
The removal of runtime and context objects implicated further
simplifications, like the omission of their one-time creation.
Finally, writing the result of the regexp operations into a file
is also superfluous, since it's not used by anybody.

* Recreate and destroy JS runtime and context in fuzz_eval and fuzz_compile targets

Before this patch, the test executions were not independent,
since all the executed tests used the same JavaScript runtime and
context, causing irreproducible failure reports.

* Enable bignumber support in eval and compile targets

Big numbers are used by the input corpus, but the targets were not
able to interpret them since they were not compiled into them.
This change improved the inital coverage of the fuzz_eval target with
21% and the coverage of the fuzz_compile target with 25% when using
the official corpus.

* Ensure std and os modules are available in the fuzz_eval and fuzz_compile targets
* Add fuzzer dictionary with builtin and variable names. Furthermore, added a JS script that collects all the builtin
names from the executing engine.
* Move common fuzzer code into one place
* Enable to define the LIB_FUZZING_ENGINE variable to ease the oss-fuzz integration
* Add README to fuzzers

2 years agoImprove class parser (#289)
Charlie Gordon [Sun, 5 May 2024 17:54:47 +0000 (19:54 +0200)]
Improve class parser (#289)

- accept `class P { async = 1 }}`
- accept `class P { static = 1 }}` etc.
- Fixes #261

2 years agofix class method with name get (#258)
Richard Davison [Sun, 5 May 2024 16:46:30 +0000 (18:46 +0200)]
fix class method with name get (#258)

Co-authored-by: Richard Davison <ridaviso@amazon.com>
2 years agoImprove libunicode and libregexp headers (#288)
Charlie Gordon [Sun, 5 May 2024 15:47:40 +0000 (17:47 +0200)]
Improve libunicode and libregexp headers (#288)

- move all `lre_xxx` functions to libunicode
- use flags table `lre_ctype_bits` instead of bitmaps
- simplify `lre_is_space`, `lre_js_is_ident_first` and `lre_js_is_ident_next`
- simplify `simple_next_token`, handle UTF-8 correctly
- simplify `is_let`, remove dead code

2 years agoImprove unicode table handling (#286)
Charlie Gordon [Sun, 5 May 2024 10:10:24 +0000 (12:10 +0200)]
Improve unicode table handling (#286)

- Document table and index formats
- Add size statistics
- Fix UBSAN issue in `get_le24()`

Fixes #285

2 years agoFix endianness handling in `js_dataview_getValue` / `js_dataview_setValue`
Charlie Gordon [Sat, 23 Mar 2024 12:19:04 +0000 (13:19 +0100)]
Fix endianness handling in `js_dataview_getValue` / `js_dataview_setValue`

2 years agoImprove error handling
Charlie Gordon [Sat, 23 Mar 2024 11:58:53 +0000 (12:58 +0100)]
Improve error handling

- detect and report invalid duplicate parameter names
- throw RangeError for too many function arguments
- throw RangeError for invalid string length
- prevent `-Wcast-function-type` warnings

2 years agoImprove `JSON.stringify`
Charlie Gordon [Sat, 23 Mar 2024 11:43:45 +0000 (12:43 +0100)]
Improve `JSON.stringify`

- changed error messages
- clarify `toJSON` method usage
- simplify boxed objects handling
- for ECMA conformity, BigInt objects need a toJSON method in the prototype chain
  including boxed objects

2 years agoUse more explicit magic values for array methods
Charlie Gordon [Sat, 23 Mar 2024 08:52:23 +0000 (09:52 +0100)]
Use more explicit magic values for array methods

2 years agoSimplify redundant initializers for `JS_NewBool()`
Charlie Gordon [Sat, 23 Mar 2024 08:28:38 +0000 (09:28 +0100)]
Simplify redundant initializers for `JS_NewBool()`

2 years agoFix compilation with -DCONFIG_BIGNUM
Charlie Gordon [Fri, 22 Mar 2024 10:23:33 +0000 (11:23 +0100)]
Fix compilation with -DCONFIG_BIGNUM

- disable BigDecimal convertion in `JS_ReadBigNum`
- fix some error messages

2 years agoImprove Date.parse, small fixes
Charlie Gordon [Thu, 21 Mar 2024 23:47:17 +0000 (00:47 +0100)]
Improve Date.parse, small fixes

- add `minimum_length` to enforce array length validation
- add `JS_NewDate()` API
- add `[Symbol.toStringTag]` property in the global object
- simplify `string_get_milliseconds`
- support more timezone abbrevs using `string_get_tzabbr` and array

2 years agoAdd CI targets, fix test_std.js (#247)
Charlie Gordon [Sun, 3 Mar 2024 20:57:38 +0000 (21:57 +0100)]
Add CI targets, fix test_std.js (#247)

This switches the exec test to `SIGTERM` rather than `SIGQUIT` since the
latter didn’t seem to work in QEMU, and the distinction doesn’t really
matter for this test.

This also makes the `isatty()` check smarter by checking whether `STDIN`
is, in fact, a terminal.

Added qemu-alpine targets i386, arm32v6, arm32v7, arm64v8, s390x

Co-authored-by: Felipe Gasper <felipe@felipegasper.com>
2 years agoFix build: use LRE_BOOL in libunicode.h (#244)
Kanstantsin Sokal [Sun, 3 Mar 2024 14:36:00 +0000 (06:36 -0800)]
Fix build: use LRE_BOOL in libunicode.h (#244)

2 years agoprevent 0 length allocation in `js_worker_postMessage`
Charlie Gordon [Sun, 3 Mar 2024 13:42:01 +0000 (14:42 +0100)]
prevent 0 length allocation in `js_worker_postMessage`

2 years agoAdd github CI tests
Ben Noordhuis [Sun, 3 Mar 2024 13:14:23 +0000 (14:14 +0100)]
Add github CI tests

- disable `isatty()` test in `test_os()`
- add `.github/workflows/ci.yml` with 8 targets

2 years agoPrevent UB on memcpy and floating point conversions
Charlie Gordon [Sun, 3 Mar 2024 13:05:40 +0000 (14:05 +0100)]
Prevent UB on memcpy and floating point conversions

- add `memcpy_no_ub` that accepts null pointers for 0 count
- prevent 0 length allocation in `js_worker_postMessage`
- use safer test for `int` value in `JS_NewFloat64`,
  `JS_ToArrayLengthFree` and `js_typed_array_indexOf`

2 years agofix microbench when microbench.txt is missing (#246)
Charlie Gordon [Sun, 3 Mar 2024 02:38:49 +0000 (03:38 +0100)]
fix microbench when microbench.txt is missing (#246)

2 years agoImprove Date.parse
Charlie Gordon [Sun, 3 Mar 2024 01:59:08 +0000 (02:59 +0100)]
Improve Date.parse

- accept many more alternative date/time formats
- add test cases in tests/test_builtin.js
- match month and timezone names case insensitively
- accept AM and PM markers
- recognize US timezone names
- skip parenthesized stuff
- fix almost all v8 test cases

2 years agoImprove Number.prototype.toString for radix other than 10
Charlie Gordon [Sat, 2 Mar 2024 14:13:18 +0000 (15:13 +0100)]
Improve Number.prototype.toString for radix other than 10

- fix the conversions for integers and exact fractions
- approximate approach for other cases.
- bypass floating point conversions for JS_TAG_INT values
- avoid divisions for base 10 integer conversions

2 years agoImprove repl regexp handling
Charlie Gordon [Sat, 2 Mar 2024 13:36:44 +0000 (14:36 +0100)]
Improve repl regexp handling

- handle regexp with flags in repl completion
- group config_jscalc customisations

2 years agoImprove microbench.js
Charlie Gordon [Sun, 25 Feb 2024 23:14:31 +0000 (00:14 +0100)]
Improve microbench.js

- ensure handler behavior does not depend on n argument
- load and save reference file in node.js
- add -s filename option to name the output reference file
- add targets in Makefile for tests and bencharks using node.js
- fix incorrect timings when not using high resolution timer
- use performance timer in node.js
- output performance factor instead of percentage
- use smaller threshold by default
- add benchmarks for:
    date_parse(), prop_update(), prop_clone(), array_slice()
    global_func_call(),

2 years agoImprove Date.parse
Charlie Gordon [Sun, 25 Feb 2024 22:47:26 +0000 (23:47 +0100)]
Improve Date.parse

- rewrite Date.parse() with separate parsers
- return `NaN` for out of bounds field values as specified
- accept up to 9 decimals for millisecond fraction but truncate at 3
- accept many more alternative date/time formats
- add test cases in tests/test_builtin.js

2 years agoshow readable representation of Date objects in repl
Charlie Gordon [Sun, 25 Feb 2024 21:53:29 +0000 (22:53 +0100)]
show readable representation of Date objects in repl

2 years agoFix Map hash bug
Charlie Gordon [Thu, 22 Feb 2024 18:31:57 +0000 (19:31 +0100)]
Fix Map hash bug

- `map_hash_key` must generate the same key for JS_INT and JS_FLOAT64
   with the same value
- add test cases in tests/test_builtin.js

2 years agoRewrite `set_date_fields` to match the ECMA specification
Charlie Gordon [Wed, 21 Feb 2024 20:22:10 +0000 (21:22 +0100)]
Rewrite `set_date_fields` to match the ECMA specification

- use `double` arithmetic where necessary to match the spec
- use `volatile` to ensure correct order of evaluation
  and prevent FMA code generation
- reject some border cases.
- avoid undefined behavior in `double` -> `int64_t` conversions
- improved tests/test_builtin.js `assert` function to compare
  values more reliably.
- added some tests in `test_date()`
- disable some of these tests on win32 and cygwin targets

2 years agoAdd C API function JS_GetClassID()
Tyler Rockwood [Tue, 20 Feb 2024 08:29:08 +0000 (09:29 +0100)]
Add C API function JS_GetClassID()

If you want to extend a built-in class you need it's class ID and there
is no robust way to get that without this accessor.

* add JS_INVALID_CLASS_ID constant for invalid class ID.

Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
2 years agoImprove surrogate handling readability
Charlie Gordon [Mon, 19 Feb 2024 23:22:32 +0000 (00:22 +0100)]
Improve surrogate handling readability

- add inline function to test and convert surrogates
  is_surrogate(c), is_hi_surrogate(c), is_lo_surrogate(c),
  get_hi_surrogate(c), get_lo_surrogate(c), from_surrogate(hi, lo)
- use names for BC header offsets and lengths in libregexp.c
- remove strict aliasing violations in `lre_exec_backtrack()`
- pass all context variables to XXX_CHAR macros in `lre_exec_backtrack()`

2 years agoRename regex flag and field utf16 -> unicode
Charlie Gordon [Mon, 19 Feb 2024 15:30:08 +0000 (16:30 +0100)]
Rename regex flag and field utf16 -> unicode

- rename is_utf16 structure member to is_unicode
- rename flag LRE_FLAG_UTF16 as LRE_FLAG_UNICODE

2 years agoAdd benchmarks target
Charlie Gordon [Sun, 18 Feb 2024 16:52:35 +0000 (17:52 +0100)]
Add benchmarks target

- assuming quickjs-benchmarks is cloned in the parent directory,
- compile quickjs-benchmarks targets and run the benchmarks

2 years agoImprove run-test262
Charlie Gordon [Sun, 18 Feb 2024 14:00:04 +0000 (15:00 +0100)]
Improve run-test262

- add -t to show timings
- add -C to select compact progress meter
- default to compact progress meter if not attached to console
- set agent stack size to 2MB
- compute module filename relative to current path
- ignore `testdir` for -d and -f options
- return non zero status on errors changes

2 years agoFix big endian serialization
Charlie Gordon [Sun, 18 Feb 2024 07:29:04 +0000 (08:29 +0100)]
Fix big endian serialization

Big endian serialization was broken because:
- it partially relied on `WORDS_ENDIAN` (unconditionally undef'd in cutils.h)
- endianness was not handled at all in the bc reader.

Modifications:
- remove `WORDS_ENDIAN`
- use `bc_put_u32()` / `bc_put_u64()` in `JS_WriteBigInt()`
- use `bc_get_u32()` / `bc_get_u64()` in `JS_ReadBigInt()`
- handle host endianness in `bc_get_u16()`, `bc_get_u32()`, `bc_get_u64()` and
  `JS_ReadFunctionBytecode()`

- handle optional littleEndian argument as specified in
  `js_dataview_getValue()` and `js_dataview_setValue()`

2 years agohandle missing test262 gracefully
Charlie Gordon [Sat, 17 Feb 2024 21:57:57 +0000 (22:57 +0100)]
handle missing test262 gracefully

2 years agohandle missing test262 gracefully
Charlie Gordon [Sat, 17 Feb 2024 21:56:54 +0000 (22:56 +0100)]
handle missing test262 gracefully

2 years agoImprove tests
Charlie Gordon [Sat, 17 Feb 2024 20:54:19 +0000 (21:54 +0100)]
Improve tests

- split test_bigfloat.js from test_bignum.js
- make test_date() compatible with node
- document Date constructor string argument format:
  should add test cases for invalid strings
- test_argument_scope(): only test this syntax error in strict mode:
  `var f = function(a = eval("var arguments")) {};`

2 years agoFix UB signed integer overflow in js_math_imul
Charlie Gordon [Sat, 17 Feb 2024 20:15:29 +0000 (21:15 +0100)]
Fix UB signed integer overflow in js_math_imul

- Use uint32_t arithmetics and Standard conformant conversion to
  avoid UB in js_math_imul.
- add builtin tests
- use specific object directories for SAN targets

2 years agoFix UB left shift of negative number
Ben Noordhuis [Wed, 1 Nov 2023 05:53:16 +0000 (06:53 +0100)]
Fix UB left shift of negative number

2 years agoRemove unnecessary ssize_t posix-ism
Ben Noordhuis [Fri, 16 Feb 2024 09:25:29 +0000 (10:25 +0100)]
Remove unnecessary ssize_t posix-ism

ssize_t is not always available and the cast it was used in wasn't
necessary in the first place, the value already has the right type.

Note that the field malloc_limit is an int64_t in JSMemoryUsage whereas it
is a size_t in JSMallocState.

2 years agoImprove string concatenation hack
Charlie Gordon [Thu, 15 Feb 2024 09:30:04 +0000 (10:30 +0100)]
Improve string concatenation hack

- add more cases of in place string concatenation
  this temporary hack improves the microbench timing by 30% but
  has little impact on the test262 timings.

2 years agopass node-js command line arguments to microbench
Charlie Gordon [Thu, 15 Feb 2024 08:59:50 +0000 (09:59 +0100)]
pass node-js command line arguments to microbench

2 years agoReverse e140122202cc24728b394f8f90fa2f4a2d7c397e
Charlie Gordon [Tue, 13 Feb 2024 08:45:58 +0000 (09:45 +0100)]
Reverse e140122202cc24728b394f8f90fa2f4a2d7c397e

- remove temporary fix for MemorySanitizer:
  setting p->u.array.count to 0 silenced a warning in JS_GetPropertyValue on a
  hacky test agains the length of fast_array object.
  This hack was removed by commit c3635861f63931255c7a953bccbb0e2e90cc75aa.

2 years agoFix test262 error
Charlie Gordon [Mon, 12 Feb 2024 17:37:37 +0000 (18:37 +0100)]
Fix test262 error

- force evaluation order in `set_date_fields`
- fix evaluation error in test262/test/built-ins/Date/UTC/fp-evaluation-order.js:19:
  unexpected error: Test262Error: precision in MakeDate Expected SameValue(«34448384», «34447360») to be true

2 years agoFix compiler warnings
Charlie Gordon [Mon, 12 Feb 2024 17:35:27 +0000 (18:35 +0100)]
Fix compiler warnings

2 years agoSimplify and clarify URL quoting js_std_urlGet
Charlie Gordon [Mon, 12 Feb 2024 17:34:52 +0000 (18:34 +0100)]
Simplify and clarify URL quoting js_std_urlGet

2 years agoFreeBSD QuickJS Patch (#203)
Nick Vatamaniuc [Mon, 12 Feb 2024 10:28:00 +0000 (05:28 -0500)]
FreeBSD QuickJS Patch (#203)

2 years agoFix shell injection bug in std.urlGet (#61)
Felix S [Mon, 12 Feb 2024 10:20:25 +0000 (10:20 +0000)]
Fix shell injection bug in std.urlGet (#61)

2 years agoadd gitignore for build objects (#84)
Sam [Mon, 12 Feb 2024 09:28:38 +0000 (09:28 +0000)]
add gitignore for build objects (#84)

Signed-off-by: Samuel Hellawell <sshellawell@gmail.com>
Co-authored-by: Charlie Gordon <github@chqrlie.org>
2 years agoFix sloppy mode arguments uninitialized value use
Ben Noordhuis [Wed, 1 Nov 2023 03:24:42 +0000 (04:24 +0100)]
Fix sloppy mode arguments uninitialized value use

MemorySanitizer complained about uninitialized reads in
the indexed property code path in JS_GetPropertyValue()
with JS_CLASS_MAPPED_ARGUMENTS objects.

2 years agoRemove unsafe sprintf() and strcat() calls
Ben Noordhuis [Wed, 1 Nov 2023 21:16:59 +0000 (22:16 +0100)]
Remove unsafe sprintf() and strcat() calls

Prep work for enabling the sanitizers on macos CI since they are marked
as deprecated and cause the build to fail when -Werror is enabled.

2 years agoFix undefined behavior (UBSAN)
Charlie Gordon [Sun, 11 Feb 2024 20:32:36 +0000 (21:32 +0100)]
Fix undefined behavior (UBSAN)

2 years agoFix UB in js_dtoa1
Saúl Ibarra Corretgé [Fri, 22 Dec 2023 21:50:02 +0000 (22:50 +0100)]
Fix UB in js_dtoa1

2 years agoAdd UndefinedBehaviorSanitizer support
Ben Noordhuis [Wed, 1 Nov 2023 04:00:43 +0000 (05:00 +0100)]
Add UndefinedBehaviorSanitizer support

2 years agoAdd MemorySanitizer support
Ben Noordhuis [Wed, 1 Nov 2023 03:30:34 +0000 (04:30 +0100)]
Add MemorySanitizer support

2 years agoUnbroke tests/test_test_bjson.js
Ben Noordhuis [Wed, 29 Nov 2023 07:50:53 +0000 (08:50 +0100)]
Unbroke tests/test_test_bjson.js

2 years agoAdd more tests
Ben Noordhuis [Wed, 29 Nov 2023 07:50:53 +0000 (08:50 +0100)]
Add more tests

- add regexp tests in tests/microbench.js
- add bjson_test_regexp in tests/test_test_bjson.js

2 years agoFix runtime bugs
Charlie Gordon [Sun, 11 Feb 2024 11:49:40 +0000 (12:49 +0100)]
Fix runtime bugs

- fix string leak in `js_printf_internal` on errors
- read `errno` before potential side effects in `js_os_stat`

2 years agoImprove microbench
Charlie Gordon [Sun, 11 Feb 2024 11:11:53 +0000 (12:11 +0100)]
Improve microbench

- remove import statements (invoke with qjs --std)
- fix compatibility issues with node
- add more loop styles
- add more string concatenation tests
- use === and !=== where appropriate
- fix sort timing log
- add `-r ref_file` command line option to specify reference file
- add .gitignore file with target file patterns

2 years agoFix test262o error
Charlie Gordon [Sat, 10 Feb 2024 19:54:29 +0000 (20:54 +0100)]
Fix test262o error

- excude test262o/test/suite/ch15/15.5/15.5.4/15.5.4.9/15.5.4.9_CE.js:
  Test262 Error: String.prototype.localeCompare considers ö (\u006f\u0308) = ö (\u00f6).

2 years agoStrip trailing spaces
Charlie Gordon [Sat, 10 Feb 2024 15:18:11 +0000 (16:18 +0100)]
Strip trailing spaces

2 years agoavoid using INT64_MAX in double comparisons because it cannot be exactly represented...
Fabrice Bellard [Sat, 3 Feb 2024 14:48:57 +0000 (15:48 +0100)]
avoid using INT64_MAX in double comparisons because it cannot be exactly represented as a double (bnoordhuis)

2 years agofixed MingW64 install on Windows (absop) (github issue #230)
Fabrice Bellard [Sat, 3 Feb 2024 14:48:09 +0000 (15:48 +0100)]
fixed MingW64 install on Windows (absop) (github issue #230)

2 years agofixed Promise return in the REPL by using a wrapper object in async std.evalScript...
Fabrice Bellard [Sat, 3 Feb 2024 14:47:42 +0000 (15:47 +0100)]
fixed Promise return in the REPL by using a wrapper object in async std.evalScript() (github issue #231)

2 years agoexport JS_GetModuleNamespace (github issue #34)
Fabrice Bellard [Sat, 27 Jan 2024 12:27:32 +0000 (13:27 +0100)]
export JS_GetModuleNamespace (github issue #34)

2 years agosimplified and fixed arrow function parsing (github issue #226)
Fabrice Bellard [Sat, 27 Jan 2024 12:12:54 +0000 (13:12 +0100)]
simplified and fixed arrow function parsing (github issue #226)

2 years agoupdate test results
Fabrice Bellard [Sat, 27 Jan 2024 12:12:37 +0000 (13:12 +0100)]
update test results

2 years agofixed js_std_await() in case 'obj' is not a promise (github issue #222)
Fabrice Bellard [Mon, 22 Jan 2024 17:03:35 +0000 (18:03 +0100)]
fixed js_std_await() in case 'obj' is not a promise (github issue #222)

2 years agofixed and simplified setTimeout() by using an integer timer handle (github issue...
Fabrice Bellard [Fri, 19 Jan 2024 09:20:34 +0000 (10:20 +0100)]
fixed and simplified setTimeout() by using an integer timer handle (github issue #218)

2 years agoadded js_std_await() and use it to wait for the evaluation of a module (github issue...
Fabrice Bellard [Fri, 19 Jan 2024 09:19:58 +0000 (10:19 +0100)]
added js_std_await() and use it to wait for the evaluation of a module (github issue #219)

2 years agoupdate Changelog
Fabrice Bellard [Fri, 19 Jan 2024 09:18:32 +0000 (10:18 +0100)]
update Changelog

2 years agonew release
Fabrice Bellard [Sat, 13 Jan 2024 10:16:02 +0000 (11:16 +0100)]
new release

2 years agoallow override of PREFIX, CROSS_PREFIX, CFLAGS and LDFLAGS in Makefile (humenda)
Fabrice Bellard [Sat, 13 Jan 2024 10:15:28 +0000 (11:15 +0100)]
allow override of PREFIX, CROSS_PREFIX, CFLAGS and LDFLAGS in Makefile (humenda)