[njs] Fixed the writeable flag of Array.length property.

Dmitry Volyntsev xeioex at nginx.com
Thu Apr 26 17:36:53 UTC 2018


details:   http://hg.nginx.org/njs/rev/1305b1701099
branches:  
changeset: 509:1305b1701099
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Apr 26 19:58:26 2018 +0300
description:
Fixed the writeable flag of Array.length property.

This fixes #6 issue on GitHub.

diffstat:

 njs/njs_array.c          |  1 +
 njs/test/njs_unit_test.c |  3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r cba7742a0a65 -r 1305b1701099 njs/njs_array.c
--- a/njs/njs_array.c	Thu Apr 26 19:53:16 2018 +0300
+++ b/njs/njs_array.c	Thu Apr 26 19:58:26 2018 +0300
@@ -2097,6 +2097,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("length"),
         .value = njs_prop_handler(njs_array_prototype_length),
+        .writable = 1
     },
 
     {
diff -r cba7742a0a65 -r 1305b1701099 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Thu Apr 26 19:53:16 2018 +0300
+++ b/njs/test/njs_unit_test.c	Thu Apr 26 19:58:26 2018 +0300
@@ -6599,6 +6599,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("Object.getOwnPropertyDescriptor([], 'length').value"),
       nxt_string("0") },
 
+    { nxt_string("JSON.stringify(Object.getOwnPropertyDescriptor([3,4], 'length'))"),
+      nxt_string("{\"value\":2,\"configurable\":false,\"enumerable\":false,\"writable\":true}") },
+
     { nxt_string("Object.getOwnPropertyDescriptor([3,4], '3')"),
       nxt_string("undefined") },
 


More information about the nginx-devel mailing list