details:   https://hg.nginx.org/njs/rev/67b45ebbb6e4
branches:  
changeset: 1613:67b45ebbb6e4
user:      Artem S. Povalyukhin <[email protected]>
date:      Thu Feb 25 10:06:18 2021 +0300
description:
Fixed for-in iteration of typed array values.

diffstat:

 src/njs_object.c         |  6 ++++++
 src/test/njs_unit_test.c |  3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r 804afbc89677 -r 67b45ebbb6e4 src/njs_object.c
--- a/src/njs_object.c  Wed Feb 24 16:57:05 2021 +0000
+++ b/src/njs_object.c  Thu Feb 25 10:06:18 2021 +0300
@@ -444,6 +444,12 @@ njs_object_enumerate_value(njs_vm_t *vm,
                                              kind);
             break;
 
+        case NJS_TYPED_ARRAY:
+            ret = njs_object_enumerate_typed_array(vm,
+                                                  (njs_typed_array_t *) object,
+                                                  items, kind);
+            break;
+
         case NJS_OBJECT_STRING:
             obj_val = (njs_object_value_t *) object;
 
diff -r 804afbc89677 -r 67b45ebbb6e4 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c  Wed Feb 24 16:57:05 2021 +0000
+++ b/src/test/njs_unit_test.c  Thu Feb 25 10:06:18 2021 +0300
@@ -2834,6 +2834,9 @@ static njs_unit_test_t  njs_test[] =
                  "for (var a in o) {arr.push(a)}; arr"),
       njs_str("b") },
 
+    { njs_str("var a = []; for (var k in new Uint8Array([1,2,3])) { a.push(k); 
}; a"),
+      njs_str("0,1,2") },
+
     /* switch. */
 
     { njs_str("switch"),
_______________________________________________
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to