]>
git.kaiwu.me - njs.git/log
Dmitry Volyntsev [Wed, 8 Dec 2021 13:14:56 +0000 (13:14 +0000)]
Generator: fixed typo introduced in
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.
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).
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).
Dmitry Volyntsev [Fri, 3 Dec 2021 13:55:12 +0000 (13:55 +0000)]
Tests: added promise support for unit tests subrequest method.
Dmitry Volyntsev [Fri, 3 Dec 2021 13:55:11 +0000 (13:55 +0000)]
Added memory exception if alloc fails for njs_vm_function_alloc.
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).
Dmitry Volyntsev [Mon, 29 Nov 2021 18:14:25 +0000 (18:14 +0000)]
Tests: making async/await test filenames shorter.
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.
Dmitry Volyntsev [Mon, 29 Nov 2021 14:41:09 +0000 (14:41 +0000)]
Allowing to build njs util without interactive shell support.
Dmitry Volyntsev [Mon, 29 Nov 2021 14:05:33 +0000 (14:05 +0000)]
Fixed building unit tests binaries on MacOS with custom LDFLAGS.
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.
Dmitry Volyntsev [Thu, 18 Nov 2021 13:48:55 +0000 (13:48 +0000)]
Updated README with the reference to njs-examples repo.
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.
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.
Dmitry Volyntsev [Wed, 17 Nov 2021 14:11:28 +0000 (14:11 +0000)]
Fixed WebCrypto sign() and verify() methods with OpenSSL 3.0.
Dmitry Volyntsev [Thu, 11 Nov 2021 14:27:15 +0000 (14:27 +0000)]
Introduced PCRE2 RegExp backend.
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.
Dmitry Volyntsev [Thu, 11 Nov 2021 14:26:30 +0000 (14:26 +0000)]
RegExp: incapsulating PCRE API.
Dmitry Volyntsev [Wed, 10 Nov 2021 14:50:16 +0000 (14:50 +0000)]
Tests: adapting fs tests introduced in
685adce92af1 for various OS.
Dmitry Volyntsev [Tue, 9 Nov 2021 17:59:58 +0000 (17:59 +0000)]
Removed unused regular expression API.
Dmitry Volyntsev [Tue, 9 Nov 2021 17:59:46 +0000 (17:59 +0000)]
PCRE: removed unused context functions.
Dmitry Volyntsev [Wed, 3 Nov 2021 15:46:15 +0000 (15:46 +0000)]
Added fs.Stats, fs.stat() and friends.
Dmitry Volyntsev [Tue, 2 Nov 2021 12:38:42 +0000 (12:38 +0000)]
Added njs_date_alloc().
Dmitry Volyntsev [Tue, 2 Nov 2021 12:38:02 +0000 (12:38 +0000)]
Unified creation of objects with custom value slots.
Dmitry Volyntsev [Tue, 2 Nov 2021 12:37:19 +0000 (12:37 +0000)]
Simplified object dumping.
Dmitry Volyntsev [Tue, 2 Nov 2021 12:37:00 +0000 (12:37 +0000)]
Getting rid of special types for primitive objects.
The following types were removed: NJS_OBJECT_BOOLEAN,
NJS_OBJECT_NUMBER, NJS_OBJECT_SYMBOL, NJS_OBJECT_STRING.
Instead a generic NJS_OBJECT_VALUE type is used for objects
with custom slots.
Dmitry Volyntsev [Tue, 2 Nov 2021 12:35:34 +0000 (12:35 +0000)]
Tests: refactored "fs" module tests.
Dmitry Volyntsev [Mon, 1 Nov 2021 15:53:30 +0000 (15:53 +0000)]
Tests: allowing to define own test function per test suite.
Alexander Borisov [Mon, 1 Nov 2021 15:32:48 +0000 (18:32 +0300)]
Fixed heap-use-after-free in await frame.
The bug was introduced in
92d10cd761e2 (0.7.0).
Dmitry Volyntsev [Fri, 29 Oct 2021 13:57:26 +0000 (13:57 +0000)]
Fixed decodeURI() and decodeURIComponent() with invalid byte strings.
The issue was introduced in
855edd76bdb6 (0.4.3).
This closes #435 issue on Github.
Valentin Bartenev [Tue, 26 Oct 2021 13:14:07 +0000 (16:14 +0300)]
Removed surplus condition from Base64 decoded length counting.
Dmitry Volyntsev [Wed, 20 Oct 2021 13:01:55 +0000 (13:01 +0000)]
Stream: fixed build without --with-http_ssl_module.
This closes #434 issue on Github.
Dmitry Volyntsev [Wed, 20 Oct 2021 12:16:37 +0000 (12:16 +0000)]
Version bump.
Dmitry Volyntsev [Tue, 19 Oct 2021 12:54:08 +0000 (12:54 +0000)]
Added tag 0.7.0 for changeset
8418bd4a4ce3
Dmitry Volyntsev [Tue, 19 Oct 2021 12:24:13 +0000 (12:24 +0000)]
Version 0.7.0.
Dmitry Volyntsev [Thu, 14 Oct 2021 17:16:10 +0000 (17:16 +0000)]
Modules: fixed Respose.headers getter in fetch API.
The issue manifested itself when Response object is dumped using
JSON.stringify() or njs.dump(). The Response headers were dumped
as "null" values.
Dmitry Volyntsev [Thu, 14 Oct 2021 15:18:47 +0000 (15:18 +0000)]
Style.
Dmitry Volyntsev [Wed, 13 Oct 2021 16:31:00 +0000 (16:31 +0000)]
SSL: fixed building with OpenSSL <= 1.0.1.
This closes #429 issue on Github.
Dmitry Volyntsev [Wed, 13 Oct 2021 15:29:50 +0000 (15:29 +0000)]
SSL: fixed typo introduced in
8e335c2ac447 .
Dmitry Volyntsev [Tue, 12 Oct 2021 17:24:31 +0000 (17:24 +0000)]
SSL: fixed compatibility with OpenSSL 3.0.
Dmitry Volyntsev [Mon, 11 Oct 2021 15:06:15 +0000 (15:06 +0000)]
Introduced WebCrypto API according to W3C spec.
The following methods were implemented:
crypto.getRandomValues()
crypto.subtle.importKey()
format: raw, pkcs8, spki
algorithm: AES-CBC, AES-CTR, AES-GCM,
ECDSA, HKDF, HMAC, PBKDF2,
RSASSA-PKCS1-v1_5, RSA-OAEP, RSA-PSS
crypto.subtle.decrypt()
crypto.subtle.encrypt()
algorithm: AES-CBC, AES-CTR, AES-GCM,
RSA-OAEP
crypto.subtle.deriveBits()
crypto.subtle.deriveKey()
algorithm: HKDF, PBKDF2
crypto.subtle.digest()
algorithm: SHA-1, SHA-256, SHA-384, SHA-512
crypto.subtle.sign()
crypto.subtle.verify()
algorithm: ECDSA, HMAC, RSASSA-PKCS1-v1_5, RSA-PSS
Alexander Borisov [Mon, 11 Oct 2021 14:46:24 +0000 (17:46 +0300)]
Fixed copying of closures for declared functions.
After
0a2a0b5a74f4 (0.6.0), the referencing of a closure value inside of
a nested function may result in heap-use-after-free. For this to happen
the closure value have to be referenced in a function invoked asynchronously.
For example if a closure value is referenced in r.subrequest() or setTimeout()
handler.
The problem was that closure values of nested function were assigned during
the function call and the memory shared between all the cloned VMs was used
to store temporary assignments until the moment the declared function was
referenced. When two VMs executed concurrently, the first VM might see
the changed made by the second VM if the first one was suspended.
The fix is to copy all declared functions at the time of the call.
This closes #421 issue on GitHub.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:50:50 +0000 (13:50 +0000)]
Tests: added async tests support.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:41:01 +0000 (13:41 +0000)]
Modules: introduced setReturnValue() method.
Dmitry Volyntsev [Fri, 8 Oct 2021 13:41:00 +0000 (13:41 +0000)]
Modules: introduced common ngx_js_retval().
Dmitry Volyntsev [Fri, 8 Oct 2021 13:40:58 +0000 (13:40 +0000)]
Types: updated TS definitions.
Alexander Borisov [Fri, 8 Oct 2021 09:32:42 +0000 (12:32 +0300)]
Fixed unhandled promise rejection in handle events.
This closes #423 issue on GitHub.
Dmitry Volyntsev [Wed, 6 Oct 2021 13:16:09 +0000 (13:16 +0000)]
Style.
Sergey Kandaurov [Wed, 6 Oct 2021 12:57:14 +0000 (15:57 +0300)]
Fixed timeouts with Fetch, SSL and select.
Similar to the connection hang fixed in
058a67435e83 in nginx,
it is possible that an established connection is ready for reading
after the handshake. Further, events might be already disabled
in case of level-triggered event methods.
Fix is to post a read event if the c->read->ready flag is set.
Antoine Bonavita [Wed, 1 Sep 2021 18:43:56 +0000 (20:43 +0200)]
Added support for HTTPS URLs to the Fetch API.
The fetch API now accepts an extra parameters:
- verify: boolean (default true) to control server certificate
verification.
Verification process can be controlled with the following directives
from the http js and stream js modules:
- js_fetch_ciphers
- js_fetch_protocols
- js_fetch_verify_depth
- js_fetch_trusted_certificate
In collaboration with Dmitry Volyntsev.
Dmitry Volyntsev [Tue, 5 Oct 2021 13:01:11 +0000 (13:01 +0000)]
Modules: simplified reporting of failures in ngx.fetch() method.
Dmitry Volyntsev [Wed, 29 Sep 2021 16:13:36 +0000 (16:13 +0000)]
Tests: introducing repeat argument for unit tests.
Dmitry Volyntsev [Wed, 29 Sep 2021 13:45:26 +0000 (13:45 +0000)]
Fixed function constructor for cloned VMs.
Previously a shared "keywords_hash" and "values_hash" were used while
compiling functions in runtime. This led to populating a shared hash
with elements allocated in a cloned VM. Which resulted in
heap-use-after-free when next cloned VM accesses the shared hashes.
Dmitry Volyntsev [Fri, 17 Sep 2021 18:29:40 +0000 (18:29 +0000)]
Fixed njs_buffer_slot().
Previously, njs_buffer_slot() might return NULL value without setting
corresponding exception where user code expects it.
In addition the function is split into two functions. The internal one
does not set anything to vm->retval. This function has to be used by
property handlers, because they are expected not to modify vm->retval.
Dmitry Volyntsev [Fri, 17 Sep 2021 18:29:40 +0000 (18:29 +0000)]
Style.
Dmitry Volyntsev [Fri, 3 Sep 2021 14:57:50 +0000 (14:57 +0000)]
Fixed AsyncFunction prototype property "name".
According to the spec the AsyncFunction prototype does not
have own property "name".
Alexander Borisov [Thu, 2 Sep 2021 16:33:32 +0000 (19:33 +0300)]
Added async support for object initializer.
Alexander Borisov [Thu, 2 Sep 2021 16:33:03 +0000 (19:33 +0300)]
Parser: catching errors parsing in await expression.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:52 +0000 (19:32 +0300)]
Parser: removed dead store in await;
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:34 +0000 (19:32 +0300)]
Parser: fixed flag setting when parsing function arguments.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Thu, 2 Sep 2021 16:32:27 +0000 (19:32 +0300)]
Fixed async ctx erasing when a function is called multiple times.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Wed, 1 Sep 2021 18:25:10 +0000 (21:25 +0300)]
Fixed order of code execution after await in try block.
The bug was introduced in
92d10cd761e2 .
Alexander Borisov [Wed, 1 Sep 2021 13:31:08 +0000 (16:31 +0300)]
Introduced Async/Await implementation.
This closes #419 issue on GitHub.
Alexander Borisov [Wed, 1 Sep 2021 13:31:08 +0000 (16:31 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 31 Aug 2021 14:04:23 +0000 (14:04 +0000)]
Added tag 0.6.2 for changeset
dfba7f61745c
Dmitry Volyntsev [Tue, 31 Aug 2021 13:38:39 +0000 (13:38 +0000)]
Version 0.6.2.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:44 +0000 (13:16 +0000)]
Fixed %TypedArray%.prototype.join() with detached buffer.
The TypedArray buffer may be detached while evaluating custom
"separator" argument. The fix is to move the buffer check below this
point.
Found by Official ECMAScript Conformance Test Suite.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:43 +0000 (13:16 +0000)]
Memory: added cleanup handlers support.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:42 +0000 (13:16 +0000)]
Allowing to pass arbitrary pointer to object iterator handler.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:42 +0000 (13:16 +0000)]
Shell: fixed memory leak in script options.
Dmitry Volyntsev [Tue, 31 Aug 2021 13:16:32 +0000 (13:16 +0000)]
Fixed backtrace output for arrays broken in
b0177571ce1d .
After the previous commit the array prototype methods were not found
during njs_object_traverse() invocation. As the result the exceptions in
Array.prototype methods were reported with a backtrace containing "native
(native)" instead of a proper function name.
Dmitry Volyntsev [Thu, 19 Aug 2021 16:17:19 +0000 (16:17 +0000)]
Refactored njs_object_traverse().
The previous approach was inconsistent in treating shared properties
with other places (JSON.stringify()) where object is iterated.
Dmitry Volyntsev [Fri, 13 Aug 2021 12:20:46 +0000 (12:20 +0000)]
Allowing to create external objects with NULL external pointer.
Miao Wang [Wed, 11 Aug 2021 03:44:12 +0000 (11:44 +0800)]
Stream: fixed CPU hog when js_filter is registered in both directions.
Previously, a single busy chain was used to track filtered data in both
directions. This might lead to a situation when busy chunks are not
freed properly and pile up.
The fix is to separate busy chain for upstream and downstream directions.
This closes #413 issue on Github.
Alexander Borisov [Wed, 11 Aug 2021 18:48:52 +0000 (21:48 +0300)]
Added remaining Promise constructor methods.
The following methods were added: Promise.all(), Promise.allSettled(),
Promise.any(), Promise.race().
Alexander Borisov [Wed, 11 Aug 2021 18:48:51 +0000 (21:48 +0300)]
Fixed resolve/reject callback for Promise.prototype.finally().
Alexander Borisov [Wed, 11 Aug 2021 18:48:51 +0000 (21:48 +0300)]
Introduced AggregateError implementation.
Alexander Borisov [Wed, 11 Aug 2021 18:48:50 +0000 (21:48 +0300)]
Moving generic iterator code to a proper location.
Alexander Borisov [Thu, 15 Jul 2021 17:32:44 +0000 (20:32 +0300)]
The maximum depth of nested functions is set to 128.
Alexander Borisov [Thu, 15 Jul 2021 17:32:43 +0000 (20:32 +0300)]
Removed recursion from finding let closures.
Alexander Borisov [Thu, 15 Jul 2021 17:32:40 +0000 (20:32 +0300)]
Removed recursion from code generator.
Dmitry Volyntsev [Thu, 15 Jul 2021 14:51:57 +0000 (14:51 +0000)]
Added generic AST traverser.
Dmitry Volyntsev [Wed, 14 Jul 2021 13:18:56 +0000 (13:18 +0000)]
File flags table cleanup.
Dmitry Volyntsev [Tue, 13 Jul 2021 15:22:24 +0000 (15:22 +0000)]
Added support for ArrayBuffer in njs_vm_value_to_bytes().
hyeonisism [Tue, 13 Jul 2021 01:23:23 +0000 (10:23 +0900)]
Added fs flags missed in
5c6aa60224cb (0.1.15).
This closes #405 issue on Github.
Dmitry Volyntsev [Fri, 9 Jul 2021 19:14:23 +0000 (19:14 +0000)]
Marking different external pointer with unique tag.
An external value has an arbitrary raw pointer associated with it.
External values with different prototypes have different C-level
structures. To ensure that only appropriate structures are fetched
by njs_vm_external() the unique tag has to be provided during
creation of external values.
Dmitry Volyntsev [Fri, 9 Jul 2021 14:01:26 +0000 (14:01 +0000)]
Modules: improved working with external prototypes.
This patch avoids relying on the order in which external prototypes are
registered. Instead, the returned proto_id is expected to be stored
somewhere.
Valentin Bartenev [Fri, 9 Jul 2021 09:03:11 +0000 (12:03 +0300)]
Unicode case tables updated to version 14.0.0 (May 2021).
Alexander Borisov [Tue, 29 Jun 2021 14:08:23 +0000 (17:08 +0300)]
Fixed rest parameter parsing without binding identifier.
This closes #400 issue on GitHub.
Alexander Borisov [Tue, 29 Jun 2021 14:08:21 +0000 (17:08 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 29 Jun 2021 12:12:57 +0000 (12:12 +0000)]
Added tag 0.6.1 for changeset
4adbe67b292a
Dmitry Volyntsev [Tue, 29 Jun 2021 11:47:04 +0000 (11:47 +0000)]
Version 0.6.1.
Artem S. Povalyukhin [Thu, 24 Jun 2021 05:53:12 +0000 (08:53 +0300)]
Fixed parsing of export default declarations.
With non-assignment expression.
Dmitry Volyntsev [Fri, 25 Jun 2021 17:00:12 +0000 (17:00 +0000)]
Fixed RegExpBuiltinExec() with UTF-8 only regexps.
The original issue was introduced in
f9082cd59ba6 (0.4.2) while adding
RegExpBuiltinExec(), but after
de64420d0f2b (0.6.0) it started to affect
RegExp.prototype.test() as it was rewritten according to spec.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:48 +0000 (15:01 +0000)]
Introduced "debugger" token support.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:13 +0000 (15:01 +0000)]
Fixed printing AST with recently added tokens.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:01:12 +0000 (15:01 +0000)]
Printing AST before trying to generate code.
Dmitry Volyntsev [Fri, 18 Jun 2021 15:00:32 +0000 (15:00 +0000)]
Version bump.
Dmitry Volyntsev [Tue, 15 Jun 2021 12:53:09 +0000 (12:53 +0000)]
Added tag 0.6.0 for changeset
742ebceef2b5