]> git.kaiwu.me - njs.git/log
njs.git
4 years agoVersion bump
Dmitry Volyntsev [Thu, 14 Apr 2022 22:39:15 +0000 (15:39 -0700)]
Version bump

4 years agoAdded tag 0.7.3 for changeset f15d039cf625
Dmitry Volyntsev [Tue, 12 Apr 2022 04:26:35 +0000 (21:26 -0700)]
Added tag 0.7.3 for changeset f15d039cf625

4 years agoVersion 0.7.3. 0.7.3
Dmitry Volyntsev [Tue, 12 Apr 2022 04:22:32 +0000 (21:22 -0700)]
Version 0.7.3.

4 years agoFixed typo while calculating module path length.
Dmitry Volyntsev [Mon, 11 Apr 2022 22:55:14 +0000 (15:55 -0700)]
Fixed typo while calculating module path length.

The issue was introduced in 77c398f26d7e (not released yet).

4 years agoFixed njs_vmcode_interpreter() when "toString" conversion fails.
Dmitry Volyntsev [Mon, 28 Mar 2022 16:22:17 +0000 (16:22 +0000)]
Fixed njs_vmcode_interpreter() when "toString" conversion fails.

Previously, while interpreting a user function, njs_vmcode_interpreter()
might return prematurely when an error happens.  This is not correct
because the current frame has to be unwound (or exception caught)
first.

The fix is exit through only 5 appropriate exit points to ensure
proper unwinding.

This closes #467 issue on Github.

4 years agoTests: introduced OPCODE debug.
Dmitry Volyntsev [Tue, 22 Feb 2022 19:38:59 +0000 (19:38 +0000)]
Tests: introduced OPCODE debug.

4 years agoFixed allocation of large array literals.
Dmitry Volyntsev [Mon, 21 Feb 2022 16:53:16 +0000 (16:53 +0000)]
Fixed allocation of large array literals.

Previously, allocation of large array literals may result in
null-pointer dereference. The reason is that njs_array_alloc() may
return a slow array when size is large enough, but the instruction
code assumes that array is always flat.

The fix is to check fast_array flag before accessing array->start.

This closes #473 issue on Github.

4 years agoFixed frame allocation from an awaited frame.
Dmitry Volyntsev [Mon, 21 Feb 2022 16:52:59 +0000 (16:52 +0000)]
Fixed frame allocation from an awaited frame.

njs_function_frame_save() is used to save the awaited frame when "await"
instruction is encountered. The saving was done as a memcpy() of
existing runtime frame.

njs_function_frame_alloc() is used to alloc a new function frame, this
function tries to use a spare preallocated memory from the previous
frame first.  Previously, this function might result in "use-after-free"
when invoked from a restored frame saved with njs_function_frame_save().
Because njs_function_frame_save() left pointers to the spare memory of
the original frame which may be already free when saved frame is
restored.

The fix is to erase fields for the spare memory from the saved frame.

This closes #469 issue on Github.

4 years agoFixed Array.prototype.concat() when "this" is a slow array.
Dmitry Volyntsev [Mon, 21 Feb 2022 16:52:47 +0000 (16:52 +0000)]
Fixed Array.prototype.concat() when "this" is a slow array.

Previously, when the current appended element is fast array the "this"
array was expected to always be a fast array also.  This may not be the
case when the previous appended element was not fast thus converting
the "this" array to a slow form.

Previous fix introduced in 2c1382bab643 (0.7.2) was not complete, the
correct fix is to never assume "this" is fast, whereas njs_array_add()
may only be called with fast arrays.

This closes #471 issue in Github.

4 years agoRefactoring of user modules importing.
Dmitry Volyntsev [Mon, 21 Feb 2022 14:49:38 +0000 (14:49 +0000)]
Refactoring of user modules importing.

Previously, user modules were compiled as as anonymous functions in a
global scope.  This is incorrect, because modules should be compiled
in their own scope.

