]> git.kaiwu.me - njs.git/log
njs.git
8 years agoFixed copying of a garbage value.
Dmitry Volyntsev [Fri, 23 Mar 2018 10:53:27 +0000 (13:53 +0300)]
Fixed copying of a garbage value.

Found by Clang Static Analyzer.

Additionally, unnecessary body_arg.length zeroing is removed.

8 years agoFixed njs_vm_t struct alignment on 32bits platforms.
Dmitry Volyntsev [Thu, 22 Mar 2018 12:05:08 +0000 (15:05 +0300)]
Fixed njs_vm_t struct alignment on 32bits platforms.

8 years agoFixed function frame alignment on 32bits platforms.
Dmitry Volyntsev [Thu, 22 Mar 2018 12:05:06 +0000 (15:05 +0300)]
Fixed function frame alignment on 32bits platforms.

8 years agohttp subrequest() method.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:13 +0000 (17:33 +0300)]
http subrequest() method.

Creates an nginx's subrequest with the specified arguments and
registers a finalization callback.

req.subrequest(<uri>[, <options>[, <callback>]]):
    uri - string.
    options - string | object.
        string value - uri arguments.
        object value can contain:
            args, body, method all are string values.
    callback - function with the following argument:
        reply - the result object with the following properties:
            uri, method, status, contentType, contentLength,
            headers, args, body, parent.

8 years agohttp req.response() method.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:12 +0000 (17:33 +0300)]
http req.response() method.

8 years agosetTimeout() and clearTimeout() methods.
Dmitry Volyntsev [Wed, 21 Mar 2018 14:33:12 +0000 (17:33 +0300)]
setTimeout() and clearTimeout() methods.

Public methods are introduced to create and post async events for
a VM instance.  njs_vm_add_event() creates an async event for the VM
to wait for.  njs_vm_post_event() notifies the VM that the event
occurred.  If async events were added njs_vm_run() returns NJS_AGAIN
until there are no remaining pending events.

8 years agoImproved the exception handling in njs_vmcode_method_frame().
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:25 +0000 (15:15 +0300)]
Improved the exception handling in njs_vmcode_method_frame().

8 years agoMaking njs_exception_error_create() thread-safe.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:24 +0000 (15:15 +0300)]
Making njs_exception_error_create() thread-safe.

8 years agoFixed a dead store.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:24 +0000 (15:15 +0300)]
Fixed a dead store.

Found by Clang Static Analyzer.

8 years agoFixed RegExp trace handlers.
Dmitry Volyntsev [Thu, 15 Mar 2018 12:15:23 +0000 (15:15 +0300)]
Fixed RegExp trace handlers.

Found by Clang Static Analyzer.

8 years agoCode simplification.
Igor Sysoev [Wed, 14 Mar 2018 11:32:24 +0000 (14:32 +0300)]
Code simplification.

A dead assignment left after the changeset 6738ff52a2cb was found
by Clang Static Analyzer.

8 years agoFixed 1 byte heap buffer overflow.
Dmitry Volyntsev [Tue, 13 Mar 2018 17:37:01 +0000 (20:37 +0300)]
Fixed 1 byte heap buffer overflow.

8 years agoRemoved unused null proto hash.
Igor Sysoev [Tue, 13 Mar 2018 16:51:25 +0000 (19:51 +0300)]
Removed unused null proto hash.

8 years agoHandling the NJS_NATIVE_GETTER properties in a single place.
Dmitry Volyntsev [Tue, 13 Mar 2018 15:55:24 +0000 (18:55 +0300)]
Handling the NJS_NATIVE_GETTER properties in a single place.

8 years agoSkip empty buffers in HTTP response send().
Roman Arutyunyan [Wed, 28 Feb 2018 16:16:25 +0000 (19:16 +0300)]
Skip empty buffers in HTTP response send().

Such buffers lead to send errors and should never be sent.

8 years agoFixed String.prototype.toUTF8() function.
Igor Sysoev [Wed, 28 Feb 2018 13:20:11 +0000 (16:20 +0300)]
Fixed String.prototype.toUTF8() function.

A byte string returned by String.prototype.toUTF8() had length equal
to its size so the string can be processed later as an ASCII string.

8 years agoFixed the unit test's output format for a failed test.
Dmitry Volyntsev [Tue, 27 Feb 2018 11:11:00 +0000 (14:11 +0300)]
Fixed the unit test's output format for a failed test.

8 years agoFixed memory leak in CLI.
Dmitry Volyntsev [Tue, 27 Feb 2018 11:10:36 +0000 (14:10 +0300)]
Fixed memory leak in CLI.

