]> git.kaiwu.me - njs.git/commitdiff
Fixed Object.getOwnPropertySymbols().
authorAlexander Borisov <alexander.borisov@nginx.com>
Thu, 13 Feb 2020 13:25:37 +0000 (16:25 +0300)
committerAlexander Borisov <alexander.borisov@nginx.com>
Thu, 13 Feb 2020 13:25:37 +0000 (16:25 +0300)
This closes #291 issue on GitHub.

src/njs_object.c
src/test/njs_unit_test.c

index 365ce1b323eeb432742570d205d9c742619952d9..99f8740828fda86779baca3f85109cd70301f7aa 100644 (file)
@@ -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 ( ;; ) {
index c39a55ec211f43d4d752a56e9a1a214d89e9ba22..e3ab57ff0bf800eb0b686f3a86f3d106d112c03a 100644 (file)
@@ -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,"