]>
git.kaiwu.me - njs.git/log
Dmitry Volyntsev [Wed, 20 Mar 2024 04:05:51 +0000 (21:05 -0700)]
Modules: fixed clear() method of a shared dictionary without timeout.
Previously, the code did not unlock the rwlock when a dict was empty.
The issue was introduced in
4a15613f4e8b (0.8.3).
This closes issue #699 on Github.
Dmitry Volyntsev [Tue, 19 Mar 2024 05:24:57 +0000 (22:24 -0700)]
Shell: added completions for QuickJS engine.
Dmitry Volyntsev [Tue, 19 Mar 2024 05:15:48 +0000 (22:15 -0700)]
Shell: completions are refactored and moved out of the core.
Dmitry Volyntsev [Sat, 16 Mar 2024 06:14:39 +0000 (23:14 -0700)]
Introduced njs_vm_value_enumerate() and njs_vm_value_own_enumerate().
Dmitry Volyntsev [Sat, 16 Mar 2024 05:47:50 +0000 (22:47 -0700)]
Refactoring njs_value_own_enumerate() and friends.
All three flag-like arguments are merged into a single flag argument.
Dmitry Volyntsev [Fri, 15 Mar 2024 06:28:03 +0000 (23:28 -0700)]
Introduced njs_vm_prototype() to get a value's prototype.
Dmitry Volyntsev [Fri, 15 Mar 2024 06:28:03 +0000 (23:28 -0700)]
Introduced njs_vm_global() to get global object.
Dmitry Volyntsev [Tue, 5 Mar 2024 19:43:49 +0000 (11:43 -0800)]
Fixed typo introduced in
eb01434865d7 .
Dmitry Volyntsev [Fri, 1 Mar 2024 04:56:56 +0000 (20:56 -0800)]
HTTP: allowing to set Server header.
Dmitry Volyntsev [Fri, 1 Mar 2024 02:56:13 +0000 (18:56 -0800)]
Shell: revert -t option back to preserve backward compatibility.
The issue was introduced in
cb3e068a511c .
Dmitry Volyntsev [Wed, 28 Feb 2024 07:25:11 +0000 (23:25 -0800)]
Removed duplicate expect tests introduced in
cb3e068a511c .
Dmitry Volyntsev [Wed, 28 Feb 2024 07:25:05 +0000 (23:25 -0800)]
Shell: fixed memory pool issues introduced in
cb3e068a511c .
Dmitry Volyntsev [Wed, 28 Feb 2024 07:24:55 +0000 (23:24 -0800)]
Simplified working with global value.
Dmitry Volyntsev [Fri, 23 Feb 2024 04:25:43 +0000 (20:25 -0800)]
Shell: added QuickJS engine support.
Dmitry Volyntsev [Fri, 23 Feb 2024 01:38:58 +0000 (17:38 -0800)]
Fixed atob() with non-padded base64 strings.
This fixes #695 issue on Github.
Dmitry Volyntsev [Thu, 15 Feb 2024 05:34:02 +0000 (21:34 -0800)]
Moving hash code out of the njs core.
Dmitry Volyntsev [Thu, 15 Feb 2024 05:33:56 +0000 (21:33 -0800)]
Moved njs_time() out of the core as it is not a part of the spec.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:02 +0000 (17:57 -0800)]
Test262: fix import_global_ref_var.t.js.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:01 +0000 (17:57 -0800)]
Test262: simplified import_chain.t.js.
Avoid using "crypto" module, which unnessesary complicates the test.
Dmitry Volyntsev [Thu, 8 Feb 2024 01:57:01 +0000 (17:57 -0800)]
Removed njs_file.c not needed after
8aad26845b18 (0.8.3).
Dmitry Volyntsev [Thu, 8 Feb 2024 01:56:59 +0000 (17:56 -0800)]
Version bump.
Dmitry Volyntsev [Wed, 7 Feb 2024 16:34:17 +0000 (08:34 -0800)]
Added tag 0.8.3 for changeset
3aba7ee62080
Dmitry Volyntsev [Wed, 7 Feb 2024 16:34:00 +0000 (08:34 -0800)]
Version 0.8.3.
Dmitry Volyntsev [Wed, 7 Feb 2024 03:32:08 +0000 (19:32 -0800)]
Reverted changes introduced in
7eaaa7d57636 (not released) back.
Relative importing is again supported.
Dmitry Volyntsev [Thu, 1 Feb 2024 01:06:58 +0000 (17:06 -0800)]
HTTP: fixed stub_status statistic when js_periodic is enabled.
Previously, when js_periodic is enabled the Reading statistic
was growing each time the js_periodic handler was called.
The issue was introduced in
f1bd0b1db065 (0.8.1).
This fixes #692 issue on Github.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:08 +0000 (17:16 -0800)]
Style.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:07 +0000 (17:16 -0800)]
2024 year.
Dmitry Volyntsev [Tue, 30 Jan 2024 01:16:01 +0000 (17:16 -0800)]
Test262: handling the mkdir issue with a host file system.
Vadim Zhestikov [Mon, 29 Jan 2024 16:57:49 +0000 (08:57 -0800)]
Fixed parsing of hex, oct and binary literals with no digits.
Vadim Zhestikov [Mon, 29 Jan 2024 16:57:48 +0000 (08:57 -0800)]
Fixed parsing of for-statement.
Dmitry Volyntsev [Thu, 25 Jan 2024 22:48:05 +0000 (14:48 -0800)]
Fixed fuzzer build after
9b3dac56fd8a .
Dmitry Volyntsev [Wed, 24 Jan 2024 00:34:10 +0000 (16:34 -0800)]
Moving out HostLoadImportedModule from njs core.
HostLoadImportedModule should be implemented by host
environment according to ECMAScript specs.
The following method was removed: njs_vm_add_path().
Dmitry Volyntsev [Wed, 24 Jan 2024 00:33:52 +0000 (16:33 -0800)]
Change: imported modules are not resolved relative to current dir.
Previously, when a module was imported with a relative path
it was looked for first in the directory of the importing context
(global, or a module).
For example when:
main.js:
import libs/lib1.js;
libs/lib1.js:
import lib2.js;
lib2.js was looked for first in libs/.
Now, it is only looked for in directories speficied with js_path
and a directory of nginx configuration file.
Dmitry Volyntsev [Wed, 24 Jan 2024 00:33:29 +0000 (16:33 -0800)]
Shell: fixed unhandled rejected promises handling.
The issue was introduced in
dffdf7c50dfc (not released yet).
Dmitry Volyntsev [Fri, 19 Jan 2024 02:03:35 +0000 (18:03 -0800)]
Moving out HostPromiseRejectionTracker from njs core.
HostPromiseRejectionTracker should be implemented by host
environment according to ECMAScript specs.
The following method was removed: njs_vm_unhandled_rejection().
The following method was introduced: njs_vm_set_rejection_tracker().
Dmitry Volyntsev [Fri, 19 Jan 2024 02:03:24 +0000 (18:03 -0800)]
Fixed tracking of unhandled rejected promises.
Checking for unhandled promise rejections while looping for pending jobs
produces false-positive reports when an rejected promised is handled
by one of the pending jobs later.
The fix is to check for unhandled promise rejections only at top level
calls like ngx_js_name_invoke() and ngx_js_name_call() and only after
all pending jobs are processed.
The issue was introduced in
bc80bcb3102c (not released yet).
Dmitry Volyntsev [Thu, 11 Jan 2024 23:13:47 +0000 (15:13 -0800)]
HTTP: avoiding arithmetic ops with NULL pointer in r.args getter.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Thu, 11 Jan 2024 23:13:43 +0000 (15:13 -0800)]
QueryString: avoiding arithmetic ops with NULL in parse().
Found by UndefinedBehaviorSanitizer.
Vadim Zhestikov [Thu, 11 Jan 2024 00:26:35 +0000 (16:26 -0800)]
Removed unused field from njs_vmcode_t.
Dmitry Volyntsev [Wed, 10 Jan 2024 01:56:19 +0000 (17:56 -0800)]
Fixed potential buffer overread in String.prototype.match().
Dmitry Volyntsev [Tue, 9 Jan 2024 17:14:42 +0000 (09:14 -0800)]
Avoiding arithmetic ops with NULL in %TypedArray%.prototype.sort().
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 06:21:14 +0000 (22:21 -0800)]
Avoiding casting Infinity to integer in String.fromCodePoint().
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 06:20:19 +0000 (22:20 -0800)]
Avoiding arithmetic operations with NULL pointer in TextDecoder().
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 06:20:10 +0000 (22:20 -0800)]
Avoiding casting NaN value to int64_t in njs.dump().
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 06:19:59 +0000 (22:19 -0800)]
Avoiding pointer wraparound for padded integer specifier.
Previously, when integer was larger than the padded width in a integer
specifier, the "end" pointer was evaluated to a value before "buf"
pointer.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Sun, 30 Jul 2023 09:21:51 +0000 (10:21 +0100)]
Ignoring UndefinedBehaviorSanitizer warnings where appropriate.
Prodded by David Carlier and Ben Kallus.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
Fixed RegExp.prototype.exec() when second argument is absent.
Previously, when the second argument is undefined, NaN is casted to
unsigned which is undefined behavior.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
Improved array enumeration with length 0.
The fix eliminates an arithmetic operation with NULL pointer.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
Fixed initialization of external prototypes with object entry.
When external was NULL (for example, when .u.object.properties is not
declared), an arithmetic operation was performed with NULL pointer which
is undefined behavior.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
QueryString: fixed underflow in parse().
Previously, njs_query_string_append() might be provided with invalid
val_size value when value in a key-value pair was absent.
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
Fixed external values initialization in unit tests.
Since 0.8.0 modules can create their own constructors and prototypes.
A modules has two method: preinit() and init(). A module should
add its constructors and prototypes in preinit() and create its own
values in init(). Creating a value in preinit() results in an error.
The patch fixes the issue by creating an external value in init()
instead of preinit().
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:42 +0000 (16:40 -0800)]
Unifying hash function prototypes.
This fixes UndefinedBehaviorSanitizer warning "call to function through
pointer to incorrect function type".
Found by UndefinedBehaviorSanitizer.
Dmitry Volyntsev [Tue, 9 Jan 2024 00:40:27 +0000 (16:40 -0800)]
Fixed Date constructor for overflows and with NaN values.
Found by UndefinedBehaviorSanitizer.
Vadim Zhestikov [Tue, 19 Dec 2023 20:37:05 +0000 (12:37 -0800)]
Modules: fixed clear() method of a shared dictionary without timeout.
This fixes #690 issue on Github.
Dmitry Volyntsev [Fri, 15 Dec 2023 06:32:02 +0000 (22:32 -0800)]
Moving out logger from njs core.
Logger is not part of the JS runtime according to ECMAScript and should
be implemented by host environment.
Dmitry Volyntsev [Thu, 14 Dec 2023 02:38:47 +0000 (18:38 -0800)]
Introduced njs_vm_set_module_loader().
Vadim Zhestikov [Tue, 12 Dec 2023 03:10:38 +0000 (19:10 -0800)]
Removed not required argument for JSON functions.
Vadim Zhestikov [Tue, 12 Dec 2023 03:10:36 +0000 (19:10 -0800)]
Removed not used arg from njs_get_own_ordered_keys().
Dmitry Volyntsev [Tue, 5 Dec 2023 16:54:18 +0000 (08:54 -0800)]
Refactored asynchronous events.
To align njs with other JS engines, async events are removed from njs
core. The following functions were removed: njs_vm_add_event(),
njs_vm_del_event(), njs_vm_waiting(). Instead the host is expected
to manage async events by itself.
In addition, the posted events are renamed to jobs, to better align with
the ECMA specs. The following methods are removed: njs_vm_run().
Instead, the host is expected to call njs_vm_execute_pending_job() in a
loop to execute pending jobs. The following functions were added:
njs_vm_enqueue_job().
Vadim Zhestikov [Thu, 30 Nov 2023 04:46:36 +0000 (20:46 -0800)]
Removed remnants of GC code.
The code never worked and comments are in a broken state.
Vadim Zhestikov [Thu, 30 Nov 2023 04:46:32 +0000 (20:46 -0800)]
Fixed memory over-read in njs_utf8_prev() and njs_utf8_next().
Previously, njs_utf8_next() might over-read up to 1 byte
beyond the string memory. Whereas njs_utf8_prev() might
over-read unlimited number of bytes before the string.
Dmitry Volyntsev [Thu, 30 Nov 2023 02:43:45 +0000 (18:43 -0800)]
Modules: simplified setTimeout() timer callback.
Dmitry Volyntsev [Thu, 30 Nov 2023 02:43:37 +0000 (18:43 -0800)]
Tests: detection when "xml" module is disabled.
Dmitry Volyntsev [Tue, 28 Nov 2023 02:43:36 +0000 (18:43 -0800)]
XML: fixed building with libxml2 2.12 and later.
This fixes #684 issue on Github.
Dmitry Volyntsev [Tue, 28 Nov 2023 02:43:04 +0000 (18:43 -0800)]
Remove njs_timer.c forgotten in the previous commit.
Dmitry Volyntsev [Tue, 21 Nov 2023 17:00:52 +0000 (09:00 -0800)]
Moving out setTimeout() and clearTimeout() from njs core.
This functions are not part of the ECMAScript and should be
implemented by host environment.
Dmitry Volyntsev [Tue, 21 Nov 2023 16:57:09 +0000 (08:57 -0800)]
Renaming ngx_js_retval() to ngx_js_exception().
After previous commit ngx_js_retval() is only used for getting the
exception value and should be renamed to better reflect the purpose.
Dmitry Volyntsev [Tue, 21 Nov 2023 16:57:03 +0000 (08:57 -0800)]
Modules: fixed js_set with Buffer values.
Previously, a Buffer value which contains invalid UTF-8 when returned as a
value for js_set handler was mangled because the bytes value was converted to a
string value.
The fix is to use bytes value of Buffer, TypedArray and ArrayBuffer as is,
and not convert it to a string first.
Vadim Zhestikov [Tue, 21 Nov 2023 14:49:30 +0000 (06:49 -0800)]
Fixed memory overlapping.
Dmitry Volyntsev [Wed, 15 Nov 2023 23:08:18 +0000 (15:08 -0800)]
Tests: added console test for stream module.
Dmitry Volyntsev [Wed, 15 Nov 2023 23:07:20 +0000 (15:07 -0800)]
Fetch: fixed Headers.set().
This closes #680 issue on Github.
Dmitry Volyntsev [Fri, 10 Nov 2023 01:09:16 +0000 (17:09 -0800)]
Shell: refactored njs_process_file().
The reading part is separated into njs_read_file().
Dmitry Volyntsev [Thu, 9 Nov 2023 19:49:25 +0000 (11:49 -0800)]
Shell: moving njs_vm_opt_t initialisation to njs_create_vm().
Dmitry Volyntsev [Thu, 9 Nov 2023 19:11:19 +0000 (11:11 -0800)]
Shell: unified normal mode and LLVMFuzzerTestOneInput().
Now both main() and LLVMFuzzerTestOneInput() use njs_main()
as a main routine.
Dmitry Volyntsev [Tue, 7 Nov 2023 23:35:35 +0000 (15:35 -0800)]
Fixed include directories order.
Previously, when the previous version of njs.h is installed, an outdated
version of njs.h might be included causing build failures.
The fix is to ensure that the local include directories are included
first.
Dmitry Volyntsev [Tue, 7 Nov 2023 23:35:25 +0000 (15:35 -0800)]
Removed leftover njs directory include directory path.
Dmitry Volyntsev [Tue, 7 Nov 2023 23:35:18 +0000 (15:35 -0800)]
Version bump.
Dmitry Volyntsev [Tue, 24 Oct 2023 04:42:43 +0000 (21:42 -0700)]
Added tag 0.8.2 for changeset
45f81882c780
Dmitry Volyntsev [Tue, 24 Oct 2023 04:42:29 +0000 (21:42 -0700)]
Version 0.8.2.
Vadim Zhestikov [Tue, 24 Oct 2023 04:19:03 +0000 (21:19 -0700)]
Parser: fixed return statement parsing with invalid expression.
Dmitry Volyntsev [Fri, 20 Oct 2023 15:44:52 +0000 (08:44 -0700)]
Modules: fixed delete() method of a shared dictionary.
This fixes #679 issue on Github.
Dmitry Volyntsev [Thu, 19 Oct 2023 01:36:00 +0000 (18:36 -0700)]
XML: fixed compilation with certain GCC versions.
external/njs_xml_module.c:541:16: error: 'name.length' may be used
uninitialized [-Werror=maybe-uninitialized]
541 | if (name.length != njs_strlen(node->name).
Dmitry Volyntsev [Wed, 18 Oct 2023 00:51:39 +0000 (17:51 -0700)]
Fixed RegExp.prototype.exec() with global regexp and unicode input.
Previously, when exactly 32 characters unicode string was provided and
the "lastIndex" value of "this" regexp was equal to 32 too, the
njs_string_utf8_offset() was called with invalid index argument (longer
than a size of the string). As a result njs_string_utf8_offset()
returned garbage values.
This was manifested in the following ways:
1) InternalError: pcre2_match() failed: bad offset value
2) Very slow replace calls with global regexps, for
example in expressions like: str.replace(/<re>/g).
This fixes #677 on Github.
Dmitry Volyntsev [Tue, 17 Oct 2023 01:09:37 +0000 (18:09 -0700)]
Modules: fixed items() method of a shared dictionary.
Previously, under a memory pressure the method might return
prematurely while still holding the mutex for the shared memory.
This fixes #676 issue on Github.
Dmitry Volyntsev [Fri, 6 Oct 2023 23:52:23 +0000 (16:52 -0700)]
Fixed Array.prototype.sort() with --debug=YES and --debug-memory=YES.
Previously, --debug-memory=YES activated a different allocation
mechanism that was not able to properly handle the 0 size allocation.
Specifically, njs_mp_free() failed to find a block to free when the size
of the block is 0.
The fix is to alloc at least 1 byte in the --debug-memory=YES mode.
Dmitry Volyntsev [Fri, 6 Oct 2023 23:51:53 +0000 (16:51 -0700)]
Fixed RegExp.prototype.replace().
The issue was introduced in
cf85d0f8640a .
Dmitry Volyntsev [Fri, 6 Oct 2023 23:49:59 +0000 (16:49 -0700)]
Fixed RegExp.prototype.split().
The issue was introduced in
c0aad58cfadb .
Dmitry Volyntsev [Wed, 4 Oct 2023 22:00:02 +0000 (15:00 -0700)]
XML: fixed exception handling.
This closes #675 issue on Github.
Dmitry Volyntsev [Wed, 4 Oct 2023 20:35:38 +0000 (13:35 -0700)]
Improved memory footprint of RegExp.prototype.split().
Dmitry Volyntsev [Wed, 4 Oct 2023 01:09:06 +0000 (18:09 -0700)]
Improved memory footprint of RegExp.prototype.replace().
Dmitry Volyntsev [Tue, 3 Oct 2023 07:39:04 +0000 (00:39 -0700)]
Improved memory footprint of RegExp.prototype.test().
Dmitry Volyntsev [Sat, 30 Sep 2023 04:41:34 +0000 (21:41 -0700)]
FS: introduced fs.existsSync().
Dmitry Volyntsev [Fri, 29 Sep 2023 02:09:56 +0000 (19:09 -0700)]
RegExp: improved memory footprint when match fails.
Dmitry Volyntsev [Fri, 29 Sep 2023 01:11:15 +0000 (18:11 -0700)]
Stream: adjusted periodic timeout in tests.
Dmitry Volyntsev [Thu, 28 Sep 2023 18:00:56 +0000 (11:00 -0700)]
Fetch: fixed HEAD response handling with large Content-Length.
This closes #658 issue on Github.
Dmitry Volyntsev [Fri, 22 Sep 2023 20:00:06 +0000 (13:00 -0700)]
Modules: introduced console object.
The following methods were added: dump(), error(), info(),
log(), time(), timeEnd(), warn().
Dmitry Volyntsev [Fri, 22 Sep 2023 20:00:05 +0000 (13:00 -0700)]
Introduced API to work with external value pointers.
This allows to allocate the necessary context for external
code on demand.
Dmitry Volyntsev [Fri, 22 Sep 2023 20:00:04 +0000 (13:00 -0700)]
Modules: added debug log for vm cloning and destroying.
Dmitry Volyntsev [Thu, 21 Sep 2023 19:40:53 +0000 (12:40 -0700)]
Shell: simplified console.time()/timeEnd() pair.
Using a queue instead of a hash here because we assume that the
number of profile timers will be low.
Dmitry Volyntsev [Thu, 21 Sep 2023 04:48:41 +0000 (21:48 -0700)]
Shell: introduced error, info and warn methods for console object.