]> git.kaiwu.me - njs.git/log
njs.git
6 years agoFixed truth value of JSON numbers in JSON.parse().
Dmitry Volyntsev [Tue, 11 Jun 2019 14:34:59 +0000 (17:34 +0300)]
Fixed truth value of JSON numbers in JSON.parse().

This closes #180 issue on Github.

6 years agoStyle.
hongzhidao [Tue, 11 Jun 2019 01:40:11 +0000 (21:40 -0400)]
Style.

6 years agoMoving object property methods to njs_object_property.c.
hongzhidao [Tue, 11 Jun 2019 01:30:29 +0000 (21:30 -0400)]
Moving object property methods to njs_object_property.c.

6 years agoImproved object property attributes.
hongzhidao [Wed, 5 Jun 2019 14:13:47 +0000 (22:13 +0800)]
Improved object property attributes.

6 years agoFixed Object.defineProperty() for shared descriptors.
Dmitry Volyntsev [Tue, 4 Jun 2019 16:38:50 +0000 (19:38 +0300)]
Fixed Object.defineProperty() for shared descriptors.

This closes #172 issue on Github.

6 years agoHTTP: support for null as a second argument of r.subrequest().
Dmitry Volyntsev [Tue, 4 Jun 2019 13:07:14 +0000 (16:07 +0300)]
HTTP: support for null as a second argument of r.subrequest().

This closes #173 issue on Github.

6 years agoHandling zero byte characters inside RegExp pattern strings.
Dmitry Volyntsev [Tue, 4 Jun 2019 09:45:06 +0000 (12:45 +0300)]
Handling zero byte characters inside RegExp pattern strings.

Fixed heap-buffer-overflow in RegExp.prototype.source.
This closes #168 issue on Github.

6 years agoEscaping lone closing square brackets in RegExp() constructor.
Dmitry Volyntsev [Thu, 30 May 2019 17:05:14 +0000 (20:05 +0300)]
Escaping lone closing square brackets in RegExp() constructor.

This correctly fixes #157. As in 88263426432d this was done only
for regexp literals.

6 years agoFixed String.prototype.toBytes() for ASCII strings.
Dmitry Volyntsev [Fri, 31 May 2019 12:11:39 +0000 (15:11 +0300)]
Fixed String.prototype.toBytes() for ASCII strings.

This closes #155 issue on Github.

6 years agoFixed heap-buffer-overflow in toUpperCase() and toLowerCase().
Dmitry Volyntsev [Thu, 30 May 2019 13:46:26 +0000 (16:46 +0300)]
Fixed heap-buffer-overflow in toUpperCase() and toLowerCase().

In String.prototype. This closes #162 issue on Github.

6 years agoMoving test added in ab5d059e4ef8 to a conditional list.
Dmitry Volyntsev [Thu, 30 May 2019 13:16:22 +0000 (16:16 +0300)]
Moving test added in ab5d059e4ef8 to a conditional list.

As it can fail on older libpcre versions (pcre-7.8 for example).

6 years agoRemoving possible ignored regexp compilation error.
Dmitry Volyntsev [Thu, 30 May 2019 11:17:59 +0000 (14:17 +0300)]
Removing possible ignored regexp compilation error.

6 years agoImproved processing of invalid surrogate pairs in JSON strings.
Alexander Borisov [Tue, 28 May 2019 17:51:24 +0000 (20:51 +0300)]
Improved processing of invalid surrogate pairs in JSON strings.

Previously, an exception was thrown on invalid surrogate pairs.
Now, all such pairs are converted to replacement character.

6 years agoImproved processing of invalid surrogate pairs in strings.
Alexander Borisov [Tue, 28 May 2019 17:49:58 +0000 (20:49 +0300)]
Improved processing of invalid surrogate pairs in strings.

Previously, an exception was thrown on invalid surrogate pairs.
Now, all such pairs are converted to replacement character.

This closes #170 issue on GitHub.

6 years agoAdded generic implementation of Array.prototype.fill().
Alexander Borisov [Thu, 23 May 2019 15:03:46 +0000 (18:03 +0300)]
Added generic implementation of Array.prototype.fill().

According to ES6: 22.1.3.6.

This closes #72 issue on GitHub.