8 years agoFixed the names of global functions in backtraces.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:55 +0000 (19:12 +0300)]
Fixed the names of global functions in backtraces.

Previously, they were reported as 'native (native)'.

8 years agoHiding the unit tests' output under the verbose mode.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:53 +0000 (19:12 +0300)]
Hiding the unit tests' output under the verbose mode.

8 years agoExternals refactored.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:53 +0000 (19:12 +0300)]
Externals refactored.

Public API is rectified to allow the creation of external objects in
runtime.
    1) njs_vm_external_add() is replaced with njs_vm_external_prototype().
    The later functions returns a pointer to a prototype object which can
    be used to create a value with such a prototype in runtime.

    2) njs_vm_external() is split into njs_vm_external_create() and
    njs_vm_external_bind(). The former creates a variable with a specified
    prototype and associates it with an external pointer. The latter binds
    a variable to a name in the global namespace.

8 years agoMoving long_string fields of njs_value_t into a separate struct.
Dmitry Volyntsev [Tue, 20 Feb 2018 16:12:52 +0000 (19:12 +0300)]
Moving long_string fields of njs_value_t into a separate struct.

8 years agoFixed PATH shell variable for expect tests.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:53 +0000 (15:15 +0300)]
Fixed PATH shell variable for expect tests.

To avoid interference with the already installed njs binary.

8 years agoFixed console.help() method return value.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:53 +0000 (15:15 +0300)]
Fixed console.help() method return value.

8 years agoFixed njs_string_create() prototype to reflect underlying types.
Dmitry Volyntsev [Mon, 12 Feb 2018 12:15:52 +0000 (15:15 +0300)]
Fixed njs_string_create() prototype to reflect underlying types.

8 years agoFixed using of internal NJS headers in nginx modules.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:57:24 +0000 (14:57 +0300)]
Fixed using of internal NJS headers in nginx modules.

Public API is rectified to make it easier to work with the private
structure njs_value_t from the outside:
    1) njs_vm_retval() is split into njs_vm_retval() which now returns
    the njs_value_t * as a return value and njs_vm_value_to_ext_string()
    which stringifies an njs_value_t * passed as an argument.

    2) njs_value_*_set() methods are added.
    3) Similar public methods are grouped together.

8 years agoAdding textual description for type converting exceptions.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:54:24 +0000 (14:54 +0300)]
Adding textual description for type converting exceptions.

8 years agoFixed building by SunC.
Dmitry Volyntsev [Mon, 12 Feb 2018 11:54:23 +0000 (14:54 +0300)]
Fixed building by SunC.

8 years agoFixed expect tests for systems where echo -e is not available.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:34:44 +0000 (20:34 +0300)]
Fixed expect tests for systems where echo -e is not available.

8 years agoFixed Object's methods for the undefined value.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:12:41 +0000 (20:12 +0300)]
Fixed Object's methods for the undefined value.

8 years agoFixed the calculation of the scope indices for variables.
Dmitry Volyntsev [Fri, 9 Feb 2018 17:11:17 +0000 (20:11 +0300)]
Fixed the calculation of the scope indices for variables.

8 years agoInteractive shell: fixed non-ascii character support.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:19 +0000 (19:16 +0300)]
Interactive shell: fixed non-ascii character support.

8 years agoReporting njs version by CLI.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:18 +0000 (19:16 +0300)]
Reporting njs version by CLI.

8 years agoUsing hg archive to make dist.
Dmitry Volyntsev [Fri, 9 Feb 2018 16:16:18 +0000 (19:16 +0300)]
Using hg archive to make dist.

8 years agoFixed unit tests for NetBSD 7.
Dmitry Volyntsev [Wed, 22 Nov 2017 17:38:10 +0000 (20:38 +0300)]
Fixed unit tests for NetBSD 7.

8 years agoFixed building by GCC with -O3.
Dmitry Volyntsev [Wed, 22 Nov 2017 15:55:57 +0000 (18:55 +0300)]
Fixed building by GCC with -O3.

8 years agoAdded tag 0.1.15 for changeset 215ca47b9167
Dmitry Volyntsev [Mon, 20 Nov 2017 17:08:56 +0000 (20:08 +0300)]
Added tag 0.1.15 for changeset 215ca47b9167

8 years agoVersion 0.1.15. 0.1.15
Dmitry Volyntsev [Mon, 20 Nov 2017 17:07:15 +0000 (20:07 +0300)]
Version 0.1.15.

8 years agoMemoryError reimplemented without its own prototype.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:58 +0000 (19:24 +0300)]
MemoryError reimplemented without its own prototype.