In addition, this patch introduces HostResolveImportedModule support.
When vm->options.ops->module_loader is provided, a module lookup
and compilation is delegated to this callback.

This closes #443 issue on Github.

4 years agoTests: splitting large import tests into several simple ones.
Dmitry Volyntsev [Tue, 15 Feb 2022 13:17:52 +0000 (13:17 +0000)]
Tests: splitting large import tests into several simple ones.

4 years agoIntroduced njs_parser_init().
Dmitry Volyntsev [Mon, 14 Feb 2022 14:10:59 +0000 (14:10 +0000)]
Introduced njs_parser_init().

4 years agoFixed Function constructor in CLI.
Dmitry Volyntsev [Mon, 14 Feb 2022 14:10:47 +0000 (14:10 +0000)]
Fixed Function constructor in CLI.

Previously, Function constructor exported its local variables to
vm->variables_hash. vm->variables_hash is used in njs CLI to query
global variables during console input completion.  The exporting is
incorrect because it pollutes the global scope.

4 years agoFixed backtraces for native modules imported with import statement.
Dmitry Volyntsev [Mon, 14 Feb 2022 14:10:26 +0000 (14:10 +0000)]
Fixed backtraces for native modules imported with import statement.

Previously, the module name was missing when exception is reported
for a native module function imported with import statement.

4 years agoFixed backtraces while traversing imported user modules.
Dmitry Volyntsev [Mon, 14 Feb 2022 14:10:04 +0000 (14:10 +0000)]
Fixed backtraces while traversing imported user modules.

Previously, njs_builtin_match_native_function(), which is used to build a
backtrace for an exception, assumed that user modules always return
object values, which is not the case.  As a result, njs_object_traverse()
may receive incorrect pointer.

This fix is to only traverse object values.

4 years agoTests: refactored modules tests using test262 test suite.
Dmitry Volyntsev [Thu, 27 Jan 2022 13:01:55 +0000 (13:01 +0000)]
Tests: refactored modules tests using test262 test suite.

4 years agoTests: added support for proper negative test262 tests.
Dmitry Volyntsev [Wed, 26 Jan 2022 17:24:58 +0000 (17:24 +0000)]
Tests: added support for proper negative test262 tests.

4 years agoTypes: added async/await support for TS files.
Jakub Jirutka [Wed, 26 Jan 2022 01:44:18 +0000 (02:44 +0100)]
Types: added async/await support for TS files.

Since 0.7.0 async/await support was added.

This closes #461 issue on Github.

4 years agoShell: added options for custom exit failure code.
Dmitry Volyntsev [Wed, 26 Jan 2022 17:24:57 +0000 (17:24 +0000)]
Shell: added options for custom exit failure code.

4 years agoVersion bump.
Dmitry Volyntsev [Tue, 25 Jan 2022 19:06:58 +0000 (19:06 +0000)]
Version bump.

4 years agoAdded tag 0.7.2 for changeset 3dd315b80bab
Dmitry Volyntsev [Tue, 25 Jan 2022 13:38:25 +0000 (13:38 +0000)]
Added tag 0.7.2 for changeset 3dd315b80bab

4 years agoVersion 0.7.2. 0.7.2
Dmitry Volyntsev [Tue, 25 Jan 2022 13:37:45 +0000 (13:37 +0000)]
Version 0.7.2.

4 years agoFixed function redeclaration.
Dmitry Volyntsev [Tue, 25 Jan 2022 13:18:20 +0000 (13:18 +0000)]
Fixed function redeclaration.

Previously, the existing lambda structure was reused resulting in the
properties of the previously defined function was merged into a new one.

The bug was introduced in 66bd2cc7fd87 (0.7.0).

4 years agoFixed recursive async function calls.
Dmitry Volyntsev [Fri, 21 Jan 2022 14:31:30 +0000 (14:31 +0000)]
Fixed recursive async function calls.