6 years agoStream: fixed processing empty output chain in body filter.
Dmitry Volyntsev [Tue, 28 May 2019 14:04:40 +0000 (17:04 +0300)]
Stream: fixed processing empty output chain in body filter.

This closes #1735 on trac.

6 years agoHTTP: improved working with unknown methods in subrequest().
Dmitry Volyntsev [Tue, 28 May 2019 14:04:33 +0000 (17:04 +0300)]
HTTP: improved working with unknown methods in subrequest().

6 years agoHTTP: improved getting of special response headers.
Dmitry Volyntsev [Tue, 28 May 2019 12:57:35 +0000 (15:57 +0300)]
HTTP: improved getting of special response headers.

6 years agoAdded njs_value_property_set() function.
Alexander Borisov [Thu, 23 May 2019 14:39:22 +0000 (17:39 +0300)]
Added njs_value_property_set() function.

6 years agoFixed format of the reference exception.
Alexander Borisov [Mon, 27 May 2019 16:06:34 +0000 (19:06 +0300)]
Fixed format of the reference exception.

Previously, it did not include filename.

6 years agoFixed Array.prototype.toString() and Date.prototype.toJSON().
hongzhidao [Tue, 21 May 2019 23:54:58 +0000 (07:54 +0800)]
Fixed Array.prototype.toString() and Date.prototype.toJSON().

This closes #163, #164, #166 issues on Github.

6 years agoAdded "name" property for built-in methods.
Valentin Bartenev [Thu, 23 May 2019 13:21:55 +0000 (16:21 +0300)]
Added "name" property for built-in methods.

6 years agoFixed overwriting "constructor" property of built-in prototypes.
Valentin Bartenev [Thu, 23 May 2019 12:05:52 +0000 (15:05 +0300)]
Fixed overwriting "constructor" property of built-in prototypes.

6 years agoFixed array length property handler.
Valentin Bartenev [Thu, 23 May 2019 12:05:51 +0000 (15:05 +0300)]
Fixed array length property handler.

Previously it might change the length of prototype arrays.

6 years agoMade writable most of built-in properties and methods.
Valentin Bartenev [Thu, 23 May 2019 12:05:51 +0000 (15:05 +0300)]
Made writable most of built-in properties and methods.

6 years agoFixed setting of object properties.
Valentin Bartenev [Thu, 23 May 2019 12:05:50 +0000 (15:05 +0300)]
Fixed setting of object properties.

Now writability of prototype properties is properly taken into account.

6 years agoImproved working with undefined symbols.
Alexander Borisov [Wed, 22 May 2019 18:01:39 +0000 (21:01 +0300)]
Improved working with undefined symbols.

Throwing ReferenceError in runtime.

This closes #150 issue on GitHub.

6 years agoUncommented a successful test of Object.create([1,2]).length.
Valentin Bartenev [Tue, 21 May 2019 18:15:21 +0000 (21:15 +0300)]
Uncommented a successful test of Object.create([1,2]).length.

It's actually passing after f5bdddca3252.

6 years agoFixed integer-overflow in String.prototype.concat().
Alexander Borisov [Tue, 21 May 2019 17:45:42 +0000 (20:45 +0300)]
Fixed integer-overflow in String.prototype.concat().

This closes #159 issue on GitHub.

6 years agoVersion bump.
Dmitry Volyntsev [Tue, 21 May 2019 16:39:25 +0000 (19:39 +0300)]
Version bump.

6 years agoAdded tag 0.3.2 for changeset 82101d50fff6
Dmitry Volyntsev [Tue, 21 May 2019 14:32:32 +0000 (17:32 +0300)]
Added tag 0.3.2 for changeset 82101d50fff6

6 years agoVersion 0.3.2. 0.3.2
Dmitry Volyntsev [Tue, 21 May 2019 14:31:13 +0000 (17:31 +0300)]
Version 0.3.2.

6 years agoStyle.
hongzhidao [Mon, 20 May 2019 08:05:58 +0000 (16:05 +0800)]
Style.

6 years agoFixed handling of empty block statements.
hongzhidao [Mon, 20 May 2019 15:14:29 +0000 (23:14 +0800)]
Fixed handling of empty block statements.

This closes #165 issue on Github.

6 years agoAdded escaping to lone closing square brackets in a regexp.
Alexander Borisov [Fri, 17 May 2019 14:01:10 +0000 (17:01 +0300)]
Added escaping to lone closing square brackets in a regexp.

