]> git.kaiwu.me - njs.git/log
njs.git
18 months agoImproved error messages for module loading failures.
Dmitry Volyntsev [Sat, 19 Oct 2024 01:24:49 +0000 (18:24 -0700)]
Improved error messages for module loading failures.

There are several reasons why a file cannot be opened. Without
extra information, especially in containerized environments, these
problems are difficult to debug. Adding errno status to the
error output helps identify the root cause.

Additionally, error messages are now aligned between njs and QuickJS.

18 months agoFS: introduced fs.readlinkSync() and friends.
Dmitry Volyntsev [Sat, 19 Oct 2024 05:01:58 +0000 (22:01 -0700)]
FS: introduced fs.readlinkSync() and friends.

This closes #802 feature request on Github.

18 months agoTests: added js_body_filter test with non-UTF8 data.
Dmitry Volyntsev [Fri, 18 Oct 2024 01:44:17 +0000 (18:44 -0700)]
Tests: added js_body_filter test with non-UTF8 data.

To test for implicit UTF8 conversion.

18 months agoHTTP: added strict check for js_body_filter syntax.
Dmitry Volyntsev [Fri, 18 Oct 2024 01:31:26 +0000 (18:31 -0700)]
HTTP: added strict check for js_body_filter syntax.

18 months agoImplemented lazy stack symbolization.
Dmitry Volyntsev [Wed, 16 Oct 2024 01:28:19 +0000 (18:28 -0700)]
Implemented lazy stack symbolization.

Previously, when an exception was thrown, the exception got 'stack'
property attached which contained the backtrace information about where
the exception happened. This could be a heavy operation and it was not
always needed.

To optimize it, the process is split into 2 phases. The first phase
collects all the necessary info about the current stack. The second
phase, where the stack symbolization happens, occurs only when this
property is referenced.

18 months agoCI: aligned asan build with with post-commit CI asan build.
Dmitry Volyntsev [Tue, 15 Oct 2024 06:12:16 +0000 (23:12 -0700)]
CI: aligned asan build with with post-commit CI asan build.

18 months agoFixed dead store assignment in r.subrequest().
Dmitry Volyntsev [Sat, 12 Oct 2024 01:41:27 +0000 (18:41 -0700)]
Fixed dead store assignment in r.subrequest().

Found by Clang static analyzer.

18 months agoModules: removed extra VMs creation when it is not needed.
Dmitry Volyntsev [Sat, 12 Oct 2024 00:23:42 +0000 (17:23 -0700)]
Modules: removed extra VMs creation when it is not needed.

Previously, a new VM instance was created for every location. This is
not needed and consumes a lot of memory for large configurations.
Instead, if no new js_import is introduced on the location level server
level VM should be used.

The issue was introduced in 9b674412 (0.8.6).

This fixes #795 issue on Github.

19 months agoFixed Buffer.prototype.indexOf() on 32bits platforms.
Dmitry Volyntsev [Thu, 10 Oct 2024 23:33:13 +0000 (16:33 -0700)]
Fixed Buffer.prototype.indexOf() on 32bits platforms.

19 months agoCI: added 32bit test in check-pr job.
Dmitry Volyntsev [Fri, 11 Oct 2024 01:03:38 +0000 (18:03 -0700)]
CI: added 32bit test in check-pr job.

19 months agoFixed Buffer.prototype.indexOf() and friends.
Dmitry Volyntsev [Thu, 10 Oct 2024 01:25:52 +0000 (18:25 -0700)]
Fixed Buffer.prototype.indexOf() and friends.

With empty buffers in both the self and search cases.

19 months agoFixed Buffer.prototype.lastIndexOf() when `from` is provided.
Dmitry Volyntsev [Thu, 10 Oct 2024 00:59:26 +0000 (17:59 -0700)]
Fixed Buffer.prototype.lastIndexOf() when `from` is provided.

Previous incorrect fix was introduced in 5d15a8d6 (0.8.5).

19 months agoFixed heap-buffer-overflow in Buffer.prototype.indexOf().
Dmitry Volyntsev [Thu, 10 Oct 2024 00:32:11 +0000 (17:32 -0700)]
Fixed heap-buffer-overflow in Buffer.prototype.indexOf().

Previously, when `from` argument was provided heap-buffer-overflow might
happen due to lack of boundary check. `to = njs_min(to, length)`
statement was also removed because it has no effect, `to` is
equal to `length` here.