MemoryError is a special preallocated immutable object.  Its value type
is NJS_OBJECT_INTERNAL_ERROR. Initially the object had its own prototype
object.  It introduced inconsistency between value types and prototype
types, because some routines (for example, njs_object_prototype_to_string())
expect them to be pairwise aligned.

8 years agoFixing Coverity warnings related to close().
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:56 +0000 (19:24 +0300)]
Fixing Coverity warnings related to close().

Coverity assumes that open() can normally return 0.

8 years agoFixed a typo in njs interactive test.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:56 +0000 (19:24 +0300)]
Fixed a typo in njs interactive test.

8 years agoFixed expect file tests.
Dmitry Volyntsev [Mon, 20 Nov 2017 16:24:55 +0000 (19:24 +0300)]
Fixed expect file tests.

Using current directory for temporary files because /tmp
is not available for writing in BB environment.

8 years agoNodejs style file methods.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Nodejs style file methods.

8 years agoAdded support of oct literals.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Added support of oct literals.

8 years agoEnabling exception backtraces in nginx modules.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Enabling exception backtraces in nginx modules.

8 years agoFixed inheriting debug metadata while cloning a VM.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed inheriting debug metadata while cloning a VM.

8 years agoFixed exception handling.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed exception handling.

njs_vm_exception() is removed and combined with njs_vm_retval().
vm->exception is removed either, exceptions are now stored in
vm->retval.  It simplifies the client logic, because previously
njs_vm_exception() had to be called if njs_vm_retval() fails.
Additonally, stack traces are now appended to the retval if an exception
happens.

8 years agoChecking that backtrace is available before accessing it.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Checking that backtrace is available before accessing it.

8 years agoError builtin objects.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Error builtin objects.

8 years agoFixed JSON.stringify() for objects inherited from Object prototype.
Dmitry Volyntsev [Fri, 17 Nov 2017 15:55:07 +0000 (18:55 +0300)]
Fixed JSON.stringify() for objects inherited from Object prototype.

8 years agoAdded tag 0.1.14 for changeset d89d06dc638e
Dmitry Volyntsev [Mon, 9 Oct 2017 17:37:02 +0000 (20:37 +0300)]
Added tag 0.1.14 for changeset d89d06dc638e

8 years agoVersion 0.1.14. 0.1.14
Dmitry Volyntsev [Mon, 9 Oct 2017 17:32:21 +0000 (20:32 +0300)]
Version 0.1.14.

8 years agoImproved editline detection on NetBSD.
Dmitry Volyntsev [Thu, 5 Oct 2017 15:23:22 +0000 (18:23 +0300)]
Improved editline detection on NetBSD.

8 years agoMaking build and test targets separate.
Dmitry Volyntsev [Thu, 5 Oct 2017 15:22:56 +0000 (18:22 +0300)]
Making build and test targets separate.

Previously, if libedit was unavailable the default action was to build
libnjs and run tests. However, if it was available the default action
was just building binaries.

This patch makes the two high-level targets which are intended to be
invoked externally.  The default one for building all available binaries
and the test target for running all available tests.

8 years agoFixed various dead store assignments.
Dmitry Volyntsev [Thu, 5 Oct 2017 12:50:36 +0000 (15:50 +0300)]
Fixed various dead store assignments.

8 years agoSkipping expect tests if libedit is not available.
Dmitry Volyntsev [Thu, 5 Oct 2017 12:50:17 +0000 (15:50 +0300)]
Skipping expect tests if libedit is not available.

8 years agoFixed default makefile target is libedit is unavailable.
Dmitry Volyntsev [Thu, 5 Oct 2017 12:50:16 +0000 (15:50 +0300)]
Fixed default makefile target is libedit is unavailable.

Previously, if libedit was unavailable, any extra target which could be
added by feature scripts became the first and default target. It breaks
builds without arguments.

Adding the default target in this case to ensure that the proper target
is always selected.

8 years agoInteractive shell: object level completions.
Dmitry Volyntsev [Wed, 4 Oct 2017 15:58:10 +0000 (18:58 +0300)]
Interactive shell: object level completions.

8 years agoJSON object.
Dmitry Volyntsev [Tue, 3 Oct 2017 18:24:58 +0000 (21:24 +0300)]
JSON object.

8 years agoFixed realloc() failure handling.
Dmitry Volyntsev [Tue, 26 Sep 2017 11:19:49 +0000 (14:19 +0300)]
Fixed realloc() failure handling.

According to POSIX, if realloc() fails to allocate a new chunk of memory
it returns NULL and does not free the original pointer.

