[njs] Fixed Object.getOwnPropertySymbols().

Alexander Borisov alexander.borisov at nginx.com
Thu Feb 13 13:27:36 UTC 2020


details:   https://hg.nginx.org/njs/rev/974e6c195410
branches:  
changeset: 1325:974e6c195410
user:      Alexander Borisov <alexander.borisov at nginx.com>
date:      Thu Feb 13 16:25:37 2020 +0300
description:
Fixed Object.getOwnPropertySymbols().

This closes #291 issue on GitHub.

diffstat:

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

diffs (34 lines):

diff -r 5bd15bd3766c -r 974e6c195410 src/njs_object.c
--- a/src/njs_object.c	Mon Feb 10 17:39:41 2020 +0300
+++ b/src/njs_object.c	Thu Feb 13 16:25:37 2020 +0300
@@ -397,8 +397,6 @@ njs_object_exist_in_proto(const njs_obje
     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(c
     njs_lvlhsh_each_init(&lhe, &njs_object_hash_proto);
     hash = &object->hash;
 
+    lhq.proto = &njs_object_hash_proto;
+
     length = 0;
 
     for ( ;; ) {
diff -r 5bd15bd3766c -r 974e6c195410 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Mon Feb 10 17:39:41 2020 +0300
+++ b/src/test/njs_unit_test.c	Thu Feb 13 16:25:37 2020 +0300
@@ -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,"


More information about the nginx-devel mailing list