PCRE with PCRE_JAVASCRIPT_COMPAT flag rejects regexps with
lone closing square brackets as invalid. Whereas according
to ES6: 11.8.5 it is a valid regexp expression.

As a workaround, the solution is to escape those lone brackets.

This closes #157 issue on GitHub.

6 years agoFixed String.prototype.split() for UTF8-invalid byte strings.
Dmitry Volyntsev [Fri, 17 May 2019 18:16:31 +0000 (21:16 +0300)]
Fixed String.prototype.split() for UTF8-invalid byte strings.

This closes #161 issue on Github.

6 years agoFixed Array.prototype.slice() for UTF8-invalid byte strings.
Dmitry Volyntsev [Fri, 17 May 2019 14:52:30 +0000 (17:52 +0300)]
Fixed Array.prototype.slice() for UTF8-invalid byte strings.

This closes #160 issue on Github.

7 years agoImproved String.prototype.replace().
Alexander Borisov [Tue, 14 May 2019 10:00:44 +0000 (13:00 +0300)]
Improved String.prototype.replace().

If replace value is a function and the function return non string
value, then convert returned value to string.

This closes #61 issue on GitHub.

7 years agoFixed processing * quantifier for String.prototype.replace().
Alexander Borisov [Wed, 8 May 2019 14:05:05 +0000 (17:05 +0300)]
Fixed processing * quantifier for String.prototype.replace().

This closes #73 issue on GitHub.

6 years agoFixed uninitialized-memory-access in Object.defineProperties().
Dmitry Volyntsev [Thu, 16 May 2019 12:20:31 +0000 (15:20 +0300)]
Fixed uninitialized-memory-access in Object.defineProperties().

This closes #158 issue on Github.

6 years agoFixed regexp literals parsing.
Alexander Borisov [Wed, 15 May 2019 09:51:31 +0000 (12:51 +0300)]
Fixed regexp literals parsing.

Problems were observed:
1. Escaping symbols: /\\\\/
2. Solidus symbol ('/') in square bracket: /[/]/

This closes #149 issue on GitHub.

7 years agoFixed heap-buffer-overflow in String.prototype.lastIndexOf().
Dmitry Volyntsev [Tue, 14 May 2019 16:13:53 +0000 (19:13 +0300)]
Fixed heap-buffer-overflow in String.prototype.lastIndexOf().

This closes #151 issue on Github.

7 years agoImproved working with arguments in String.prototype.lastIndexOf().
Dmitry Volyntsev [Tue, 14 May 2019 16:00:03 +0000 (19:00 +0300)]
Improved working with arguments in String.prototype.lastIndexOf().

7 years agoFixed heap-buffer-overflow in String.prototype.replace().
Dmitry Volyntsev [Mon, 13 May 2019 17:28:40 +0000 (20:28 +0300)]
Fixed heap-buffer-overflow in String.prototype.replace().

This closes #154 issue on GitHub.

7 years agoFixed arrays expansion.
Valentin Bartenev [Wed, 8 May 2019 16:09:10 +0000 (19:09 +0300)]
Fixed arrays expansion.

There were two problems with njs_array_expand():

 1. It checked that the requred size with the appended elements wasn't bigger
    then the array size and then did nothing.  If there were elements removed
    from the beggining (by shift() operation), then "size <= array->size" can
    be true even if there wasn't enought free space after the array.

 2. After allocating more space to prepend elements, it set array->size without
    counting those elements.

Probably, the original idea was to decrement array->size while removing
elements from the beginning, but it wasn't done right.  Even if so, the
new version of the function looks cleaner.

This closes #152 and closes #153 issues on Github.

7 years agoSimplified check for array length limit in njs_array_expand().
Valentin Bartenev [Wed, 8 May 2019 16:09:10 +0000 (19:09 +0300)]
Simplified check for array length limit in njs_array_expand().

No functional changes.

7 years agoBetter name for append elements count in njs_array_expand().
Valentin Bartenev [Wed, 8 May 2019 16:09:10 +0000 (19:09 +0300)]
Better name for append elements count in njs_array_expand().

No functional changes.

7 years agoMade all constructor properties configurable.
Valentin Bartenev [Tue, 7 May 2019 17:41:07 +0000 (20:41 +0300)]
Made all constructor properties configurable.

