]>
git.kaiwu.me - njs.git/log
Dmitry Volyntsev [Tue, 26 Nov 2019 12:01:02 +0000 (15:01 +0300)]
Fixed "accumulative" mode of VM.
The issue was introduced in
452ce96df2e3 .
This closes #258 issue on Github.
Dmitry Volyntsev [Mon, 25 Nov 2019 14:54:58 +0000 (17:54 +0300)]
HTTP: improved r.parent property handler.
Previously, r.parent handler threw an exception if it was called not for
a subrequest. This is too restrictive, as it prevents any iterations
over all r properties (for example: JSON.stringify()).
Instead, "undefined" value is returned as it is already done for
r.requestBody when request body is unavailable.
Dmitry Volyntsev [Mon, 25 Nov 2019 14:53:32 +0000 (17:53 +0300)]
Fixed njs.dump() for objects with NJS_PROPERTY_HANDLER props.
Dmitry Volyntsev [Mon, 25 Nov 2019 14:53:19 +0000 (17:53 +0300)]
Added externals support in JSON.stringify().
Artem S. Povalyukhin [Sat, 23 Nov 2019 09:52:06 +0000 (12:52 +0300)]
Pass unprintable values to JSON.stringify() replacer function.
This closes #257 issue on Github.
Artem S. Povalyukhin [Fri, 22 Nov 2019 22:02:04 +0000 (01:02 +0300)]
Fixed handling of Symbol values in JSON.stringify().
Artem S. Povalyukhin [Fri, 22 Nov 2019 21:09:26 +0000 (00:09 +0300)]
Fixed Object.prototype.valueOf() according to the specification.
This closes #256 issue on Github.
Dmitry Volyntsev [Fri, 22 Nov 2019 16:03:23 +0000 (19:03 +0300)]
Introduced Symbol.toStringTag support for builtin objects.
This closes #255 issue on Github.
Artem S. Povalyukhin [Fri, 22 Nov 2019 08:02:55 +0000 (11:02 +0300)]
Fixed typo in njs_string_prototype_pad().
The typo was introduced in
47cdd4680fc2 .
This closes #253 issue on Github.
Artem S. Povalyukhin [Thu, 21 Nov 2019 19:31:14 +0000 (22:31 +0300)]
Fixed hash collision for empty string key.
The issue was introduced in
10a19a2e1d4f .
Dmitry Volyntsev [Thu, 21 Nov 2019 17:56:06 +0000 (20:56 +0300)]
Added Symbol support for builtin operations.
1) object property get/set, object literals.
2) Added Object.getOwnPropertySymbols().
3) Extended to support Symbol: Object.getOwnPropertyNames(),
Object.keys(), Object.defineProperty(), Object.defineProperties(),
Object.getOwnPropertyDescriptor(),
Object.getOwnPropertyDescriptors().
Artem S. Povalyukhin [Tue, 19 Nov 2019 17:45:22 +0000 (20:45 +0300)]
Added initial version of Symbol primitive type.
This closes #249 issue on Github.
Dmitry Volyntsev [Tue, 19 Nov 2019 16:32:26 +0000 (19:32 +0300)]
Introduced njs_fuzzer target.
Dmitry Volyntsev [Tue, 19 Nov 2019 16:19:53 +0000 (19:19 +0300)]
Fixed handling of "init" flag in njs_vm_create().
Artem S. Povalyukhin [Tue, 19 Nov 2019 14:22:53 +0000 (17:22 +0300)]
Fixed Object.getPrototypeOf() according to the specification.
This closes #252 issue on Github.
Dmitry Volyntsev [Tue, 19 Nov 2019 16:17:09 +0000 (19:17 +0300)]
Detecting standard data types in configure script.
Dmitry Volyntsev [Tue, 19 Nov 2019 16:17:06 +0000 (19:17 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 19 Nov 2019 12:35:55 +0000 (15:35 +0300)]
Added tag 0.3.7 for changeset
9e5ef927c7ea
Dmitry Volyntsev [Tue, 19 Nov 2019 12:35:24 +0000 (15:35 +0300)]
Version 0.3.7.
Dmitry Volyntsev [Thu, 14 Nov 2019 18:06:48 +0000 (21:06 +0300)]
Reimplemented "bound" functions according to specification.
This closes #202 and closes #204 issues on Github.
Dmitry Volyntsev [Thu, 14 Nov 2019 18:01:28 +0000 (21:01 +0300)]
Setting optimization level to "-O0" when debug option is enabled.
Artem S. Povalyukhin [Tue, 12 Nov 2019 13:07:42 +0000 (16:07 +0300)]
Added support for labels in console.time().
This closes #248 issue on Github.
Dmitry Volyntsev [Wed, 13 Nov 2019 15:27:06 +0000 (18:27 +0300)]
Added extra configure options for debug builds.
Dmitry Volyntsev [Wed, 13 Nov 2019 12:31:41 +0000 (15:31 +0300)]
Fixed potential NULL-pointer dereference (CID
1455631 ).
Dmitry Volyntsev [Wed, 13 Nov 2019 12:19:49 +0000 (15:19 +0300)]
Refactored JSON methods.
Before
540f03725df2 the parse/stringify methods had to store
their local context in dynamic memory because each JS
function invocation interrupted them. Since JS function calls
are synchronous now the code can be greatly simplified.
Dmitry Volyntsev [Tue, 12 Nov 2019 12:09:48 +0000 (15:09 +0300)]
Avoiding dynamic allocation in JSON methods.
Before
540f03725df2 the parse/stringify state had to be allocated
from dynamic memory because function calls to JS functions were
asynchronous.
Artem S. Povalyukhin [Sat, 9 Nov 2019 22:35:02 +0000 (01:35 +0300)]
Fixed Math.round() according to the specification.
This closes #246 issue on Github.
Artem S. Povalyukhin [Thu, 31 Oct 2019 19:18:41 +0000 (22:18 +0300)]
Fixed handling of NaN and -0 arguments in Math.min(), Math.max().
This closes #241 issue on Github.
Dmitry Volyntsev [Mon, 11 Nov 2019 12:37:39 +0000 (15:37 +0300)]
Fixed a dead store.
Found by Clang static analyzer.
Dmitry Volyntsev [Mon, 11 Nov 2019 12:37:08 +0000 (15:37 +0300)]
Fixed sharing of externals between main and cloned VMs.
The issue was introduced in
7e7d0dac4572 .
This closes #245 issue on Github.
Dmitry Volyntsev [Fri, 8 Nov 2019 17:33:46 +0000 (20:33 +0300)]
Style.
Dmitry Volyntsev [Fri, 8 Nov 2019 13:29:34 +0000 (16:29 +0300)]
Unifying Date.prototype.*ToString() function into single handler.
Dmitry Volyntsev [Fri, 8 Nov 2019 13:29:29 +0000 (16:29 +0300)]
Refactored working with Date object.
1) Replacing gmtime_r() and localtime_r() with builtin function.
2) Custom getters and setters for each field (like hours, minutes,
seconds) are replaced with generic functions.
Dmitry Volyntsev [Fri, 8 Nov 2019 13:29:24 +0000 (16:29 +0300)]
Passing to native function additional magic argument.
This allows to make more generic function handlers.
Dmitry Volyntsev [Tue, 5 Nov 2019 17:49:57 +0000 (20:49 +0300)]
Added arguments validation for configure script.
Dmitry Volyntsev [Tue, 5 Nov 2019 17:49:56 +0000 (20:49 +0300)]
Added explanation for why njs CLI cannot be built.
Dmitry Volyntsev [Tue, 5 Nov 2019 17:49:56 +0000 (20:49 +0300)]
auto/cc cleanup.
Alexander Borisov [Tue, 5 Nov 2019 17:24:48 +0000 (20:24 +0300)]
Added implementation of Array.prototype.copyWithin().
Alexander Mazyrin [Sat, 12 Oct 2019 13:23:25 +0000 (16:23 +0300)]
Added Object.assign().
Dmitry Volyntsev [Fri, 1 Nov 2019 16:26:42 +0000 (19:26 +0300)]
Fixed "Date" object string formatting.
1) Getting rid of strftime() as it is locale dependent
whereas output should always be in english.
2) Unifying all formatters in a single function.
Dmitry Volyntsev [Fri, 1 Nov 2019 13:02:21 +0000 (16:02 +0300)]
Making custom top-level objects enumerable.
Dmitry Volyntsev [Fri, 1 Nov 2019 12:48:21 +0000 (15:48 +0300)]
Fixed typo introduced in
c75a8fc6d534 .
This closes #242 issue on Github.
Dmitry Volyntsev [Thu, 31 Oct 2019 16:53:21 +0000 (19:53 +0300)]
Fixed getter/setter proto.
This closes #238 issue on Github.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:34 +0000 (18:17 +0300)]
Fixed "constructor" property of "Hash" and "Hmac" objects.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:33 +0000 (18:17 +0300)]
Refactored object type initialization.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:32 +0000 (18:17 +0300)]
Removing console.help() from CLI as it not needed anymore.
Now all available objects are accessible through the global object.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:31 +0000 (18:17 +0300)]
Refactored completions and backtrace matches.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:31 +0000 (18:17 +0300)]
Moving constructors to global object.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:31 +0000 (18:17 +0300)]
Moving top-level objects to global object.
Dmitry Volyntsev [Thu, 31 Oct 2019 15:17:30 +0000 (18:17 +0300)]
Extending njs_prop_handler_t prototype.
Alexander Borisov [Wed, 30 Oct 2019 13:43:12 +0000 (16:43 +0300)]
Fixed Array.prototype.join() with "undefined" argument.
This closes #232 issue on GitHub.
Alexander Borisov [Wed, 30 Oct 2019 13:43:10 +0000 (16:43 +0300)]
Fixed Array.prototype.includes() with "undefined" argument.
This closes #230 issue on GitHub.
Alexander Borisov [Wed, 30 Oct 2019 13:43:09 +0000 (16:43 +0300)]
Fixed iterator for Array.prototype.find/findIndex() functions.
Array might be changed in callback function. If an array became smaller than
the initial one, it is necessary to iterate the missing values as invalid.
This closes #229 issue on GitHub.
Alexander Borisov [Tue, 29 Oct 2019 12:24:58 +0000 (15:24 +0300)]
Fixed strict aliasing warnings with old GCC versions.
Alexander Borisov [Mon, 28 Oct 2019 13:50:20 +0000 (16:50 +0300)]
Added conversion of this value to object in Array.prototype functions.
This closes #231 issue on GitHub.
Alexander Borisov [Mon, 28 Oct 2019 13:10:17 +0000 (16:10 +0300)]
Added njs_lvalue_arg() macro.
Dmitry Volyntsev [Fri, 25 Oct 2019 13:20:37 +0000 (16:20 +0300)]
Optimizing njs_vm_clone() for speed.
Postponing allocation of structures where possible.
Dmitry Volyntsev [Thu, 24 Oct 2019 13:17:17 +0000 (16:17 +0300)]
Fixed NativeError.prototype.message properties.
Dmitry Volyntsev [Thu, 24 Oct 2019 13:17:16 +0000 (16:17 +0300)]
Fixed [[Prototype]] slot of NativeErrors.
Dmitry Volyntsev [Thu, 24 Oct 2019 13:17:16 +0000 (16:17 +0300)]
Refactoring Error value types.
Eliminating special value types (njs_value_type_t) for error instance
objects. According to the spec error instance objects are ordinary
objects which have an [[ErrorData]] internal slot.
Alexander Borisov [Thu, 24 Oct 2019 13:15:01 +0000 (16:15 +0300)]
Fixed heap-buffer-overflow in njs_array_reverse_iterator() function.
Affected JS functions in Array.prototype: lastIndexOf, reduceRight.
Dmitry Volyntsev [Wed, 23 Oct 2019 11:42:38 +0000 (14:42 +0300)]
Refactoring iteration over external objects.
Previously, two callbacks were required to support
array-like iteration for external objects (foreach, next).
Instead using only one callback (keys) to simplify.
Dmitry Volyntsev [Wed, 23 Oct 2019 11:42:38 +0000 (14:42 +0300)]
Added njs_vm_array_alloc() and njs_vm_array_push() public API.
Alexander Borisov [Tue, 22 Oct 2019 16:58:52 +0000 (19:58 +0300)]
Removed argument prototypes for built-in functions.
Many JS functions do not have fixed prototypes as in C. For example
String.prototype.replace() accepts RegExp or String as the first argument.
Dmitry Volyntsev [Tue, 22 Oct 2019 11:43:30 +0000 (14:43 +0300)]
Version bump.
Dmitry Volyntsev [Tue, 22 Oct 2019 11:16:59 +0000 (14:16 +0300)]
Added tag 0.3.6 for changeset
7b302775917b
Dmitry Volyntsev [Tue, 22 Oct 2019 11:16:46 +0000 (14:16 +0300)]
Version 0.3.6.
Alexander Borisov [Mon, 21 Oct 2019 13:43:45 +0000 (16:43 +0300)]
Improved functions for converting value to number.
Added functions:
njs_value_to_number(), njs_value_to_integer(), njs_value_to_length()
njs_value_to_int32(), njs_value_to_uint32(), njs_value_to_uint16().
Removed functions:
njs_primitive_value_to_number(), njs_primitive_value_to_integer(),
njs_primitive_value_to_int32(), njs_primitive_value_to_uint32(),
njs_primitive_value_to_length().
Changed return type for njs_number_to_integer() function from int32_t
to int64_t.
Dmitry Volyntsev [Mon, 21 Oct 2019 12:10:34 +0000 (15:10 +0300)]
Fixed keyword list.
"undefined", "NaN" and "Infinity" are not keywords.
This closes #219 issue on Github.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:38:55 +0000 (16:38 +0300)]
Moving global functions to global object.
This closes #132 issue on Github.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:34:50 +0000 (16:34 +0300)]
Querying global object when variable cannot be resolved.
Dmitry Volyntsev [Fri, 18 Oct 2019 13:28:16 +0000 (16:28 +0300)]
Avoiding OBJECT COPY instruction each time global object accessed.
Artem S. Povalyukhin [Sat, 24 Aug 2019 02:41:46 +0000 (05:41 +0300)]
Fixed "caller" and "arguments" properties of a function instance.
This closes #209 issue on Github.
Dmitry Volyntsev [Tue, 15 Oct 2019 17:09:49 +0000 (20:09 +0300)]
HTTP: improved getting of special headers from r.headersIn.
If multiple "Cookie" or "X-Forwarded-For" are present they
are combined into a single return value.
This closes #201 issue on Github.
Alexander Borisov [Fri, 11 Oct 2019 16:41:51 +0000 (19:41 +0300)]
Added default number of arguments expected by builtin functions.
This closes #207 issue on GitHub.
Dmitry Volyntsev [Fri, 11 Oct 2019 14:08:28 +0000 (17:08 +0300)]
Fixed variable declaration with "from" name.
Previously, "from" was declared as a reserved word.
Artem S. Povalyukhin [Fri, 11 Oct 2019 03:50:33 +0000 (06:50 +0300)]
Fixed Date.prototype.setTime().
This closes #236 issue on Github.
Artem S. Povalyukhin [Fri, 11 Oct 2019 05:01:03 +0000 (08:01 +0300)]
Fixed type of Date.prototype.
This closes #237 issue on Github.
Dmitry Volyntsev [Thu, 10 Oct 2019 17:54:03 +0000 (20:54 +0300)]
Fixed Date() constructor according to specification.
Dmitry Volyntsev [Wed, 9 Oct 2019 11:43:09 +0000 (14:43 +0300)]
Fixed Date.UTC() according to specification.
This closes #235 issue on Github.
Alexander Borisov [Wed, 9 Oct 2019 15:54:57 +0000 (18:54 +0300)]
Fixed Array.prototype.pop() and shift() for sparse objects.
This closes #233 issue on GitHub.
Alexander Borisov [Wed, 9 Oct 2019 15:54:54 +0000 (18:54 +0300)]
Fixed Array functions according to specification.
Length property should be queried before checking arguments for validity.
Аffected functions:
every, filter, find, findIndex, forEach, map, reduce, reduceRight, some.
This closes #228 issue on GitHub.
Dmitry Volyntsev [Tue, 8 Oct 2019 12:56:58 +0000 (15:56 +0300)]
Fixing Coverity warnings related to close() (CID
1444170 ).
Alexander Borisov [Mon, 30 Sep 2019 08:41:00 +0000 (11:41 +0300)]
Fixed Array.prototype.map() for a object with nonexistent values.
Previously nonexistent values in the object were skipped and not added
to the result.
Dmitry Volyntsev [Mon, 7 Oct 2019 15:16:47 +0000 (18:16 +0300)]
Added Number.prototype.toExponential().
Dmitry Volyntsev [Mon, 7 Oct 2019 15:11:19 +0000 (18:11 +0300)]
Aligning prototypes of njs_grisu2() and njs_grisu2_prec().
Dmitry Volyntsev [Fri, 4 Oct 2019 16:46:35 +0000 (19:46 +0300)]
Increased maximum allowed recursion depth in parser and generator.
Dmitry Volyntsev [Fri, 4 Oct 2019 16:46:12 +0000 (19:46 +0300)]
Style.
Fixed typo in njs_arr_t structure.
This closes #226 issue on Github.
Dmitry Volyntsev [Fri, 4 Oct 2019 14:19:06 +0000 (17:19 +0300)]
Fixed Regexp.prototype.test() for regexps with backreferences.
This closes #225 issue on Github.
Dmitry Volyntsev [Thu, 3 Oct 2019 13:59:22 +0000 (16:59 +0300)]
Added Number.prototype.toPrecision().
This closes #221 issue on Github.
Dmitry Volyntsev [Thu, 3 Oct 2019 13:26:04 +0000 (16:26 +0300)]
Improved naming in njs_dtoa() internal functions.
Alexander Borisov [Thu, 3 Oct 2019 12:41:30 +0000 (15:41 +0300)]
Fixed buffer overflow in Number.prototype.toString(radix).
Valentin Bartenev [Fri, 27 Sep 2019 19:21:55 +0000 (22:21 +0300)]
Date.prototype.toUTCString() format was aligned to ES9.
This closes #224 issue on GitHub.
Alexander Borisov [Thu, 19 Sep 2019 07:19:02 +0000 (10:19 +0300)]
Improved iteration over objects indexes in Array functions.
For example, unshift function for object with large length:
var arrayLike = {};
arrayLike.length = 2 ** 53 - 1;
Array.prototype.unshift.call(arrayLike);
Alexander Borisov [Thu, 19 Sep 2019 07:19:02 +0000 (10:19 +0300)]
Fixed Array prototype functions according to the specification.
The following fuctions were fixed:
pop, push, shift, unshift.
Alexander Borisov [Thu, 19 Sep 2019 07:19:01 +0000 (10:19 +0300)]
Added njs_value_property_delete().
Alexander Borisov [Thu, 19 Sep 2019 07:19:00 +0000 (10:19 +0300)]
Fixed Array prototype functions according to the specification.
The following fuctions were fixed:
includes, indexOf, lastIndexOf, reduceRight.
Alexander Borisov [Tue, 17 Sep 2019 08:29:10 +0000 (11:29 +0300)]
Fixed stack-use-after-scope in Array.prototype.map().
In the njs_array_iterator() an args.value is replaced to value on stack
for non-object strings.
Alexander Borisov [Tue, 17 Sep 2019 06:20:24 +0000 (09:20 +0300)]
Fixed njs_value_index().
Previous, there were several issues with njs_values_hash_test().
1) The function assumed string types of left and right values are identical.
(If current value is a long string it assumed the second value is also
a long string). Long vs short strings collision.
2) The function assumed if hashes are identical value length are equal.
Long vs long string collision.
The fix is to always check value sizes.
In addition, for short strings njs_value_index() calculated hash value including
padding bytes (which values are undefined). It could result in identical
short strings (but with different padding bytes) treated as different strings.
Alexander Borisov [Mon, 16 Sep 2019 14:21:36 +0000 (17:21 +0300)]
Fixed String.prototype.replace() when first argument is not a string.
This closes #208 issue on GitHub.