The issue was introduced in 5d15a8d6 (0.8.5).

This closes #794 issue on Github.

19 months agoTest262: reporting name of the testsuite for a failed test.
Dmitry Volyntsev [Wed, 9 Oct 2024 23:05:26 +0000 (16:05 -0700)]
Test262: reporting name of the testsuite for a failed test.

19 months agoOptimized qjs_to_bytes().
Dmitry Volyntsev [Tue, 8 Oct 2024 05:46:40 +0000 (22:46 -0700)]
Optimized qjs_to_bytes().

Doing JS_IsString() check first before a heavy-weight call to
JS_GetTypedArrayBuffer() which throws an exception when argument is not
a typed array.

19 months agoOptimized ngx_qjs_string().
Dmitry Volyntsev [Tue, 8 Oct 2024 05:41:24 +0000 (22:41 -0700)]
Optimized ngx_qjs_string().

Doing JS_IsString() check first before a heavy-weight call to
JS_GetTypedArrayBuffer() which throws an exception when argument is not
a typed array.

19 months agoBenchmark: code is rewritten using public API.
Dmitry Volyntsev [Tue, 8 Oct 2024 02:08:53 +0000 (19:08 -0700)]
Benchmark: code is rewritten using public API.

19 months agoRemoved deprecated njs_string_set().
Dmitry Volyntsev [Tue, 8 Oct 2024 01:51:03 +0000 (18:51 -0700)]
Removed deprecated njs_string_set().

19 months agoStyle.
Dmitry Volyntsev [Tue, 8 Oct 2024 01:12:12 +0000 (18:12 -0700)]
Style.

19 months agoFixed dead store assignment in TextEncoder.encodeInto().
Dmitry Volyntsev [Wed, 25 Sep 2024 05:07:44 +0000 (22:07 -0700)]
Fixed dead store assignment in TextEncoder.encodeInto().

Found by Clang static analyzer.

19 months agoTests: external code for unit tests is rewritten using public API.
Dmitry Volyntsev [Tue, 8 Oct 2024 00:57:08 +0000 (17:57 -0700)]
Tests: external code for unit tests is rewritten using public API.

This part was missed in 24b56ef88 (0.8.0).

19 months agoRemoved deprecated $262.byteString().
Dmitry Volyntsev [Tue, 8 Oct 2024 00:50:19 +0000 (17:50 -0700)]
Removed deprecated $262.byteString().

19 months agoVersion bump.
Dmitry Volyntsev [Tue, 8 Oct 2024 01:09:47 +0000 (18:09 -0700)]
Version bump.

19 months agoVersion 0.8.6. 0.8.6
Dmitry Volyntsev [Fri, 27 Sep 2024 00:47:07 +0000 (17:47 -0700)]
Version 0.8.6.

19 months agoCI: Run a check-pr job on a specific Ubuntu version.
Konstantin Pavlov [Thu, 26 Sep 2024 20:41:42 +0000 (13:41 -0700)]
CI: Run a check-pr job on a specific Ubuntu version.

GitHub is going to change the latest tag to point to 24.04 soon, so
let's be proactive and pin to a specific version.

With that change, we'd also need to drop the _FORTIFY_SOURCE definition
since it now has a stricter default on Ubuntu 24.04.

19 months agoHTTP: fixed r.return() with empty string as a body argument.
Dmitry Volyntsev [Wed, 18 Sep 2024 05:58:31 +0000 (22:58 -0700)]
HTTP: fixed r.return() with empty string as a body argument.

19 months agoHTTP: fixed r.subrequest() check for nested subrequests.
Dmitry Volyntsev [Wed, 18 Sep 2024 02:17:09 +0000 (19:17 -0700)]
HTTP: fixed r.subrequest() check for nested subrequests.

The issue was introduced in a14be61c86 (0.8.5).

This fixes #783 on Github.

19 months agoModules: introduced QuickJS engine.
Dmitry Volyntsev [Sat, 15 Jun 2024 03:54:28 +0000 (20:54 -0700)]
Modules: introduced QuickJS engine.

"js_engine" directive is introduced which sets JavaScript engine.
When the module is built with QuickJS library "js_engine qjs;" sets
QuickJS engine for the current block. By default njs engine is used.

For example,

nginx.conf:

    location /a {
        js_engine qjs;
        # will be handled by QuickJS
        js_content main.handler;
    }

    location /b {
        # will be handled by njs
        js_content main.handler;
    }

