[njs] Made configurable "length", "name", and most of built-in methods.

Valentin Bartenev vbart at nginx.com
Tue May 7 13:52:52 UTC 2019


details:   https://hg.nginx.org/njs/rev/a84f514e864d
branches:  
changeset: 953:a84f514e864d
user:      Valentin Bartenev <vbart at nginx.com>
date:      Mon May 06 05:40:03 2019 +0300
description:
Made configurable "length", "name", and most of built-in methods.

diffstat:

 njs/njs_array.c          |  28 ++++++++++++++++++++++++++
 njs/njs_boolean.c        |   6 +++++
 njs/njs_builtin.c        |   1 +
 njs/njs_crypto.c         |  11 ++++++++++
 njs/njs_date.c           |  49 ++++++++++++++++++++++++++++++++++++++++++++++
 njs/njs_error.c          |  31 +++++++++++++++++++++++++++++
 njs/njs_fs.c             |   7 ++++++
 njs/njs_function.c       |  12 +++++++++++
 njs/njs_json.c           |   2 +
 njs/njs_math.c           |  36 +++++++++++++++++++++++++++++++++
 njs/njs_number.c         |  20 ++++++++++++++++++
 njs/njs_object.c         |  27 +++++++++++++++++++++++-
 njs/njs_object.h         |   1 +
 njs/njs_regexp.c         |   9 ++++++++
 njs/njs_string.c         |  45 ++++++++++++++++++++++++++++++++++++++++++
 njs/njs_vm.c             |  51 +++++++++++++++++++++++++++++++++--------------
 njs/test/njs_unit_test.c |  50 +++++++++++++++++++++++++++++++++++++++++++---
 17 files changed, 365 insertions(+), 21 deletions(-)

diffs (truncated from 2439 to 1000 lines):

diff -r 96c78f35a809 -r a84f514e864d njs/njs_array.c
--- a/njs/njs_array.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_array.c	Mon May 06 05:40:03 2019 +0300
@@ -370,6 +370,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Array"),
+        .configurable = 1,
     },
 
     /* Array.length == 1. */
@@ -377,6 +378,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Array.prototype. */
@@ -391,6 +393,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_METHOD,
         .name = njs_string("isArray"),
         .value = njs_native_function(njs_array_is_array, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -399,6 +402,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_METHOD,
         .name = njs_string("of"),
         .value = njs_native_function(njs_array_of, 0, 0),
+        .configurable = 1,
     },
 };
 