Using a separate pointer in order to preserve the original one.

8 years agoChecking the return value of fstat().
Dmitry Volyntsev [Fri, 1 Sep 2017 15:51:20 +0000 (18:51 +0300)]
Checking the return value of fstat().

Just to make sure and to make Coverity Scan happy.

8 years agoFixed fd leakage in njs_process_file().
Dmitry Volyntsev [Fri, 1 Sep 2017 15:51:20 +0000 (18:51 +0300)]
Fixed fd leakage in njs_process_file().

Initially, njs_process_file() was not designed to be invoked multiple
times. Making it reusable by releasing the resources used.

8 years agoFixed passing uninitialized value to printf().
Dmitry Volyntsev [Fri, 1 Sep 2017 15:51:17 +0000 (18:51 +0300)]
Fixed passing uninitialized value to printf().

Previously, njs_ext_console_log() passed an uninitialized value to
printf() function in the case of an error. The precison argument was set
to 0 in such a case, so well-behaved implementation was able to handle
it properly.

Setting this value to NULL, just to make sure and to make Coverity Scan
happy.

8 years agoAdded tag 0.1.13 for changeset d548b78eb881
Igor Sysoev [Thu, 31 Aug 2017 17:50:25 +0000 (20:50 +0300)]
Added tag 0.1.13 for changeset d548b78eb881

8 years agoVersion 0.1.13. 0.1.13
Igor Sysoev [Thu, 31 Aug 2017 17:48:52 +0000 (20:48 +0300)]
Version 0.1.13.

8 years agoInteractive shell: console object.
Dmitry Volyntsev [Thu, 31 Aug 2017 17:27:31 +0000 (20:27 +0300)]
Interactive shell: console object.

8 years agoBacked out changeset 37adbd4c8036, reimplemented properly.
Sergey Kandaurov [Thu, 31 Aug 2017 17:03:13 +0000 (20:03 +0300)]
Backed out changeset 37adbd4c8036, reimplemented properly.

Changeset 37adbd4c8036 breaks build with bmake by introducing Gnu constructs.
Instead, make CLI compilation dependent on libedit by conditionally extending
the default target.

8 years agoCompiling CLI by default if libedit is available.
Dmitry Volyntsev [Thu, 31 Aug 2017 15:38:34 +0000 (18:38 +0300)]
Compiling CLI by default if libedit is available.

8 years agoIntroduced function level backtrace.
Dmitry Volyntsev [Tue, 29 Aug 2017 11:06:23 +0000 (14:06 +0300)]
Introduced function level backtrace.

8 years agoFixed building by GCC 7 with -Wimplicit-fallthrough.
Sergey Kandaurov [Thu, 24 Aug 2017 13:16:37 +0000 (16:16 +0300)]
Fixed building by GCC 7 with -Wimplicit-fallthrough.

8 years agoImproved editline detection on various platforms.
Dmitry Volyntsev [Fri, 18 Aug 2017 15:40:39 +0000 (18:40 +0300)]
Improved editline detection on various platforms.

8 years agoFixed processing files from stdin.
Dmitry Volyntsev [Tue, 15 Aug 2017 18:19:13 +0000 (21:19 +0300)]
Fixed processing files from stdin.

8 years agoAdded tag 0.1.12 for changeset c07b060396be
Igor Sysoev [Tue, 8 Aug 2017 15:06:53 +0000 (18:06 +0300)]
Added tag 0.1.12 for changeset c07b060396be

8 years agoVersion 0.1.12. 0.1.12
Igor Sysoev [Tue, 8 Aug 2017 15:05:14 +0000 (18:05 +0300)]
Version 0.1.12.

8 years agoDisabled njs_object_prop_alloc() inlining.
Igor Sysoev [Tue, 8 Aug 2017 15:05:11 +0000 (18:05 +0300)]
Disabled njs_object_prop_alloc() inlining.

8 years agoStyle fix in Unicode header files and Perl scripts which
Igor Sysoev [Tue, 8 Aug 2017 14:47:56 +0000 (17:47 +0300)]
Style fix in Unicode header files and Perl scripts which
generate the files.

8 years agoRemoved unused field.
Igor Sysoev [Tue, 8 Aug 2017 14:47:55 +0000 (17:47 +0300)]
Removed unused field.

8 years agoStyle fixes.
Igor Sysoev [Tue, 8 Aug 2017 14:47:53 +0000 (17:47 +0300)]
Style fixes.

8 years agoFixed temporary variables handling in accumulative mode.
Dmitry Volyntsev [Tue, 18 Jul 2017 16:25:50 +0000 (19:25 +0300)]
Fixed temporary variables handling in accumulative mode.