QuickJS engine implements drop-in replacement for nginx/njs objects
with the following exceptions:

    * nginx module API to be added later: ngx.fetch(), ngx.shared.dict.
    * Built-in modules to be added later: fs, crypto, WebCrypto, xml.
    * NJS specific API: njs.dump(), njs.on(), console.dump().
    * js_preload_object directive.

19 months agoModules: introduced engine API.
Dmitry Volyntsev [Tue, 11 Jun 2024 05:58:24 +0000 (22:58 -0700)]
Modules: introduced engine API.

No functional changes.

19 months agoCI: removed DUMP_LEAKS flag from QuickJS build.
Dmitry Volyntsev [Thu, 12 Sep 2024 04:53:38 +0000 (21:53 -0700)]
CI: removed DUMP_LEAKS flag from QuickJS build.

While it is useful for debugging what objects are leaking at the end
this flag hides QuickJS JSString leaks from Address Sanitizer.

19 months agoConfigure: accept spaces in PATH.
Vadim Zhestikov [Fri, 6 Sep 2024 02:31:28 +0000 (19:31 -0700)]
Configure: accept spaces in PATH.

20 months agoFixed handling of encode arg in fs.readdir() and fs.realpath().
Dmitry Volyntsev [Wed, 4 Sep 2024 04:32:33 +0000 (21:32 -0700)]
Fixed handling of encode arg in fs.readdir() and fs.realpath().

The issue was introduced in 98c6570f3 (0.8.0).

20 months agoTests: making exception test more portable in stream_js.t.
Dmitry Volyntsev [Wed, 28 Aug 2024 23:57:49 +0000 (16:57 -0700)]
Tests: making exception test more portable in stream_js.t.

20 months agoQuickJS: disabling eval() and Function() in qjs_new_context().
Dmitry Volyntsev [Wed, 24 Jul 2024 23:30:10 +0000 (16:30 -0700)]
QuickJS: disabling eval() and Function() in qjs_new_context().

This properly disables eval() after previous attempt in c773ebcaad
(0.8.5).  In QuickJS buint-in C level eval API, which is used by njs, is
linked to eval() in JS code. To disable only the JS function
manual modification of global object is required.

20 months agoQuickJS: added wrappers for strings creation.
Dmitry Volyntsev [Sat, 17 Aug 2024 06:29:48 +0000 (23:29 -0700)]
QuickJS: added wrappers for strings creation.

20 months agoQuickJS: qjs_new_context() accepts now additional modules.
Dmitry Volyntsev [Wed, 24 Jul 2024 05:55:01 +0000 (22:55 -0700)]
QuickJS: qjs_new_context() accepts now additional modules.

20 months agoQuickJS: moving njs object creation to common code.
Dmitry Volyntsev [Tue, 9 Jul 2024 06:35:12 +0000 (23:35 -0700)]
QuickJS: moving njs object creation to common code.

So it will be shared between modules and CLI.

20 months agoIntroduced libqjs.a.
Dmitry Volyntsev [Wed, 24 Jul 2024 01:37:33 +0000 (18:37 -0700)]
Introduced libqjs.a.

20 months agoModules: added nocache flag for js_set variables.
Thomas P. [Wed, 7 Aug 2024 09:47:08 +0000 (11:47 +0200)]
Modules: added nocache flag for js_set variables.

This commit adds support for an additional `nocache` flag in `js_set`
directives. If set, the resulting nginx variable will have no_cacheable set
to 1. This enables us to dynamically recompute a variable if the context
changed (for example, in case of an internal redirection).

In case of multiple calls in a location, users should cache the result in a
rewrite variable: `set $cached_variable $js_variable;`

20 months agoAdd badges to README.md
Elijah Zupancic [Tue, 20 Aug 2024 18:41:44 +0000 (11:41 -0700)]
Add badges to README.md

This change adds two badges indicating the current project status and level of
support offered. These badges are standardized across many nginx projects.

20 months agoFixed compilation on 32bit platforms.
Dmitry Volyntsev [Fri, 16 Aug 2024 05:02:48 +0000 (22:02 -0700)]
Fixed compilation on 32bit platforms.

The issue was introduced in d1c615eaa.