Note that actual "constructor" property is created on demand in the prototypes'
private hash with "configurable" option set.  This change corrects its state
before any access.

7 years agoShell: executing command from command line arguments.
Dmitry Volyntsev [Tue, 7 May 2019 16:50:39 +0000 (19:50 +0300)]
Shell: executing command from command line arguments.

7 years agoShell: sorting arguments in alphabetic order.
Dmitry Volyntsev [Tue, 7 May 2019 16:50:38 +0000 (19:50 +0300)]
Shell: sorting arguments in alphabetic order.

7 years agoImproved expect tests.
Dmitry Volyntsev [Tue, 7 May 2019 16:50:35 +0000 (19:50 +0300)]
Improved expect tests.

7 years agoMade configurable "length", "name", and most of built-in methods.
Valentin Bartenev [Mon, 6 May 2019 02:40:03 +0000 (05:40 +0300)]
Made configurable "length", "name", and most of built-in methods.

7 years agoFixed return value on deleting non-existent property.
Valentin Bartenev [Mon, 6 May 2019 18:24:31 +0000 (21:24 +0300)]
Fixed return value on deleting non-existent property.

7 years agoAdded own constructors to prototypes of built-in objects.
Valentin Bartenev [Mon, 6 May 2019 17:26:58 +0000 (20:26 +0300)]
Added own constructors to prototypes of built-in objects.

7 years agoAdded support for RegExp "groups" object (ES9).
Valentin Bartenev [Mon, 6 May 2019 16:42:06 +0000 (19:42 +0300)]
Added support for RegExp "groups" object (ES9).

7 years agoFixed own properties quering.
Valentin Bartenev [Mon, 6 May 2019 08:33:23 +0000 (11:33 +0300)]
Fixed own properties quering.

njs_property_query() and njs_object_property_query() were simplified.

7 years agoFixed alignment of njs_object_prop_t in njs_method_private_copy().
Valentin Bartenev [Mon, 6 May 2019 14:47:26 +0000 (17:47 +0300)]
Fixed alignment of njs_object_prop_t in njs_method_private_copy().

It must be aligned to njs_value_t.

7 years agoAdded missing "static" to njs_object_property_query() declaration.
Valentin Bartenev [Mon, 6 May 2019 02:07:51 +0000 (05:07 +0300)]
Added missing "static" to njs_object_property_query() declaration.

7 years agoUncommented a successful test of getOwnPropertyNames().
Valentin Bartenev [Sun, 5 May 2019 21:27:22 +0000 (00:27 +0300)]
Uncommented a successful test of getOwnPropertyNames().

It's actully passing after 1213e0a2b485 and d7a0eb59a7e7 changes.

7 years agoAdded the "name" property to the Function prototype object.
Valentin Bartenev [Sat, 4 May 2019 14:12:35 +0000 (17:12 +0300)]
Added the "name" property to the Function prototype object.

Its value according to the ES6+ specification must be the empty String.

7 years agoStyle.
Valentin Bartenev [Sat, 4 May 2019 13:59:24 +0000 (16:59 +0300)]
Style.

7 years agoSimplified condition in njs_function_alloc().
Valentin Bartenev [Sat, 4 May 2019 02:52:15 +0000 (05:52 +0300)]
Simplified condition in njs_function_alloc().

There's no reason to check both flags when one depends on another.
See just a few lines above: function->ctor = !lambda->arrow.

Now the condition is made similar to the one in njs_method_private_copy().

7 years agoAdded missed njs_internal_error() call in njs_regexp_exec_result().
Valentin Bartenev [Fri, 3 May 2019 21:56:39 +0000 (00:56 +0300)]
Added missed njs_internal_error() call in njs_regexp_exec_result().

7 years agoRejection of multiple "var" declarations in the for-in statement.
Valentin Bartenev [Thu, 2 May 2019 18:21:16 +0000 (21:21 +0300)]
Rejection of multiple "var" declarations in the for-in statement.

7 years agoCorrected error message when parsing "var" inside "for".
Valentin Bartenev [Thu, 2 May 2019 08:08:44 +0000 (11:08 +0300)]
Corrected error message when parsing "var" inside "for".