8 years agoFixed missing extern qualifier.
Dmitry Volyntsev [Tue, 18 Jul 2017 11:22:16 +0000 (14:22 +0300)]
Fixed missing extern qualifier.

8 years agoInteractive shell.
Dmitry Volyntsev [Mon, 17 Jul 2017 17:38:00 +0000 (20:38 +0300)]
Interactive shell.

8 years agoInitialize njs_vm_opt_t structs to 0 to simplify options adding.
Dmitry Volyntsev [Mon, 17 Jul 2017 12:29:02 +0000 (15:29 +0300)]
Initialize njs_vm_opt_t structs to 0 to simplify options adding.

8 years agoTrailer content after script is optional.
Igor Sysoev [Mon, 17 Jul 2017 11:46:35 +0000 (14:46 +0300)]
Trailer content after script is optional.

8 years agoSplitting unit tests and benchmark.
Dmitry Volyntsev [Fri, 7 Jul 2017 16:17:26 +0000 (19:17 +0300)]
Splitting unit tests and benchmark.

8 years agoMoving VM initialization from njs_vm_clone() to njs_vm_init().
Dmitry Volyntsev [Thu, 6 Jul 2017 16:09:56 +0000 (19:09 +0300)]
Moving VM initialization from njs_vm_clone() to njs_vm_init().

8 years agoPassing all args to njs_vm_create() through njs_vm_opt_t struct.
Dmitry Volyntsev [Thu, 6 Jul 2017 16:07:41 +0000 (19:07 +0300)]
Passing all args to njs_vm_create() through njs_vm_opt_t struct.

8 years agoRemoved unused njs_vm_export_functions().
Dmitry Volyntsev [Wed, 28 Jun 2017 12:31:36 +0000 (15:31 +0300)]
Removed unused njs_vm_export_functions().

8 years agoFixed Object.isSealed() method.
Andrey Zelenkov [Tue, 27 Jun 2017 14:03:16 +0000 (17:03 +0300)]
Fixed Object.isSealed() method.

8 years agoAdded tag 0.1.11 for changeset fc5df33f4e6b
Igor Sysoev [Tue, 27 Jun 2017 11:19:20 +0000 (14:19 +0300)]
Added tag 0.1.11 for changeset fc5df33f4e6b

8 years agoVersion 0.1.11. 0.1.11
Igor Sysoev [Tue, 27 Jun 2017 11:17:12 +0000 (14:17 +0300)]
Version 0.1.11.

8 years agoStyle fixes and small miscellaneous changes.
Igor Sysoev [Tue, 27 Jun 2017 08:17:54 +0000 (11:17 +0300)]
Style fixes and small miscellaneous changes.

8 years agoTime zone name has been removed from unit tests.
Igor Sysoev [Fri, 23 Jun 2017 12:49:09 +0000 (15:49 +0300)]
Time zone name has been removed from unit tests.

8 years agoFixed processing of large array indexes.
Igor Sysoev [Fri, 23 Jun 2017 12:27:28 +0000 (15:27 +0300)]
Fixed processing of large array indexes.

8 years agoFixed typo in js_include handler.
Dmitry Volyntsev [Thu, 22 Jun 2017 15:56:26 +0000 (18:56 +0300)]
Fixed typo in js_include handler.

8 years agoLog error message if VM creation failed.
Dmitry Volyntsev [Thu, 22 Jun 2017 15:52:47 +0000 (18:52 +0300)]
Log error message if VM creation failed.

8 years agoFixed Object.prototype.hasOwnProperty() without arguments.
Dmitry Volyntsev [Tue, 20 Jun 2017 15:06:19 +0000 (18:06 +0300)]
Fixed Object.prototype.hasOwnProperty() without arguments.

8 years agoFixed Object.prototype.isPrototypeOf() without arguments.
Dmitry Volyntsev [Tue, 20 Jun 2017 14:12:44 +0000 (17:12 +0300)]
Fixed Object.prototype.isPrototypeOf() without arguments.

8 years agoObject.isSealed() method.
Dmitry Volyntsev [Mon, 19 Jun 2017 11:46:46 +0000 (14:46 +0300)]
Object.isSealed() method.

8 years agoObject.seal() method.
Dmitry Volyntsev [Mon, 19 Jun 2017 11:46:39 +0000 (14:46 +0300)]
Object.seal() method.

8 years agoObject.isExtensible() method.
Dmitry Volyntsev [Mon, 19 Jun 2017 11:46:34 +0000 (14:46 +0300)]
Object.isExtensible() method.