20 months agoMaking ngx_js_logger() reusable by QuickJS code.
Dmitry Volyntsev [Tue, 9 Jul 2024 06:38:28 +0000 (23:38 -0700)]
Making ngx_js_logger() reusable by QuickJS code.

20 months agoModules: adding NUL byte at the end of the global script.
Dmitry Volyntsev [Fri, 26 Jul 2024 02:02:35 +0000 (19:02 -0700)]
Modules: adding NUL byte at the end of the global script.

Even though QuickJS takes length as an argument, when parsing the code,
it expects NUL byte at the end.

This change is similar to 184d2a39cb5 (0.8.5).

20 months agoQuickJS: added buffer module.
Dmitry Volyntsev [Thu, 8 Aug 2024 06:11:24 +0000 (23:11 -0700)]
QuickJS: added buffer module.

20 months agoQuickJS: fixed exception handling in shell output.
Dmitry Volyntsev [Wed, 14 Aug 2024 00:14:14 +0000 (17:14 -0700)]
QuickJS: fixed exception handling in shell output.

20 months agoFixed Buffer.prototype.writeInt8() and friends.
Dmitry Volyntsev [Thu, 8 Aug 2024 07:12:29 +0000 (00:12 -0700)]
Fixed Buffer.prototype.writeInt8() and friends.

20 months agoFixed Fixed Buffer.prototype.write().
Dmitry Volyntsev [Thu, 8 Aug 2024 05:48:04 +0000 (22:48 -0700)]
Fixed Fixed Buffer.prototype.write().

20 months agoFixed Buffer.prototype.writeFloat() and friends.
Dmitry Volyntsev [Thu, 8 Aug 2024 05:27:45 +0000 (22:27 -0700)]
Fixed Buffer.prototype.writeFloat() and friends.

20 months agoFixed Buffer.prototype.lastIndexOf().
Dmitry Volyntsev [Wed, 7 Aug 2024 06:05:33 +0000 (23:05 -0700)]
Fixed Buffer.prototype.lastIndexOf().

20 months agoHTTP: expose capture group variables.
Thomas P. [Tue, 30 Jul 2024 16:03:34 +0000 (18:03 +0200)]
HTTP: expose capture group variables.

20 months agoTypes: fixed NgxKeyValuePair definition.
Thomas P. [Tue, 30 Jul 2024 12:20:19 +0000 (14:20 +0200)]
Types: fixed NgxKeyValuePair definition.

NgxSharedDict.items() returns an array of `[key, value]` pairs, as `Object.entries()`.

21 months agoTests: adapting unsafe redirect test for QuickJS.
Dmitry Volyntsev [Fri, 26 Jul 2024 00:28:37 +0000 (17:28 -0700)]
Tests: adapting unsafe redirect test for QuickJS.

At the moment QuickJS has no API for getting strings
with NUL characters in the middle of the string.

Instead of a NUL byte make another unsafe redirect URI.

21 months agoTests: making exception test more portable in js.t.
Dmitry Volyntsev [Fri, 19 Jul 2024 05:37:25 +0000 (22:37 -0700)]
Tests: making exception test more portable in js.t.

21 months agoModules: removed non needed argument from meta handlers.
Dmitry Volyntsev [Thu, 25 Jul 2024 05:19:33 +0000 (22:19 -0700)]
Modules: removed non needed argument from meta handlers.

21 months agoHTTP: moving ngx_http_methods table out of subrequest() method.
Dmitry Volyntsev [Fri, 19 Jul 2024 00:55:20 +0000 (17:55 -0700)]
HTTP: moving ngx_http_methods table out of subrequest() method.

So it can be reused by QuickJS code.

21 months agoHTTP: making ngx_http_js_header_t handler type generic.
Dmitry Volyntsev [Wed, 17 Jul 2024 05:02:06 +0000 (22:02 -0700)]
HTTP: making ngx_http_js_header_t handler type generic.

So it can be reused by QuickJS code.

21 months agoTests: removed njs specific code from js_headers.t.
Dmitry Volyntsev [Thu, 18 Jul 2024 05:07:12 +0000 (22:07 -0700)]
Tests: removed njs specific code from js_headers.t.

21 months agoTests: ignoring subrequest execution order in js_subrequest.t.
Dmitry Volyntsev [Thu, 18 Jul 2024 23:24:04 +0000 (16:24 -0700)]
Tests: ignoring subrequest execution order in js_subrequest.t.

