From: Artem S. Povalyukhin Date: Thu, 25 Feb 2021 07:06:18 +0000 (+0300) Subject: Fixed for-in iteration of typed array values. X-Git-Tag: 0.5.2~6 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=8b945d338c7fe52e09e4023415c9eb4b36f04221;p=njs.git Fixed for-in iteration of typed array values. --- diff --git a/src/njs_object.c b/src/njs_object.c index b9fadddc..c7a65994 100644 --- a/src/njs_object.c +++ b/src/njs_object.c @@ -444,6 +444,12 @@ njs_object_enumerate_value(njs_vm_t *vm, const njs_object_t *object, 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 --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 722f7073..ccc1de19 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -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"),