The "var_in" flag indicates parsing inside the "for" statement with expectation
of the "in" token, but it doesn't define the loop as a for-in one.  In fact,
that's unknown at the moment when this particular error message is emitted.

As a result, the following code:

  for (var eval = 10; eval; eval--);

produces the error message about for-in loop:

  SyntaxError: Identifier "eval" is forbidden in for-in var declaration

Actually, according to the specification "eval" isn't a keyword and shouldn't
cause any errors here.  But this bug is beyond the scope of the current fix.

7 years agoSimplified parsing of var statements.
hongzhidao [Mon, 29 Apr 2019 12:57:36 +0000 (15:57 +0300)]
Simplified parsing of var statements.

7 years agoMaking njs_lexer_rollback() more generic.
hongzhidao [Mon, 29 Apr 2019 05:31:16 +0000 (13:31 +0800)]
Making njs_lexer_rollback() more generic.

7 years agoAdded extra tests for assignment expression.
Dmitry Volyntsev [Sun, 28 Apr 2019 11:56:33 +0000 (14:56 +0300)]
Added extra tests for assignment expression.

This closes #52 issue on Github.

7 years agoImproved njs_lexer_rollback().
hongzhidao [Sat, 27 Apr 2019 01:04:24 +0000 (09:04 +0800)]
Improved njs_lexer_rollback().

7 years agoFixed null pointer dereferences introduced in f5bdddca3252.
Dmitry Volyntsev [Sat, 27 Apr 2019 17:28:37 +0000 (20:28 +0300)]
Fixed null pointer dereferences introduced in f5bdddca3252.

CID 1444775, CID 1444776.

7 years agoImproved njs_vm_continuation().
hongzhidao [Fri, 26 Apr 2019 13:30:04 +0000 (21:30 +0800)]
Improved njs_vm_continuation().

This closes #142 issue on Github.

7 years agoImproved njs_function_native_call().
hongzhidao [Fri, 26 Apr 2019 11:57:54 +0000 (19:57 +0800)]
Improved njs_function_native_call().

7 years agoRemoved NXT_READLINE_CFLAGS.
Valentin Bartenev [Fri, 26 Apr 2019 16:30:43 +0000 (19:30 +0300)]
Removed NXT_READLINE_CFLAGS.

It's not needed after 61f2616e21c7.

7 years agoSupport for building with GNU Readline library.
Valentin Bartenev [Fri, 26 Apr 2019 14:59:42 +0000 (17:59 +0300)]
Support for building with GNU Readline library.

7 years agoFixed Date() constructor with one argument.
Dmitry Volyntsev [Thu, 25 Apr 2019 16:50:20 +0000 (19:50 +0300)]
Fixed Date() constructor with one argument.

This closes #144 issue on Github.

7 years agoImproved text for method frame exception.
Dmitry Volyntsev [Thu, 25 Apr 2019 16:33:35 +0000 (19:33 +0300)]
Improved text for method frame exception.

7 years agoFixed njs_vmcode_restart().
hongzhidao [Thu, 25 Apr 2019 12:56:44 +0000 (15:56 +0300)]
Fixed njs_vmcode_restart().

7 years agoDisabling njs_retain() and njs_release().
Dmitry Volyntsev [Thu, 25 Apr 2019 12:50:03 +0000 (15:50 +0300)]
Disabling njs_retain() and njs_release().

Until there is a working GC.

7 years agoFixed special getters for objects created using Object.create().
Dmitry Volyntsev [Thu, 25 Apr 2019 12:19:37 +0000 (15:19 +0300)]
Fixed special getters for objects created using Object.create().

This closes #124 issue on Github.

7 years agoFixed string object creation using Object() constructor.
Dmitry Volyntsev [Thu, 25 Apr 2019 12:19:36 +0000 (15:19 +0300)]
Fixed string object creation using Object() constructor.

7 years agoImproved String.prototype.match() function.
Alexander Borisov [Wed, 24 Apr 2019 16:04:23 +0000 (19:04 +0300)]
Improved String.prototype.match() function.

7 years agoAdded processing asterisk quantifier for String.prototype.match().
Alexander Borisov [Wed, 24 Apr 2019 16:04:22 +0000 (19:04 +0300)]
Added processing asterisk quantifier for String.prototype.match().

The lack of processing asterisk quantification in regexp led to infinity
loop in String.prototype.match() function.