Previously, PromiseCapability record was stored (function->context)
directly in function object during a function invocation.  This is
not correct, because PromiseCapability record should be linked to
current execution context.  As a result, function->context is
overwritten with consecutive recursive calls which results in
use-after-free.

This closes #451 issue on Github.

4 years agoFixed Function.prototype.apply() with slow arrays.
Dmitry Volyntsev [Wed, 19 Jan 2022 14:03:49 +0000 (14:03 +0000)]
Fixed Function.prototype.apply() with slow arrays.

Previously, the function had two issues:
   * array->start was referenced without checking for fast array flag
   * the created arguments list was not sanity-checked for its length,
     which can be very large.

The fix is to remove micro-optimization for arrays and introduce limit
size for arguments list.

This closes #449 issue in Github.

4 years agoFixed type confusion bug while resolving promises.
Dmitry Volyntsev [Wed, 19 Jan 2022 13:12:09 +0000 (13:12 +0000)]
Fixed type confusion bug while resolving promises.

Previously, the internal function njs_promise_perform_then() which
implements PerformPromiseThen() expects its first argument to always be
a promise instance.  This assertion might be invalid because the
functions corresponding to Promise.prototype.then() and
Promise.resolve() incorrectly verified their arguments.

Specifically, the functions recognized their first argument as promise
if it was an object which was an Promise or had Promise object in its
prototype chain.  The later condition is not correct because internal
slots are not inherited according to the spec.

This closes #447 issue in Github.

4 years agoImproved access to this argument.
Dmitry Volyntsev [Tue, 18 Jan 2022 15:37:11 +0000 (15:37 +0000)]
Improved access to this argument.

'this' argument is always present, so it may be accessed
without checking the number provided arguments.

4 years agoFixed Buffer.concat() with subarrays.
Sylvain Etienne [Tue, 18 Jan 2022 07:37:09 +0000 (08:37 +0100)]
Fixed Buffer.concat() with subarrays.

This closes #458 issue on Github.

4 years ago2022 year.
Dmitry Volyntsev [Tue, 18 Jan 2022 15:36:40 +0000 (15:36 +0000)]
2022 year.

4 years agoFixed Array.prototype.concat() with exotic argument object.
Dmitry Volyntsev [Tue, 18 Jan 2022 15:35:00 +0000 (15:35 +0000)]
Fixed Array.prototype.concat() with exotic argument object.

The issue was introduced in 2c1382bab643.

4 years agoFixed Array.prototype.reverse() when array is changed while iterating.
Dmitry Volyntsev [Fri, 14 Jan 2022 14:40:27 +0000 (14:40 +0000)]
Fixed Array.prototype.reverse() when array is changed while iterating.

Previously, the flat array may be converted to a slow one as a
side-effect of a custom getter invocation for a proto array object.
The function erroneously assumed that the this array remains flat
while iterating.

The fix is to eliminate the micro-optimization which uses direct
pointers.

The problem is similar to the previous commits.

4 years agoSimplified element access in Array.prototype.shift().
Dmitry Volyntsev [Thu, 13 Jan 2022 18:30:31 +0000 (18:30 +0000)]
Simplified element access in Array.prototype.shift().

Previously, array structure may be left in inconsistent state
when a custom getter in a proto array changes array size.

The change is similar to the previous commits.

4 years agoSimplified element access in Array.prototype.pop().
Dmitry Volyntsev [Thu, 13 Jan 2022 18:30:31 +0000 (18:30 +0000)]
Simplified element access in Array.prototype.pop().

The change is similar to the previous commits.

4 years agoFixed Array.prototype.concat() when array is changed while iterating.
Dmitry Volyntsev [Thu, 13 Jan 2022 16:20:58 +0000 (16:20 +0000)]
Fixed Array.prototype.concat() when array is changed while iterating.

Previously, the flat array may be converted to a slow one as a
side-effect of a custom getter invocation for a proto array object.
The function erroneously assumed that the this array remains flat
while iterating.

