]> git.kaiwu.me - njs.git/commitdiff
Fixed the writeable flag of Array.length property.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 26 Apr 2018 16:58:26 +0000 (19:58 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 26 Apr 2018 16:58:26 +0000 (19:58 +0300)
This fixes #6 issue on GitHub.

njs/njs_array.c
njs/test/njs_unit_test.c

index 4d33107351070e8501f7126d1eb150ae877c99e3..4532e8ba9f07bd43eb2f7f9875d8f2355d3006fb 100644 (file)
@@ -2097,6 +2097,7 @@ static const njs_object_prop_t  njs_array_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("length"),
         .value = njs_prop_handler(njs_array_prototype_length),
+        .writable = 1
     },
 
     {
index c3ea832e3713d4c33e725f3440731b196121bb26..2ffa51a93cac4f83e355759c82245179a25134af 100644 (file)
@@ -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") },