21 months agoVersion bump.
Dmitry Volyntsev [Fri, 19 Jul 2024 01:01:57 +0000 (18:01 -0700)]
Version bump.

22 months agoFixed empty labelled statement in a function.
Vadim Zhestikov [Fri, 5 Jul 2024 18:23:33 +0000 (11:23 -0700)]
Fixed empty labelled statement in a function.

22 months agoFixed Function constructor handling when called without arguments.
Vadim Zhestikov [Tue, 2 Jul 2024 21:55:03 +0000 (14:55 -0700)]
Fixed Function constructor handling when called without arguments.

Corrected the behavior of Function.constructor() when invoked without arguments
relative to an object.

22 months agoHTTP: simplifed r.subrequest() code.
Dmitry Volyntsev [Fri, 28 Jun 2024 06:47:11 +0000 (23:47 -0700)]
HTTP: simplifed r.subrequest() code.

Moving promise callbacks from ctx->promise_callbacks to
the arguments of ngx_js_event_t.

22 months agoQuickJS: disabling eval() and string normalize.
Dmitry Volyntsev [Fri, 21 Jun 2024 07:06:46 +0000 (00:06 -0700)]
QuickJS: disabling eval() and string normalize.

22 months agoAvoiding explicit length calculation for strings.
Dmitry Volyntsev [Thu, 27 Jun 2024 05:33:57 +0000 (22:33 -0700)]
Avoiding explicit length calculation for strings.

22 months agoFixed constructor property of an iterator object.
Dmitry Volyntsev [Thu, 27 Jun 2024 01:50:43 +0000 (18:50 -0700)]
Fixed constructor property of an iterator object.

This fixes #737 issue on Github.

22 months agoFixed "global" property handler when deleting.
Dmitry Volyntsev [Thu, 27 Jun 2024 02:12:38 +0000 (19:12 -0700)]
Fixed "global" property handler when deleting.

This fixes #734 issue.

22 months agoFixed Object.values() and Object.entries() with shared properties.
Dmitry Volyntsev [Wed, 26 Jun 2024 23:39:59 +0000 (16:39 -0700)]
Fixed Object.values() and Object.entries() with shared properties.

Previously, the functions directly copied a shared object from
a shared_hash. The copying is nessessary for lazy instantiation
of shared properties.

This fixes #743 issue on Github.

22 months agoFixed attribute initialization for external properties.
Dmitry Volyntsev [Sat, 22 Jun 2024 02:14:35 +0000 (19:14 -0700)]
Fixed attribute initialization for external properties.

22 months agoFixed maybe-uninitialized warning in error creation.
Dmitry Volyntsev [Fri, 21 Jun 2024 00:11:24 +0000 (17:11 -0700)]
Fixed maybe-uninitialized warning in error creation.

Ensuring that buf is always initialized in njs_throw_error_va()
and njs_error_fmt_new(), by requiring fmt to always be non NULL.

This fixes GCC warnings like:
169 | njs_unicode_decode_t ctx;
| ^
In function ‘njs_utf8_length’,
   inlined from ‘njs_error_new’ at src/njs_error.c:39:14,
   inlined from ‘njs_throw_error_va’ at src/njs_error.c:69:5:
   src/njs_utf8.h:141:12: error: ‘buf’ may be used uninitialized
   [-Werror=maybe-uninitialized]
   141 | return njs_utf8_stream_length(&ctx, p, len, 1, 1, NULL);

22 months agoModules: adding NUL byte at the end of the module body.
Dmitry Volyntsev [Wed, 19 Jun 2024 06:47:31 +0000 (23:47 -0700)]
Modules: adding NUL byte at the end of the module body.

Even though QuickJS takes length as an argument, when parsing the code,
it expects NUL byte at the end.

22 months agoFixed ‘ctx.codepoint’ may be used uninitialized.
Dmitry Volyntsev [Sat, 22 Jun 2024 00:58:32 +0000 (17:58 -0700)]
Fixed ‘ctx.codepoint’ may be used uninitialized.

When building by GCC 13 with -O3 and -flto flags the following
warning was reported:
In function ‘njs_utf8_decode’,
inlined from ‘njs_text_encoder_encode_into’ at
src/njs_encoding.c:214:14:
src/njs_utf8.c:191:42: error: ‘ctx.codepoint’ may be used
uninitialized [-Werror=maybe-uninitialized]
 191 |         ctx->codepoint = (ctx->codepoint << 6) | (c & 0x3F);