The fix is to eliminate the micro-optimization which uses direct
pointers.

The problem is similar to the previous commits.

4 years agoFixed Array.prototype.slice() when array is changed while iterating.
Dmitry Volyntsev [Thu, 13 Jan 2022 15:59:08 +0000 (15:59 +0000)]
Fixed Array.prototype.slice() when array is changed while iterating.

Previously, the flat array may be converted to a slow one as a
side-effect of a custom getter invocation for a proto array object.
The function erroneously assumed that the this array remains flat
while iterating.

The fix is to eliminate the micro-optimization which uses direct
pointers.

The problem is similar to the previous (9578cc729205) commit.

This closes #445 issue on Github.

4 years agoFixed Array.prototype.join() when array is changed while iterating.
Dmitry Volyntsev [Wed, 12 Jan 2022 17:59:42 +0000 (17:59 +0000)]
Fixed Array.prototype.join() when array is changed while iterating.

Previously, the function used optimization for ordinary arrays with no
gaps (so called fast arrays).  For a fast array code took elements
directly from internal flat C array. The direct pointer may become
invalid as side-effect of custom toString() method for an element.

Specifically, the pointer was passed directly to
njs_value_to_primitive() which attempts to call toString() followed by
valueOf().  When the array size is changed as a side-effect of
toString() and not a string value is returned by toString() the pointer
becomes invalid and is passed to valueOf() which causes use-after-free.

The fix is to eliminate the micro-optimization which uses direct pointers.

Found by PolyGlot fuzzing framework.

This closes #444 issue on Github.

4 years agoMaking njs_value_property_i64() and njs_value_property_i64_set() fast.
Dmitry Volyntsev [Wed, 12 Jan 2022 17:58:19 +0000 (17:58 +0000)]
Making njs_value_property_i64() and njs_value_property_i64_set() fast.

Since f5afb325896f (0.3.9) njs_value_property() and
njs_value_property_set() have fast paths when key is a number.

Passing key as a number eliminates conversion index to string and back.

4 years agoRemoving MSAN unpoison workarounds for clang-9 and below.
Dmitry Volyntsev [Wed, 12 Jan 2022 17:58:18 +0000 (17:58 +0000)]
Removing MSAN unpoison workarounds for clang-9 and below.

MSAN unpoison workaround was introduced in 13dbdff9b76f (0.3.9) for a
false-positive bug in clang-9 and below.

Also, after 80d95b2881f6 (0.4.1) the bug is not triggered anymore.

4 years agoFixed fuzzing target bug introduced in 4d4657128baf (0.7.1).
Dmitry Volyntsev [Tue, 11 Jan 2022 13:02:33 +0000 (13:02 +0000)]
Fixed fuzzing target bug introduced in 4d4657128baf (0.7.1).

Previously, njs_process_script() took vm pointer from console object,
but after 4d4657128baf the object is not initialized in
LLVMFuzzerTestOneInput().

The fix is to always pass vm pointer explicitly.

This also closes #456 issue on Github.

4 years agoImproved discovery of OpenSSL libraries.
Dmitry Volyntsev [Wed, 29 Dec 2021 18:26:40 +0000 (18:26 +0000)]
Improved discovery of OpenSSL libraries.

Trying to link again the library using --cc-opt and --ld-opt before
attempting to use the default.

This change is similar to 9e2e4d04dfc4 (0.7.1) made for PCRE.

4 years agoConfigure: added --build-dir option.
Dmitry Volyntsev [Wed, 29 Dec 2021 17:20:09 +0000 (17:20 +0000)]
Configure: added --build-dir option.

4 years agoTests: fixed "fs" tests with custom build directory.
Dmitry Volyntsev [Wed, 29 Dec 2021 17:19:55 +0000 (17:19 +0000)]
Tests: fixed "fs" tests with custom build directory.