@@ -2256,30 +2260,35 @@ static const njs_object_prop_t  njs_arra
         .value = njs_native_function(njs_array_prototype_slice,
                      njs_continuation_size(njs_array_slice_t),
                      NJS_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("push"),
         .value = njs_native_function(njs_array_prototype_push, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("pop"),
         .value = njs_native_function(njs_array_prototype_pop, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("unshift"),
         .value = njs_native_function(njs_array_prototype_unshift, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("shift"),
         .value = njs_native_function(njs_array_prototype_shift, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -2287,6 +2296,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("splice"),
         .value = njs_native_function(njs_array_prototype_splice, 0,
                     NJS_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2294,6 +2304,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("reverse"),
         .value = njs_native_function(njs_array_prototype_reverse, 0,
                     NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2301,6 +2312,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("toString"),
         .value = njs_native_function(njs_array_prototype_to_string,
                      NJS_CONTINUATION_SIZE, 0),
+        .configurable = 1,
     },
 
     {
@@ -2309,12 +2321,14 @@ static const njs_object_prop_t  njs_arra
         .value = njs_native_function(njs_array_prototype_join,
                      njs_continuation_size(njs_array_join_t),
                      NJS_OBJECT_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("concat"),
         .value = njs_native_function(njs_array_prototype_concat, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -2322,6 +2336,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("indexOf"),
         .value = njs_native_function(njs_array_prototype_index_of, 0,
                      NJS_OBJECT_ARG, NJS_SKIP_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2329,6 +2344,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("lastIndexOf"),
         .value = njs_native_function(njs_array_prototype_last_index_of, 0,
                      NJS_OBJECT_ARG, NJS_SKIP_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* ES7. */
@@ -2337,6 +2353,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("includes"),
         .value = njs_native_function(njs_array_prototype_includes, 0,
                      NJS_OBJECT_ARG, NJS_SKIP_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2344,6 +2361,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("forEach"),
         .value = njs_native_function(njs_array_prototype_for_each,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2351,6 +2369,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("some"),
         .value = njs_native_function(njs_array_prototype_some,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2358,6 +2377,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("every"),
         .value = njs_native_function(njs_array_prototype_every,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -2367,6 +2387,7 @@ static const njs_object_prop_t  njs_arra
         .value = njs_native_function(njs_array_prototype_fill, 0,
                      NJS_OBJECT_ARG, NJS_SKIP_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2374,6 +2395,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("filter"),
         .value = njs_native_function(njs_array_prototype_filter,
                      njs_continuation_size(njs_array_filter_t), 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -2382,6 +2404,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("find"),
         .value = njs_native_function(njs_array_prototype_find,
                      njs_continuation_size(njs_array_find_t), 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -2390,6 +2413,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("findIndex"),
         .value = njs_native_function(njs_array_prototype_find_index,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2397,6 +2421,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("map"),
         .value = njs_native_function(njs_array_prototype_map,
                      njs_continuation_size(njs_array_map_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2404,6 +2429,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("reduce"),
         .value = njs_native_function(njs_array_prototype_reduce,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2411,6 +2437,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("reduceRight"),
         .value = njs_native_function(njs_array_prototype_reduce_right,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -2418,6 +2445,7 @@ static const njs_object_prop_t  njs_arra
         .name = njs_string("sort"),
         .value = njs_native_function(njs_array_prototype_sort,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 };
 
diff -r 96c78f35a809 -r a84f514e864d njs/njs_boolean.c
--- a/njs/njs_boolean.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_boolean.c	Mon May 06 05:40:03 2019 +0300
@@ -46,6 +46,7 @@ static const njs_object_prop_t  njs_bool
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Boolean"),
+        .configurable = 1,
     },
 
     /* Boolean.length == 1. */
@@ -53,6 +54,7 @@ static const njs_object_prop_t  njs_bool
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Boolean.prototype. */
@@ -129,24 +131,28 @@ static const njs_object_prop_t  njs_bool
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("__proto__"),
         .value = njs_prop_handler(njs_primitive_prototype_get_proto),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("valueOf"),
         .value = njs_native_function(njs_boolean_prototype_value_of, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_boolean_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 };
 
diff -r 96c78f35a809 -r a84f514e864d njs/njs_builtin.c
--- a/njs/njs_builtin.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_builtin.c	Mon May 06 05:40:03 2019 +0300
@@ -1087,6 +1087,7 @@ static const njs_object_prop_t  njs_njs_
         .name = njs_string("dump"),
         .value = njs_native_function(njs_dump_value, 0,
                                     NJS_SKIP_ARG, NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 };
 
diff -r 96c78f35a809 -r a84f514e864d njs/njs_crypto.c
--- a/njs/njs_crypto.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_crypto.c	Mon May 06 05:40:03 2019 +0300
@@ -331,12 +331,14 @@ static const njs_object_prop_t  njs_hash
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Hash"),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_hash_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -344,6 +346,7 @@ static const njs_object_prop_t  njs_hash
         .name = njs_string("update"),
         .value = njs_native_function(njs_hash_prototype_update, 0,
                                      NJS_OBJECT_ARG, NJS_SKIP_ARG),
+        .configurable = 1,
     },
 
     {
@@ -351,6 +354,7 @@ static const njs_object_prop_t  njs_hash
         .name = njs_string("digest"),
         .value = njs_native_function(njs_hash_prototype_digest, 0,
                                      NJS_OBJECT_ARG, NJS_SKIP_ARG),
+        .configurable = 1,
     },
 };
 
@@ -595,12 +599,14 @@ static const njs_object_prop_t  njs_hmac
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Hmac"),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_hmac_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -608,6 +614,7 @@ static const njs_object_prop_t  njs_hmac
         .name = njs_string("update"),
         .value = njs_native_function(njs_hmac_prototype_update, 0,
                                      NJS_OBJECT_ARG, NJS_SKIP_ARG),
+        .configurable = 1,
     },
 
     {
@@ -615,6 +622,7 @@ static const njs_object_prop_t  njs_hmac
         .name = njs_string("digest"),
         .value = njs_native_function(njs_hmac_prototype_digest, 0,
                                      NJS_OBJECT_ARG, NJS_SKIP_ARG),
+        .configurable = 1,
     },
 };
 
@@ -647,6 +655,7 @@ static const njs_object_prop_t  njs_cryp
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("crypto"),
+        .configurable = 1,
     },
 
     {
@@ -660,6 +669,7 @@ static const njs_object_prop_t  njs_cryp
         .name = njs_string("createHash"),
         .value = njs_native_function(njs_crypto_create_hash, 0,
                                      NJS_SKIP_ARG),
+        .configurable = 1,
     },
 
     {
@@ -667,6 +677,7 @@ static const njs_object_prop_t  njs_cryp
         .name = njs_string("createHmac"),
         .value = njs_native_function(njs_crypto_create_hmac, 0,
                                      NJS_SKIP_ARG),
+        .configurable = 1,
     },
 
 };
diff -r 96c78f35a809 -r a84f514e864d njs/njs_date.c
--- a/njs/njs_date.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_date.c	Mon May 06 05:40:03 2019 +0300
@@ -896,6 +896,7 @@ static const njs_object_prop_t  njs_date
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Date"),
+        .configurable = 1,
     },
 
     /* Date.length == 7. */
@@ -903,6 +904,7 @@ static const njs_object_prop_t  njs_date
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 7.0),
+        .configurable = 1,
     },
 
     /* Date.prototype. */
@@ -916,12 +918,14 @@ static const njs_object_prop_t  njs_date
         .type = NJS_METHOD,
         .name = njs_string("UTC"),
         .value = njs_native_function(njs_date_utc, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("now"),
         .value = njs_native_function(njs_date_now, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -929,6 +933,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("parse"),
         .value = njs_native_function(njs_date_parse, 0,
                      NJS_SKIP_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 };
 
@@ -1939,6 +1944,7 @@ static const njs_object_prop_t  njs_date
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("__proto__"),
         .value = njs_prop_handler(njs_primitive_prototype_get_proto),
+        .configurable = 1,
     },
 
     {
@@ -1952,6 +1958,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("valueOf"),
         .value = njs_native_function(njs_date_prototype_value_of, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1959,6 +1966,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toString"),
         .value = njs_native_function(njs_date_prototype_to_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1966,6 +1974,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toDateString"),
         .value = njs_native_function(njs_date_prototype_to_date_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1973,6 +1982,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toTimeString"),
         .value = njs_native_function(njs_date_prototype_to_time_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1980,6 +1990,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toLocaleString"),
         .value = njs_native_function(njs_date_prototype_to_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1987,6 +1998,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("toLocaleDateString"),
         .value = njs_native_function(njs_date_prototype_to_date_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1994,6 +2006,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("toLocaleTimeString"),
         .value = njs_native_function(njs_date_prototype_to_time_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2001,6 +2014,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toUTCString"),
         .value = njs_native_function(njs_date_prototype_to_utc_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2008,6 +2022,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toISOString"),
         .value = njs_native_function(njs_date_prototype_to_iso_string, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2015,6 +2030,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getTime"),
         .value = njs_native_function(njs_date_prototype_value_of, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2022,6 +2038,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getFullYear"),
         .value = njs_native_function(njs_date_prototype_get_full_year, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2029,6 +2046,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCFullYear"),
         .value = njs_native_function(njs_date_prototype_get_utc_full_year, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2036,6 +2054,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getMonth"),
         .value = njs_native_function(njs_date_prototype_get_month, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2043,6 +2062,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCMonth"),
         .value = njs_native_function(njs_date_prototype_get_utc_month, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2050,6 +2070,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getDate"),
         .value = njs_native_function(njs_date_prototype_get_date, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2057,6 +2078,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCDate"),
         .value = njs_native_function(njs_date_prototype_get_utc_date, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2064,6 +2086,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getDay"),
         .value = njs_native_function(njs_date_prototype_get_day, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2071,6 +2094,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCDay"),
         .value = njs_native_function(njs_date_prototype_get_utc_day, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2078,6 +2102,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getHours"),
         .value = njs_native_function(njs_date_prototype_get_hours, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2085,6 +2110,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCHours"),
         .value = njs_native_function(njs_date_prototype_get_utc_hours, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2092,6 +2118,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getMinutes"),
         .value = njs_native_function(njs_date_prototype_get_minutes, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2099,6 +2126,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCMinutes"),
         .value = njs_native_function(njs_date_prototype_get_utc_minutes, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2106,6 +2134,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getSeconds"),
         .value = njs_native_function(njs_date_prototype_get_seconds, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2113,6 +2142,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("getUTCSeconds"),
         .value = njs_native_function(njs_date_prototype_get_seconds, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2120,6 +2150,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("getMilliseconds"),
         .value = njs_native_function(njs_date_prototype_get_milliseconds, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2127,6 +2158,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("getUTCMilliseconds"),
         .value = njs_native_function(njs_date_prototype_get_milliseconds, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2134,6 +2166,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("getTimezoneOffset"),
         .value = njs_native_function(njs_date_prototype_get_timezone_offset, 0,
                      NJS_DATE_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2141,6 +2174,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setTime"),
         .value = njs_native_function(njs_date_prototype_set_time, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2148,6 +2182,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("setMilliseconds"),
         .value = njs_native_function(njs_date_prototype_set_milliseconds, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2155,6 +2190,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_long_string("setUTCMilliseconds"),
         .value = njs_native_function(njs_date_prototype_set_milliseconds, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2162,6 +2198,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setSeconds"),
         .value = njs_native_function(njs_date_prototype_set_seconds, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2169,6 +2206,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setUTCSeconds"),
         .value = njs_native_function(njs_date_prototype_set_seconds, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2177,6 +2215,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_minutes, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2185,6 +2224,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_utc_minutes, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2193,6 +2233,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_hours, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2201,6 +2242,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_utc_hours, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2208,6 +2250,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setDate"),
         .value = njs_native_function(njs_date_prototype_set_date, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2215,6 +2258,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setUTCDate"),
         .value = njs_native_function(njs_date_prototype_set_utc_date, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2222,6 +2266,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setMonth"),
         .value = njs_native_function(njs_date_prototype_set_month, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2229,6 +2274,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("setUTCMonth"),
         .value = njs_native_function(njs_date_prototype_set_utc_month, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2237,6 +2283,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_full_year, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2245,6 +2292,7 @@ static const njs_object_prop_t  njs_date
         .value = njs_native_function(njs_date_prototype_set_utc_full_year, 0,
                      NJS_DATE_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG,
                      NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -2252,6 +2300,7 @@ static const njs_object_prop_t  njs_date
         .name = njs_string("toJSON"),
         .value = njs_native_function(njs_date_prototype_to_json,
                      NJS_CONTINUATION_SIZE, 0),
+        .configurable = 1,
     },
 };
 
diff -r 96c78f35a809 -r a84f514e864d njs/njs_error.c
--- a/njs/njs_error.c	Mon May 06 21:24:31 2019 +0300
+++ b/njs/njs_error.c	Mon May 06 05:40:03 2019 +0300
@@ -171,6 +171,7 @@ static const njs_object_prop_t  njs_erro
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Error"),
+        .configurable = 1,
     },
 
     /* Error.length == 1. */
@@ -178,6 +179,7 @@ static const njs_object_prop_t  njs_erro
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Error.prototype. */
@@ -211,6 +213,7 @@ static const njs_object_prop_t  njs_eval
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("EvalError"),
+        .configurable = 1,
     },
 
     /* EvalError.length == 1. */
@@ -218,6 +221,7 @@ static const njs_object_prop_t  njs_eval
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* EvalError.prototype. */
@@ -251,6 +255,7 @@ static const njs_object_prop_t  njs_inte
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("InternalError"),
+        .configurable = 1,
     },
 
     /* InternalError.length == 1. */
@@ -258,6 +263,7 @@ static const njs_object_prop_t  njs_inte
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* InternalError.prototype. */
@@ -291,6 +297,7 @@ static const njs_object_prop_t  njs_rang
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("RangeError"),
+        .configurable = 1,
     },
 
     /* RangeError.length == 1. */
@@ -298,6 +305,7 @@ static const njs_object_prop_t  njs_rang
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* RangeError.prototype. */
@@ -331,6 +339,7 @@ static const njs_object_prop_t  njs_refe
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("ReferenceError"),
+        .configurable = 1,
     },
 
     /* ReferenceError.length == 1. */
@@ -338,6 +347,7 @@ static const njs_object_prop_t  njs_refe
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* ReferenceError.prototype. */
@@ -371,6 +381,7 @@ static const njs_object_prop_t  njs_synt
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("SyntaxError"),
+        .configurable = 1,
     },
 
     /* SyntaxError.length == 1. */
@@ -378,6 +389,7 @@ static const njs_object_prop_t  njs_synt
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* SyntaxError.prototype. */
@@ -411,6 +423,7 @@ static const njs_object_prop_t  njs_type
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("TypeError"),
+        .configurable = 1,
     },
 
     /* TypeError.length == 1. */
@@ -418,6 +431,7 @@ static const njs_object_prop_t  njs_type
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* TypeError.prototype. */
@@ -451,6 +465,7 @@ static const njs_object_prop_t  njs_uri_
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("URIError"),
+        .configurable = 1,
     },
 
     /* URIError.length == 1. */
@@ -458,6 +473,7 @@ static const njs_object_prop_t  njs_uri_
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* URIError.prototype. */
@@ -553,6 +569,7 @@ static const njs_object_prop_t  njs_memo
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("MemoryError"),
+        .configurable = 1,
     },
 
     /* MemoryError.length == 1. */
@@ -560,6 +577,7 @@ static const njs_object_prop_t  njs_memo
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* MemoryError.prototype. */
@@ -677,30 +695,35 @@ static const njs_object_prop_t  njs_erro
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Error"),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY,
         .name = njs_string("message"),
         .value = njs_string(""),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("valueOf"),
         .value = njs_native_function(njs_error_prototype_value_of, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_error_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 };
 
@@ -718,6 +741,7 @@ static const njs_object_prop_t  njs_eval
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("EvalError"),
+        .configurable = 1,
     },
 
     {
@@ -761,6 +785,7 @@ static const njs_object_prop_t  njs_inte
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("InternalError"),
+        .configurable = 1,
     },
 
     {
@@ -768,6 +793,7 @@ static const njs_object_prop_t  njs_inte
         .name = njs_string("toString"),
         .value = njs_native_function(njs_internal_error_prototype_to_string,
                                      0, 0),
+        .configurable = 1,
     },
 };
 
@@ -785,6 +811,7 @@ static const njs_object_prop_t  njs_rang
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("RangeError"),
+        .configurable = 1,
     },
 
     {
@@ -808,6 +835,7 @@ static const njs_object_prop_t  njs_refe
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("ReferenceError"),
+        .configurable = 1,
     },
 
     {
@@ -831,6 +859,7 @@ static const njs_object_prop_t  njs_synt
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("SyntaxError"),
+        .configurable = 1,
     },
 
     {
@@ -854,6 +883,7 @@ static const njs_object_prop_t  njs_type
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("TypeError"),
+        .configurable = 1,


More information about the nginx-devel mailing list