From: Alexander Borisov Date: Thu, 13 Feb 2020 13:25:37 +0000 (+0300) Subject: Fixed Object.getOwnPropertySymbols(). X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=0bf9a3738814de1b0d63b5d909326e1067177f02;p=njs.git Fixed Object.getOwnPropertySymbols(). This closes #291 issue on GitHub. --- diff --git a/src/njs_object.c b/src/njs_object.c index 365ce1b3..99f87408 100644 --- a/src/njs_object.c +++ b/src/njs_object.c @@ -397,8 +397,6 @@ njs_object_exist_in_proto(const njs_object_t *object, const njs_object_t *end, njs_int_t ret; njs_object_prop_t *prop; - lhq->proto = &njs_object_hash_proto; - while (object != end) { ret = njs_lvlhsh_find(&object->hash, lhq); @@ -701,6 +699,8 @@ njs_object_own_enumerate_object_length(const njs_object_t *object, njs_lvlhsh_each_init(&lhe, &njs_object_hash_proto); hash = &object->hash; + lhq.proto = &njs_object_hash_proto; + length = 0; for ( ;; ) { diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index c39a55ec..e3ab57ff 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -11206,6 +11206,9 @@ static njs_unit_test_t njs_test[] = "delete obj[symA]"), njs_str("TypeError: Cannot delete property \"Symbol(A)\" of object") }, + { njs_str("typeof Object.getOwnPropertySymbols(globalThis);"), + njs_str("object") }, + { njs_str("[" " Object.prototype," " Symbol.prototype,"