4 years agoConfigure: fixed custom NJS_BUILD_DIR values support.
Dmitry Volyntsev [Wed, 29 Dec 2021 16:56:47 +0000 (16:56 +0000)]
Configure: fixed custom NJS_BUILD_DIR values support.

The issue was introduced in 4d4657128baf (0.7.1).

This closes #454 issue on Github.

4 years agoAdded description for recently added configure options.
Dmitry Volyntsev [Wed, 29 Dec 2021 16:03:13 +0000 (16:03 +0000)]
Added description for recently added configure options.

4 years agoTypes: added TS definitions for fs.stat() and fs.lstat() methods.
Dmitry Volyntsev [Wed, 29 Dec 2021 16:03:12 +0000 (16:03 +0000)]
Types: added TS definitions for fs.stat() and fs.lstat() methods.

4 years agoVersion bump.
Dmitry Volyntsev [Wed, 29 Dec 2021 16:03:11 +0000 (16:03 +0000)]
Version bump.

4 years agoAdded tag 0.7.1 for changeset 35aca5cc5ea7
Dmitry Volyntsev [Tue, 28 Dec 2021 14:24:53 +0000 (14:24 +0000)]
Added tag 0.7.1 for changeset 35aca5cc5ea7

4 years agoVersion 0.7.1. 0.7.1
Dmitry Volyntsev [Tue, 28 Dec 2021 13:55:44 +0000 (13:55 +0000)]
Version 0.7.1.

4 years agoFixed information leak in Buffer.from().
Artem S. Povalyukhin [Sat, 25 Dec 2021 19:45:30 +0000 (22:45 +0300)]
Fixed information leak in Buffer.from().

This closes #446 on Github.

4 years agoImproved Buffer.from() with Buffer-like objects.
Artem S. Povalyukhin [Sat, 25 Dec 2021 19:45:30 +0000 (22:45 +0300)]
Improved Buffer.from() with Buffer-like objects.

4 years agoAdded missing element in typeof table for DataView() type.
Artem S. Povalyukhin [Fri, 24 Dec 2021 07:00:15 +0000 (10:00 +0300)]
Added missing element in typeof table for DataView() type.

Previously, typeof operation for DataView object resulted
in out of bounds array accessing.

This fixes #450 issue on Github.

4 years agoImproved discovery of PCRE libraries.
Dmitry Volyntsev [Fri, 24 Dec 2021 16:54:12 +0000 (16:54 +0000)]
Improved discovery of PCRE libraries.

Trying to link again the library using --cc-opt and --ld-opt before
attempting to use pcre-config or pcre2-config.

4 years agoPassing --ld-opt flags while linking.
Dmitry Volyntsev [Fri, 24 Dec 2021 15:48:12 +0000 (15:48 +0000)]
Passing --ld-opt flags while linking.

4 years agoBuilding regexp backend as an external.
Dmitry Volyntsev [Fri, 24 Dec 2021 15:48:11 +0000 (15:48 +0000)]
Building regexp backend as an external.

This allows not to build PCRE specific code as a part of libnjs.a thus
supporting nginx builds with flags like --with-pcre=PCRE_DIR.  When
--no-pcre configure option is provided external code have to implement
methods declared in njs_regex.h.

This also closes #18 issue on Github.

4 years agoAdding module suffix for njs module files.
Dmitry Volyntsev [Fri, 24 Dec 2021 15:48:09 +0000 (15:48 +0000)]
Adding module suffix for njs module files.

4 years agoIntroducing --no-openssl to disable OpenSSL discover.
Dmitry Volyntsev [Fri, 24 Dec 2021 15:48:09 +0000 (15:48 +0000)]
Introducing --no-openssl to disable OpenSSL discover.

4 years agoTests: added help info for test262.
Dmitry Volyntsev [Fri, 24 Dec 2021 15:48:08 +0000 (15:48 +0000)]
Tests: added help info for test262.

