[njs] Fixed Array.prototype.fill() for typed-arrays.

Dmitry Volyntsev xeioex at nginx.com
Sat May 7 01:56:28 UTC 2022


details:   https://hg.nginx.org/njs/rev/5c7e02885c26
branches:  
changeset: 1852:5c7e02885c26
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri May 06 18:55:35 2022 -0700
description:
Fixed Array.prototype.fill() for typed-arrays.

This closes #478 issue on Github.

diffstat:

 src/njs_typed_array.c    |  2 --
 src/test/njs_unit_test.c |  3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 3f6f3ba16741 -r 5c7e02885c26 src/njs_typed_array.c
--- a/src/njs_typed_array.c	Fri May 06 18:55:07 2022 -0700
+++ b/src/njs_typed_array.c	Fri May 06 18:55:35 2022 -0700
@@ -702,8 +702,6 @@ njs_typed_array_set_value(njs_vm_t *vm, 
 
     njs_typed_array_prop_set(vm, array, index, num);
 
-    njs_set_number(setval, num);
-
     return NJS_OK;
 }
 
diff -r 3f6f3ba16741 -r 5c7e02885c26 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Fri May 06 18:55:07 2022 -0700
+++ b/src/test/njs_unit_test.c	Fri May 06 18:55:35 2022 -0700
@@ -5409,6 +5409,9 @@ static njs_unit_test_t  njs_test[] =
                  "Array.prototype.fill.call(o, 2).a"),
       njs_str("4") },
 
+    { njs_str("Array.prototype.fill.call(new Int32Array(1))"),
+      njs_str("0") },
+
     { njs_str("ArrayBuffer()"),
       njs_str("TypeError: Constructor ArrayBuffer requires 'new'") },
 



More information about the nginx-devel mailing list