22 months agoFixed ‘length’ may be used uninitialized in Array.prototype.pop().
Dmitry Volyntsev [Fri, 21 Jun 2024 00:26:14 +0000 (17:26 -0700)]
Fixed ‘length’ may be used uninitialized in Array.prototype.pop().

When building by GCC with -O3 and -flto flags the following
warning was reported:
src/njs_array.c: In function ‘njs_array_prototype_pop’:
src/njs_array.c:1009:8: error: ‘length’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
1009 | if (length == 0) {
     |     ^

Returning a specific code in njs_value_to_number() helps GCC
to infer that there are only 2 return values are possible and
both of them are handled.

22 months agoHTTP: simplified check for subrequest from a subrequest.
Dmitry Volyntsev [Thu, 13 Jun 2024 06:31:08 +0000 (23:31 -0700)]
HTTP: simplified check for subrequest from a subrequest.

22 months agoModules: removed not needed previous location initialization.
Dmitry Volyntsev [Tue, 18 Jun 2024 04:35:02 +0000 (21:35 -0700)]
Modules: removed not needed previous location initialization.

22 months agoVersion 0.8.5. 0.8.5
Dmitry Volyntsev [Tue, 25 Jun 2024 00:09:07 +0000 (17:09 -0700)]
Version 0.8.5.

22 months agoHTTP: fixed r.subrequest() error handling.
Dmitry Volyntsev [Fri, 31 May 2024 05:22:48 +0000 (22:22 -0700)]
HTTP: fixed r.subrequest() error handling.

Previously, when at least 2 subrequests were scheduled they both
succeed, but the callback for the second threw an exception
heap-use-after-free happened: a nested chain of
ngx_http_run_posted_requests() calls and terminating request in the
inner call left outer calls with already freed request pointer.

The issue was introduced in 0.8.1 (4cb8e873e8c6).

22 months ago Modules: removed extra copying in shared dictionary.
Dmitry Volyntsev [Tue, 11 Jun 2024 06:06:26 +0000 (23:06 -0700)]
 Modules: removed extra copying in shared dictionary.

 After 5730d5f pool copy is not needed because
 njs_vm_value_string_create() always create a copy.

23 months agoModules: shared dictionary add, set, incr methods timeout argument.
jo-carter [Sun, 2 Jun 2024 08:11:13 +0000 (09:11 +0100)]
Modules: shared dictionary add, set, incr methods timeout argument.

The optional timeout argument overrides the timeout specified with
the shared_dict_zone directive for the effected key and operation
only. The timeout is specified in milliseconds.

This is useful when the majority of keys are expected to require
unique timeouts.

23 months agoFixed integer overflow in Date.parse().
Dmitry Volyntsev [Sat, 8 Jun 2024 05:58:53 +0000 (22:58 -0700)]
Fixed integer overflow in Date.parse().

Found by OSS-Fuzz and UndefinedSanitizer.

23 months agoFixed tracking of argument scope.
Dmitry Volyntsev [Sat, 8 Jun 2024 04:46:30 +0000 (21:46 -0700)]
Fixed tracking of argument scope.

This properly catches unsupported "await" in arguments.

This fixes #730 issue on Github.

23 months agoTests: compatibility with "openssl" app from OpenSSL 3.2.0.
Dmitry Volyntsev [Thu, 6 Jun 2024 21:54:45 +0000 (14:54 -0700)]
Tests: compatibility with "openssl" app from OpenSSL 3.2.0.

23 months agoFixed open byte overread in decodeURI() and decodeURIComponent().
Dmitry Volyntsev [Fri, 7 Jun 2024 06:10:12 +0000 (23:10 -0700)]
Fixed open byte overread in decodeURI() and decodeURIComponent().

Found by OSS-Fuzz and MemorySanitizer.

23 months agoAdded reference to nginx community page at SUPPORT.md.
Dmitry Volyntsev [Thu, 6 Jun 2024 01:23:18 +0000 (18:23 -0700)]
Added reference to nginx community page at SUPPORT.md.

23 months agoUpdated README
Michael Vernik [Fri, 31 May 2024 06:24:30 +0000 (23:24 -0700)]
Updated README
New Readme content and added .md extension

23 months agoAdded contributing guide.
Dmitry Volyntsev [Wed, 29 May 2024 01:34:22 +0000 (18:34 -0700)]
Added contributing guide.

23 months agoTest262: fixed unstable fs test.
Dmitry Volyntsev [Thu, 30 May 2024 05:26:09 +0000 (22:26 -0700)]
Test262: fixed unstable fs test.

Ensuring that symlink file is removed even if regular file does not
exist.

23 months agoTest262: fixed flaky fs tests.
Dmitry Volyntsev [Thu, 30 May 2024 05:23:55 +0000 (22:23 -0700)]
Test262: fixed flaky fs tests.

Previously, two tests running in parallel could occasionally generate
identical file names because Math.random() was used for part of the file
name, leading to one of the tests failing.

The fix is to use a single global counter to generate file names,
ensuring deterministic and unique file names for each test.

23 months agoAdded issue templates.
Dmitry Volyntsev [Thu, 30 May 2024 00:04:27 +0000 (17:04 -0700)]
Added issue templates.

23 months agoAdded support guide.
Dmitry Volyntsev [Wed, 29 May 2024 23:29:47 +0000 (16:29 -0700)]
Added support guide.

23 months agoAdded security policy.
Dmitry Volyntsev [Wed, 29 May 2024 01:41:49 +0000 (18:41 -0700)]
Added security policy.

23 months agoAdded code of conduct.
Dmitry Volyntsev [Wed, 29 May 2024 01:00:10 +0000 (18:00 -0700)]
Added code of conduct.

23 months agoFixed RegExp.prototype[@@replace]().
Dmitry Volyntsev [Tue, 28 May 2024 22:49:39 +0000 (15:49 -0700)]
Fixed RegExp.prototype[@@replace]().

With replacement containing "$'", "$\`" and Unicode characters.

The similar issue was fixed for String.prototype.replace() in
10127d70e941 (0.7.11).

Found by OSS-Fuzz.

23 months agoAdded CI based on GitHub Actions.
Konstantin Pavlov [Fri, 5 Apr 2024 20:27:37 +0000 (13:27 -0700)]
Added CI based on GitHub Actions.

23 months agoTest262: improved skipping of tests.
Dmitry Volyntsev [Tue, 28 May 2024 21:16:14 +0000 (14:16 -0700)]
Test262: improved skipping of tests.

The skipped tests (which are expected to fail) are not executed in order
to make output clearer.

23 months agoFetch: fixed heap-buffer-overflow in Headers.get(). branches/default
Dmitry Volyntsev [Fri, 24 May 2024 05:50:34 +0000 (22:50 -0700)]
Fetch: fixed heap-buffer-overflow in Headers.get().

Previously, when more than one header with the same name added to a
Headers object and Headers.get() was used to get the the duplicate
header heap-buffer-overflow occured. The overflow occurred due to an
incorrect calculation of the combined header value's length.

The issue was introduced in c43261bad627 (0.7.10).

23 months agoAdded fast path in njs_chb_utf8_length() for ASCII input.
Dmitry Volyntsev [Fri, 24 May 2024 05:50:19 +0000 (22:50 -0700)]
Added fast path in njs_chb_utf8_length() for ASCII input.

23 months agoFixed retval handling after an exception.
Dmitry Volyntsev [Thu, 23 May 2024 06:08:15 +0000 (23:08 -0700)]
Fixed retval handling after an exception.

Previously, some functions set a retval too early.  If this happened
before an exception a partially created object in inconsistent state
may be visible outside the affected functions.

The following functions were fixed:
Object.prototype.valueOf()
Array.prototype.toSpliced()
Array.prototype.toReversed()
Array.prototype.toSorted()

This fixes #713 issue on Github.

23 months agoImproved String.prototype.replaceAll() for readability.
Dmitry Volyntsev [Thu, 23 May 2024 00:26:16 +0000 (17:26 -0700)]
Improved String.prototype.replaceAll() for readability.

23 months agoFixed String.prototype.replaceAll() with zero length argument.
Dmitry Volyntsev [Thu, 23 May 2024 00:26:08 +0000 (17:26 -0700)]
Fixed String.prototype.replaceAll() with zero length argument.

This fixes #712 issue on Github.

23 months agoAligned StringIndexOf() implementation with the spec.
Dmitry Volyntsev [Wed, 22 May 2024 06:41:10 +0000 (23:41 -0700)]
Aligned StringIndexOf() implementation with the spec.

When searchValue is empty the function should return early
when fromIndex <= len is also true.