4 years agoFixed 1-byte memory over-read introduced in previous commit.
Dmitry Volyntsev [Thu, 23 Dec 2021 14:28:12 +0000 (14:28 +0000)]
Fixed 1-byte memory over-read introduced in previous commit.

sizeof("\0") returns 2 because of the implicit zero byte added at
the end of string literals. Instead njs_length() was intended to be
used.

4 years agoImproved njs_ftw().
Dmitry Volyntsev [Thu, 23 Dec 2021 13:30:44 +0000 (13:30 +0000)]
Improved njs_ftw().

Replacing strcpy() with memcpy() as the former is considered
insecure.

Found by Clang static analyzer.

4 years agoTests: fixed fs/methods.t.ts on RHEL8.
Dmitry Volyntsev [Wed, 22 Dec 2021 17:22:14 +0000 (17:22 +0000)]
Tests: fixed fs/methods.t.ts on RHEL8.

4 years agoTests: improved test262 output when a test fails.
Dmitry Volyntsev [Wed, 22 Dec 2021 16:54:27 +0000 (16:54 +0000)]
Tests: improved test262 output when a test fails.

4 years agoFixed WebCrypto sign() and verify() methods with OpenSSL 3.0.1.
Dmitry Volyntsev [Wed, 22 Dec 2021 16:54:13 +0000 (16:54 +0000)]
Fixed WebCrypto sign() and verify() methods with OpenSSL 3.0.1.

Since 3.0.1 EVP_DigestSignFinal() expects siglen to contain the
actual buffer size for signature buffer.

4 years agoAdded missed njs_parser_failed() in njs_parser_module_lambda_after().
Zhidao HONG [Wed, 22 Dec 2021 02:50:16 +0000 (10:50 +0800)]
Added missed njs_parser_failed() in njs_parser_module_lambda_after().

4 years agoAdded missed static declarations.
Zhidao HONG [Wed, 22 Dec 2021 02:50:16 +0000 (10:50 +0800)]
Added missed static declarations.

4 years agoFixed OpenSSL detection support when Address Sanitizer is enabled.
Dmitry Volyntsev [Wed, 22 Dec 2021 16:54:05 +0000 (16:54 +0000)]
Fixed OpenSSL detection support when Address Sanitizer is enabled.

4 years agoRefactor modules using external prototypes.
Dmitry Volyntsev [Tue, 21 Dec 2021 17:42:26 +0000 (17:42 +0000)]
Refactor modules using external prototypes.

4 years agoRenaming njs_module_t -> njs_mod_t.
Dmitry Volyntsev [Tue, 21 Dec 2021 15:49:21 +0000 (15:49 +0000)]
Renaming njs_module_t -> njs_mod_t.

4 years agoTests: moving module tests into separate test suites.
Dmitry Volyntsev [Tue, 21 Dec 2021 15:49:13 +0000 (15:49 +0000)]
Tests: moving module tests into separate test suites.

4 years agoTests: moving backtraces test into a separate test suite.
Dmitry Volyntsev [Tue, 21 Dec 2021 15:49:05 +0000 (15:49 +0000)]
Tests: moving backtraces test into a separate test suite.

4 years agoAdded constructor flag for methods in external prototypes.
Dmitry Volyntsev [Tue, 21 Dec 2021 15:48:45 +0000 (15:48 +0000)]
Added constructor flag for methods in external prototypes.

4 years agoModules: removed dead code left after dfcbfb5e27b2.
Dmitry Volyntsev [Tue, 14 Dec 2021 20:14:23 +0000 (20:14 +0000)]
Modules: removed dead code left after dfcbfb5e27b2.

Found by Coverity (CID 1495259).

4 years agoChecking cwd path length in njs_module_relative_path().
Dmitry Volyntsev [Tue, 14 Dec 2021 20:06:23 +0000 (20:06 +0000)]
Checking cwd path length in njs_module_relative_path().