7 years agoAdded macro for converting surrogate pair to code point.
Alexander Borisov [Tue, 23 Apr 2019 15:10:37 +0000 (18:10 +0300)]
Added macro for converting surrogate pair to code point.

7 years agoFixed parsing surrogate pair presents as UTF-16 escape sequences.
Alexander Borisov [Mon, 22 Apr 2019 13:23:50 +0000 (16:23 +0300)]
Fixed parsing surrogate pair presents as UTF-16 escape sequences.

This closes #96 issue on GitHub.

7 years agoFixed length calculation for UTF-8 string with escape characters.
Alexander Borisov [Mon, 22 Apr 2019 13:23:43 +0000 (16:23 +0300)]
Fixed length calculation for UTF-8 string with escape characters.

This closes #133 issue on GitHub.

7 years agoFixed condition on already been declared exception.
Dmitry Volyntsev [Tue, 23 Apr 2019 12:31:40 +0000 (15:31 +0300)]
Fixed condition on already been declared exception.

7 years agoAdded support for template literals.
hongzhidao [Mon, 22 Apr 2019 16:53:41 +0000 (19:53 +0300)]
Added support for template literals.

What is supported:
1) Multiline strings
`string text line 1
string text line 2`

2) Expression interpolation
`string text ${expression} string text`

3) Nested templates
4) Tagged templates

This closes #107 issue on Github.

In collaboration with Artem S. Povalyukhin.

7 years agoAdded block scoped function definitions support.
hongzhidao [Sun, 21 Apr 2019 10:11:58 +0000 (18:11 +0800)]
Added block scoped function definitions support.

This closes #134 issue on Github.

7 years agoImproved array allocation test for low memory machines.
Alexander Borisov [Mon, 22 Apr 2019 15:06:17 +0000 (18:06 +0300)]
Improved array allocation test for low memory machines.

7 years agoRestricted function declaration to top level or inside a block.
hongzhidao [Sun, 21 Apr 2019 09:36:25 +0000 (17:36 +0800)]
Restricted function declaration to top level or inside a block.

7 years agoAdded option to run unit tests in module mode.
hongzhidao [Sun, 21 Apr 2019 09:33:31 +0000 (17:33 +0800)]
Added option to run unit tests in module mode.

7 years agoFixed overflow in Array.prototype.concat().
Alexander Borisov [Fri, 19 Apr 2019 14:24:29 +0000 (17:24 +0300)]
Fixed overflow in Array.prototype.concat().

This closes #131 issue on GitHub.

7 years agoAdded uint32_t overflow check for njs_array_alloc() function.
Alexander Borisov [Fri, 19 Apr 2019 14:48:39 +0000 (17:48 +0300)]
Added uint32_t overflow check for njs_array_alloc() function.

7 years agoSimplified typeof operation.
hongzhidao [Fri, 19 Apr 2019 12:03:49 +0000 (20:03 +0800)]
Simplified typeof operation.

7 years agoStyle.
Dmitry Volyntsev [Thu, 18 Apr 2019 17:51:53 +0000 (20:51 +0300)]
Style.

7 years agoRefactored variable reference.
hongzhidao [Thu, 18 Apr 2019 16:28:31 +0000 (00:28 +0800)]
Refactored variable reference.

7 years agoTests: freeing pcre structs to silence leak-sanitizer.
Dmitry Volyntsev [Thu, 18 Apr 2019 16:17:22 +0000 (19:17 +0300)]
Tests: freeing pcre structs to silence leak-sanitizer.

7 years agoWalking over prototypes chain during iteration over an object.
Alexander Borisov [Wed, 17 Apr 2019 15:00:56 +0000 (18:00 +0300)]
Walking over prototypes chain during iteration over an object.

This closes #33 issue on Github.

7 years agoAdded two new function for working with enumerate value.
Alexander Borisov [Wed, 17 Apr 2019 14:27:14 +0000 (17:27 +0300)]
Added two new function for working with enumerate value.

New functions njs_value_enumerate() and njs_value_own_enumerate().
Changed function njs_object_enumerate() for working only with object.

7 years agoAdded function to get length of the string.
Alexander Borisov [Wed, 17 Apr 2019 14:13:39 +0000 (17:13 +0300)]
Added function to get length of the string.

Renamed function njs_string_length() to njs_string_eval_length().