4 years agoUsing njs_arr_item() when accessing vm->protos elements.
Dmitry Volyntsev [Tue, 14 Dec 2021 14:08:12 +0000 (14:08 +0000)]
Using njs_arr_item() when accessing vm->protos elements.

4 years agoModules: removed "js_include" directive deprecated in 0.4.0.
Dmitry Volyntsev [Thu, 9 Dec 2021 14:38:40 +0000 (14:38 +0000)]
Modules: removed "js_include" directive deprecated in 0.4.0.

4 years agoGenerator: removing njs_generate_children_indexes_release_pop().
Dmitry Volyntsev [Wed, 8 Dec 2021 13:14:59 +0000 (13:14 +0000)]
Generator: removing njs_generate_children_indexes_release_pop().

4 years agoGenerator: introduced njs_generator_init().
Dmitry Volyntsev [Wed, 8 Dec 2021 13:14:58 +0000 (13:14 +0000)]
Generator: introduced njs_generator_init().

4 years agoGenerator: fixed typo introduced in efdc5f18195e (0.6.2).
Dmitry Volyntsev [Wed, 8 Dec 2021 13:14:56 +0000 (13:14 +0000)]
Generator: fixed typo introduced in efdc5f18195e (0.6.2).

4 years agoTests: improved unit tests after efdc5f18195e (0.6.2).
Dmitry Volyntsev [Tue, 7 Dec 2021 19:42:27 +0000 (19:42 +0000)]
Tests: improved unit tests after efdc5f18195e (0.6.2).

In efdc5f18195e the recursion was removed from generator,
therefore tests that are not limited by system stack should always
pass.

4 years agoFixed function redeclaration in CLI when interactive mode is on.
Dmitry Volyntsev [Tue, 7 Dec 2021 13:15:19 +0000 (13:15 +0000)]
Fixed function redeclaration in CLI when interactive mode is on.

The issue was introduced in 0a2a0b5a74f4 (0.6.0).

4 years agoFixed execution of async function in synchronous context.
Dmitry Volyntsev [Fri, 3 Dec 2021 13:55:22 +0000 (13:55 +0000)]
Fixed execution of async function in synchronous context.

The bug was introduced in 92d10cd761e2 (0.7.0).

4 years agoTests: added promise support for unit tests subrequest method.
Dmitry Volyntsev [Fri, 3 Dec 2021 13:55:12 +0000 (13:55 +0000)]
Tests: added promise support for unit tests subrequest method.

4 years agoAdded memory exception if alloc fails for njs_vm_function_alloc.
Dmitry Volyntsev [Fri, 3 Dec 2021 13:55:11 +0000 (13:55 +0000)]
Added memory exception if alloc fails for njs_vm_function_alloc.

4 years agoFixed catching of exception thrown in try block of async function.
Dmitry Volyntsev [Tue, 30 Nov 2021 14:55:57 +0000 (14:55 +0000)]
Fixed catching of exception thrown in try block of async function.

The bug was introduced in 92d10cd761e2 (0.7.0).

4 years agoTests: making async/await test filenames shorter.
Dmitry Volyntsev [Mon, 29 Nov 2021 18:14:25 +0000 (18:14 +0000)]
Tests: making async/await test filenames shorter.

4 years agoTests: refactored JavaScript tests.
Dmitry Volyntsev [Mon, 29 Nov 2021 16:50:41 +0000 (16:50 +0000)]
Tests: refactored JavaScript tests.

A generic runner test/run is introduced.  It runs all available tests
in test/ directory.  JavaScript files are expected to be compliant with
Test262.

4 years agoAllowing to build njs util without interactive shell support.
Dmitry Volyntsev [Mon, 29 Nov 2021 14:41:09 +0000 (14:41 +0000)]
Allowing to build njs util without interactive shell support.

4 years agoFixed building unit tests binaries on MacOS with custom LDFLAGS.
Dmitry Volyntsev [Mon, 29 Nov 2021 14:05:33 +0000 (14:05 +0000)]
Fixed building unit tests binaries on MacOS with custom LDFLAGS.

4 years agoFixed exception throwing when RegExp match fails.
Dmitry Volyntsev [Mon, 22 Nov 2021 13:37:11 +0000 (13:37 +0000)]
Fixed exception throwing when RegExp match fails.

The issue was introduced in a83775113025 (0.1.15).

This closes #439 issue on Github.

4 years agoUpdated README with the reference to njs-examples repo.
Dmitry Volyntsev [Thu, 18 Nov 2021 13:48:55 +0000 (13:48 +0000)]
Updated README with the reference to njs-examples repo.

4 years agoFixed build with OpenSSL 3.0 built with no-deprecated.
Sergey Kandaurov [Wed, 17 Nov 2021 16:14:19 +0000 (19:14 +0300)]
Fixed build with OpenSSL 3.0 built with no-deprecated.

This covers deprecated OpenSSL_add_all_algorithms() and RSA/EC_KEY types.

4 years agoSSL: fixed reporting of the detected library version.
Dmitry Volyntsev [Wed, 17 Nov 2021 17:01:07 +0000 (17:01 +0000)]
SSL: fixed reporting of the detected library version.

Previously, `openssl version` command was used to report the OpenSSL
version.  Whereas, when provided with custom CFLAGS and LDFLAGS the
used library may differ from the system one.

The fix is to report OpenSSL version using the provided library.

4 years agoFixed WebCrypto sign() and verify() methods with OpenSSL 3.0.
Dmitry Volyntsev [Wed, 17 Nov 2021 14:11:28 +0000 (14:11 +0000)]
Fixed WebCrypto sign() and verify() methods with OpenSSL 3.0.

4 years agoIntroduced PCRE2 RegExp backend.
Dmitry Volyntsev [Thu, 11 Nov 2021 14:27:15 +0000 (14:27 +0000)]
Introduced PCRE2 RegExp backend.

4 years agoRegExp: improved source string treatment.
Dmitry Volyntsev [Thu, 11 Nov 2021 14:26:41 +0000 (14:26 +0000)]
RegExp: improved source string treatment.

Previously, njs_regexp_pattern_create() in addition to a pattern
compilation made a string representation for a RegExp which was returned
by RegExp.prototype.toString() as is.

After 02444445df29 (0.6.0), RegExp.prototype.toString() was implemented
according to the spec, and since then it creates a RegExp string on the fly.

This patch removes the extra code which was left.

In addition, as a source string may not be a valid UTF-8 string (in
RegExp literals), RegExp.prototype.toString() now ensures that a
valid UTF-8 string is returned.

4 years agoRegExp: incapsulating PCRE API.
Dmitry Volyntsev [Thu, 11 Nov 2021 14:26:30 +0000 (14:26 +0000)]
RegExp: incapsulating PCRE API.

4 years agoTests: adapting fs tests introduced in 685adce92af1 for various OS.
Dmitry Volyntsev [Wed, 10 Nov 2021 14:50:16 +0000 (14:50 +0000)]
Tests: adapting fs tests introduced in 685adce92af1 for various OS.

4 years agoRemoved unused regular expression API.
Dmitry Volyntsev [Tue, 9 Nov 2021 17:59:58 +0000 (17:59 +0000)]
Removed unused regular expression API.

4 years agoPCRE: removed unused context functions.
Dmitry Volyntsev [Tue, 9 Nov 2021 17:59:46 +0000 (17:59 +0000)]
PCRE: removed unused context functions.

4 years agoAdded fs.Stats, fs.stat() and friends.
Dmitry Volyntsev [Wed, 3 Nov 2021 15:46:15 +0000 (15:46 +0000)]
Added fs.Stats, fs.stat() and friends.

4 years agoAdded njs_date_alloc().
Dmitry Volyntsev [Tue, 2 Nov 2021 12:38:42 +0000 (12:38 +0000)]
Added njs_date_alloc().