]> git.kaiwu.me - njs.git/commitdiff
Made configurable "length", "name", and most of built-in methods.
authorValentin Bartenev <vbart@nginx.com>
Mon, 6 May 2019 02:40:03 +0000 (05:40 +0300)
committerValentin Bartenev <vbart@nginx.com>
Mon, 6 May 2019 02:40:03 +0000 (05:40 +0300)
17 files changed:
njs/njs_array.c
njs/njs_boolean.c
njs/njs_builtin.c
njs/njs_crypto.c
njs/njs_date.c
njs/njs_error.c
njs/njs_fs.c
njs/njs_function.c
njs/njs_json.c
njs/njs_math.c
njs/njs_number.c
njs/njs_object.c
njs/njs_object.h
njs/njs_regexp.c
njs/njs_string.c
njs/njs_vm.c
njs/test/njs_unit_test.c

index 244150508a6d555af6563b60914ed2dde6dd2b08..a55d441e8df5fe3450dd8e8dcb9ae79d2c9c2c0f 100644 (file)
@@ -370,6 +370,7 @@ static const njs_object_prop_t  njs_array_constructor_properties[] =
         .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_array_constructor_properties[] =
         .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_array_constructor_properties[] =
         .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_array_constructor_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .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_array_prototype_properties[] =
         .name = njs_string("sort"),
         .value = njs_native_function(njs_array_prototype_sort,
                      njs_continuation_size(njs_array_iter_t), 0),
+        .configurable = 1,
     },
 };
 
index d5eff68d9240dad6ebb7b9dac14bc462b2876367..79a677785e7a2a9dad2e3624e38d2c31f2ec3047 100644 (file)
@@ -46,6 +46,7 @@ static const njs_object_prop_t  njs_boolean_constructor_properties[] =
         .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_boolean_constructor_properties[] =
         .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_boolean_prototype_properties[] =
         .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,
     },
 };
 
index 2f33a53201277b0312c2cab19627e03d9c0fe60a..d40c7378815ec827dca8e838192f67073f7b26f2 100644 (file)
@@ -1087,6 +1087,7 @@ static const njs_object_prop_t  njs_njs_object_properties[] =
         .name = njs_string("dump"),
         .value = njs_native_function(njs_dump_value, 0,
                                     NJS_SKIP_ARG, NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 };
 
index e8a486160e038bcb318dea7028ed8b43f04138a4..ba452e4a2761afa8c8e9a520ac2c66280c09204d 100644 (file)
@@ -331,12 +331,14 @@ static const njs_object_prop_t  njs_hash_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_crypto_object_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("crypto"),
+        .configurable = 1,
     },
 
     {
@@ -660,6 +669,7 @@ static const njs_object_prop_t  njs_crypto_object_properties[] =
         .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_crypto_object_properties[] =
         .name = njs_string("createHmac"),
         .value = njs_native_function(njs_crypto_create_hmac, 0,
                                      NJS_SKIP_ARG),
+        .configurable = 1,
     },
 
 };
index bee26a62a0064f438efc605ffd288200bcdfb019..3b6e9d40e852c961bcdc8f9e0e439be42525a218 100644 (file)
@@ -896,6 +896,7 @@ static const njs_object_prop_t  njs_date_constructor_properties[] =
         .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_constructor_properties[] =
         .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_constructor_properties[] =
         .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_constructor_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .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_prototype_properties[] =
         .name = njs_string("toJSON"),
         .value = njs_native_function(njs_date_prototype_to_json,
                      NJS_CONTINUATION_SIZE, 0),
+        .configurable = 1,
     },
 };
 
index f0add9464c182ce0e137a80f6b65862e7acf918e..ee5ab4159c13aa5228f5b9358444ed49d0385b40 100644 (file)
@@ -171,6 +171,7 @@ static const njs_object_prop_t  njs_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_internal_error_constructor_properties[] =
         .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_internal_error_constructor_properties[] =
         .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_range_error_constructor_properties[] =
         .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_range_error_constructor_properties[] =
         .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_reference_error_constructor_properties[] =
         .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_reference_error_constructor_properties[] =
         .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_syntax_error_constructor_properties[] =
         .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_syntax_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_error_constructor_properties[] =
         .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_memory_error_constructor_properties[] =
         .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_memory_error_constructor_properties[] =
         .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_error_prototype_properties[] =
         .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_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("EvalError"),
+        .configurable = 1,
     },
 
     {
@@ -761,6 +785,7 @@ static const njs_object_prop_t  njs_internal_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("InternalError"),
+        .configurable = 1,
     },
 
     {
@@ -768,6 +793,7 @@ static const njs_object_prop_t  njs_internal_error_prototype_properties[] =
         .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_range_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("RangeError"),
+        .configurable = 1,
     },
 
     {
@@ -808,6 +835,7 @@ static const njs_object_prop_t  njs_reference_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("ReferenceError"),
+        .configurable = 1,
     },
 
     {
@@ -831,6 +859,7 @@ static const njs_object_prop_t  njs_syntax_error_prototype_properties[] =
         .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_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("TypeError"),
+        .configurable = 1,
     },
 
     {
@@ -883,6 +913,7 @@ static const njs_object_prop_t  njs_uri_error_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("URIError"),
+        .configurable = 1,
     },
 };
 
index 1dbb3761fd5961b6b16005cfa84f29b9c76b3857..5e9d5cf507fe1a082932607e64c12c7a83ebb83c 100644 (file)
@@ -1034,6 +1034,7 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("fs"),
+        .configurable = 1,
     },
 
     {
@@ -1041,12 +1042,14 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .name = njs_string("readFile"),
         .value = njs_native_function(njs_fs_read_file,
                                      njs_continuation_size(njs_fs_cont_t), 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("readFileSync"),
         .value = njs_native_function(njs_fs_read_file_sync, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -1054,6 +1057,7 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .name = njs_string("appendFile"),
         .value = njs_native_function(njs_fs_append_file,
                                      njs_continuation_size(njs_fs_cont_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -1061,6 +1065,7 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .name = njs_string("appendFileSync"),
         .value = njs_native_function(njs_fs_append_file_sync,
                                      njs_continuation_size(njs_fs_cont_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -1068,6 +1073,7 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .name = njs_string("writeFile"),
         .value = njs_native_function(njs_fs_write_file,
                                      njs_continuation_size(njs_fs_cont_t), 0),
+        .configurable = 1,
     },
 
     {
@@ -1075,6 +1081,7 @@ static const njs_object_prop_t  njs_fs_object_properties[] =
         .name = njs_string("writeFileSync"),
         .value = njs_native_function(njs_fs_write_file_sync,
                                      njs_continuation_size(njs_fs_cont_t), 0),
+        .configurable = 1,
     },
 
 };
index a30e184b2cf766f65855dd44e4dc557bc0bd9884..ddf570f3e956a40a786046132034789b560d790b 100644 (file)
@@ -872,6 +872,7 @@ static const njs_object_prop_t  njs_function_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Function"),
+        .configurable = 1,
     },
 
     /* Function.length == 1. */
@@ -879,6 +880,7 @@ static const njs_object_prop_t  njs_function_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Function.prototype. */
@@ -1177,36 +1179,42 @@ static const njs_object_prop_t  njs_function_prototype_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string(""),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 0, 0.0),
+        .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("call"),
         .value = njs_native_function(njs_function_prototype_call, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("apply"),
         .value = njs_native_function(njs_function_prototype_apply, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("bind"),
         .value = njs_native_function(njs_function_prototype_bind, 0, 0),
+        .configurable = 1,
     },
 };
 
@@ -1224,6 +1232,7 @@ const njs_object_prop_t  njs_function_instance_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("length"),
         .value = njs_prop_handler(njs_function_instance_length),
+        .configurable = 1,
     },
 
     {
@@ -1247,6 +1256,7 @@ const njs_object_prop_t  njs_arrow_instance_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("length"),
         .value = njs_prop_handler(njs_function_instance_length),
+        .configurable = 1,
     },
 };
 
@@ -1275,6 +1285,7 @@ static const njs_object_prop_t  njs_eval_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("eval"),
+        .configurable = 1,
     },
 
     /* eval.length == 1. */
@@ -1282,6 +1293,7 @@ static const njs_object_prop_t  njs_eval_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
index d4c73de8cb19f1a3d3c5cae81d262152e45ab594..a2c33ece555b5e63d38ef457e52c54ae8d43c298 100644 (file)
@@ -2077,6 +2077,7 @@ static const njs_object_prop_t  njs_json_object_properties[] =
                                     njs_continuation_size(njs_json_parse_t),
                                     NJS_SKIP_ARG, NJS_STRING_ARG,
                                     NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* JSON.stringify(). */
@@ -2087,6 +2088,7 @@ static const njs_object_prop_t  njs_json_object_properties[] =
                                     njs_continuation_size(njs_json_stringify_t),
                                     NJS_SKIP_ARG, NJS_SKIP_ARG, NJS_SKIP_ARG,
                                     NJS_SKIP_ARG),
+        .configurable = 1,
     },
 };
 
index 8e79309dd9f7a9ff4add017b7ce73f0fc54ef012..c004f81217f04a4ca447e94c6f0e1d62ac50dc6d 100644 (file)
@@ -820,6 +820,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("__proto__"),
         .value = njs_prop_handler(njs_object_prototype_proto),
+        .configurable = 1,
     },
 
     {
@@ -827,6 +828,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("abs"),
         .value = njs_native_function(njs_object_math_abs, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -834,6 +836,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("acos"),
         .value = njs_native_function(njs_object_math_acos, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -842,6 +845,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("acosh"),
         .value = njs_native_function(njs_object_math_acosh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -849,6 +853,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("asin"),
         .value = njs_native_function(njs_object_math_asin, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -857,6 +862,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("asinh"),
         .value = njs_native_function(njs_object_math_asinh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -864,6 +870,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("atan"),
         .value = njs_native_function(njs_object_math_atan, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -871,6 +878,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("atan2"),
         .value = njs_native_function(njs_object_math_atan2, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -879,6 +887,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("atanh"),
         .value = njs_native_function(njs_object_math_atanh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -887,6 +896,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("cbrt"),
         .value = njs_native_function(njs_object_math_cbrt, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -894,6 +904,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("ceil"),
         .value = njs_native_function(njs_object_math_ceil, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -902,6 +913,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("clz32"),
         .value = njs_native_function(njs_object_math_clz32, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -909,6 +921,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("cos"),
         .value = njs_native_function(njs_object_math_cos, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -917,6 +930,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("cosh"),
         .value = njs_native_function(njs_object_math_cosh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -924,6 +938,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("exp"),
         .value = njs_native_function(njs_object_math_exp, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -932,6 +947,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("expm1"),
         .value = njs_native_function(njs_object_math_expm1, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -939,6 +955,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("floor"),
         .value = njs_native_function(njs_object_math_floor, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -947,6 +964,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("fround"),
         .value = njs_native_function(njs_object_math_fround, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -954,6 +972,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("hypot"),
         .value = njs_native_function(njs_object_math_hypot, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -962,6 +981,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("imul"),
         .value = njs_native_function(njs_object_math_imul, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -969,6 +989,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("log"),
         .value = njs_native_function(njs_object_math_log, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -977,6 +998,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("log10"),
         .value = njs_native_function(njs_object_math_log10, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -985,6 +1007,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("log1p"),
         .value = njs_native_function(njs_object_math_log1p, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -993,18 +1016,21 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("log2"),
         .value = njs_native_function(njs_object_math_log2, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("max"),
         .value = njs_native_function(njs_object_math_max, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("min"),
         .value = njs_native_function(njs_object_math_min, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -1012,12 +1038,14 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("pow"),
         .value = njs_native_function(njs_object_math_pow, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("random"),
         .value = njs_native_function(njs_object_math_random, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -1025,6 +1053,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("round"),
         .value = njs_native_function(njs_object_math_round, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -1033,6 +1062,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("sign"),
         .value = njs_native_function(njs_object_math_sign, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1040,6 +1070,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("sin"),
         .value = njs_native_function(njs_object_math_sin, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -1048,6 +1079,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("sinh"),
         .value = njs_native_function(njs_object_math_sinh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1055,6 +1087,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("sqrt"),
         .value = njs_native_function(njs_object_math_sqrt, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1062,6 +1095,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("tan"),
         .value = njs_native_function(njs_object_math_tan, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -1070,6 +1104,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("tanh"),
         .value = njs_native_function(njs_object_math_tanh, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -1078,6 +1113,7 @@ static const njs_object_prop_t  njs_math_object_properties[] =
         .name = njs_string("trunc"),
         .value = njs_native_function(njs_object_math_trunc, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 };
 
index 714715e7292c181a964a7fbb992f8fe7710841e7..7d63589bd0fa6d9324c6574e7d562ba97e9d01ea 100644 (file)
@@ -384,6 +384,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Number"),
+        .configurable = 1,
     },
 
     /* Number.length == 1. */
@@ -391,6 +392,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Number.prototype. */
@@ -456,6 +458,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("isFinite"),
         .value = njs_native_function(njs_number_is_finite, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -463,6 +466,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("isInteger"),
         .value = njs_native_function(njs_number_is_integer, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -470,6 +474,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("isSafeInteger"),
         .value = njs_native_function(njs_number_is_safe_integer, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -477,6 +482,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("isNaN"),
         .value = njs_native_function(njs_number_is_nan, 0, 0),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -485,6 +491,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .name = njs_string("parseFloat"),
         .value = njs_native_function(njs_number_parse_float, 0,
                      NJS_SKIP_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -493,6 +500,7 @@ static const njs_object_prop_t  njs_number_constructor_properties[] =
         .name = njs_string("parseInt"),
         .value = njs_native_function(njs_number_parse_int, 0,
                      NJS_SKIP_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 };
 
@@ -642,18 +650,21 @@ static const njs_object_prop_t  njs_number_prototype_properties[] =
         .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_number_prototype_value_of, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -661,6 +672,7 @@ static const njs_object_prop_t  njs_number_prototype_properties[] =
         .name = njs_string("toString"),
         .value = njs_native_function(njs_number_prototype_to_string, 0,
                      NJS_SKIP_ARG, NJS_NUMBER_ARG),
+        .configurable = 1,
     },
 };
 
@@ -891,6 +903,7 @@ static const njs_object_prop_t  njs_is_nan_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("isNaN"),
+        .configurable = 1,
     },
 
     /* isNaN.length == 1. */
@@ -898,6 +911,7 @@ static const njs_object_prop_t  njs_is_nan_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
@@ -916,6 +930,7 @@ static const njs_object_prop_t  njs_is_finite_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("isFinite"),
+        .configurable = 1,
     },
 
     /* isFinite.length == 1. */
@@ -923,6 +938,7 @@ static const njs_object_prop_t  njs_is_finite_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
@@ -941,6 +957,7 @@ static const njs_object_prop_t  njs_parse_int_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("parseInt"),
+        .configurable = 1,
     },
 
     /* parseInt.length == 2. */
@@ -948,6 +965,7 @@ static const njs_object_prop_t  njs_parse_int_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 2.0),
+        .configurable = 1,
     },
 };
 
@@ -966,6 +984,7 @@ static const njs_object_prop_t  njs_parse_float_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("parseFloat"),
+        .configurable = 1,
     },
 
     /* parseFloat.length == 1. */
@@ -973,6 +992,7 @@ static const njs_object_prop_t  njs_parse_float_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
index 4ed40bab8df07765ec11aa9409836e71789f6e71..f648d5074f137202b076b4adb41985fbc5dbdc02 100644 (file)
@@ -447,8 +447,6 @@ njs_object_property_query(njs_vm_t *vm, njs_property_query_t *pq,
             prop = pq->lhq.value;
 
             if (prop->type != NJS_WHITEOUT) {
-                pq->shared = 0;
-
                 return ret;
             }
 
@@ -2629,6 +2627,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("Object"),
+        .configurable = 1,
     },
 
     /* Object.length == 1. */
@@ -2636,6 +2635,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* Object.prototype. */
@@ -2650,6 +2650,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("create"),
         .value = njs_native_function(njs_object_create, 0, 0),
+        .configurable = 1,
     },
 
     /* Object.keys(). */
@@ -2658,6 +2659,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("keys"),
         .value = njs_native_function(njs_object_keys, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* ES8: Object.values(). */
@@ -2666,6 +2668,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("values"),
         .value = njs_native_function(njs_object_values, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* ES8: Object.entries(). */
@@ -2674,6 +2677,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("entries"),
         .value = njs_native_function(njs_object_entries, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.defineProperty(). */
@@ -2683,6 +2687,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .value = njs_native_function(njs_object_define_property, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG,
                                      NJS_STRING_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.defineProperties(). */
@@ -2692,6 +2697,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .value = njs_native_function(njs_object_define_properties, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG,
                                      NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.getOwnPropertyDescriptor(). */
@@ -2701,6 +2707,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .value = njs_native_function(njs_object_get_own_property_descriptor, 0,
                                      NJS_SKIP_ARG, NJS_SKIP_ARG,
                                      NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     /* Object.getOwnPropertyDescriptors(). */
@@ -2709,6 +2716,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_long_string("getOwnPropertyDescriptors"),
         .value = njs_native_function(njs_object_get_own_property_descriptors, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.getOwnPropertyNames(). */
@@ -2717,6 +2725,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_long_string("getOwnPropertyNames"),
         .value = njs_native_function(njs_object_get_own_property_names, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.getPrototypeOf(). */
@@ -2725,6 +2734,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("getPrototypeOf"),
         .value = njs_native_function(njs_object_get_prototype_of, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.freeze(). */
@@ -2733,6 +2743,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("freeze"),
         .value = njs_native_function(njs_object_freeze, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.isFrozen(). */
@@ -2741,6 +2752,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("isFrozen"),
         .value = njs_native_function(njs_object_is_frozen, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.seal(). */
@@ -2749,6 +2761,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("seal"),
         .value = njs_native_function(njs_object_seal, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.isSealed(). */
@@ -2757,6 +2770,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("isSealed"),
         .value = njs_native_function(njs_object_is_sealed, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.preventExtensions(). */
@@ -2765,6 +2779,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_long_string("preventExtensions"),
         .value = njs_native_function(njs_object_prevent_extensions, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* Object.isExtensible(). */
@@ -2773,6 +2788,7 @@ static const njs_object_prop_t  njs_object_constructor_properties[] =
         .name = njs_string("isExtensible"),
         .value = njs_native_function(njs_object_is_extensible, 0,
                                      NJS_SKIP_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 };
 
@@ -3173,24 +3189,28 @@ static const njs_object_prop_t  njs_object_prototype_properties[] =
         .name = njs_string("__proto__"),
         .value = njs_prop_handler(njs_object_prototype_proto),
         .writable = 1,
+        .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_object_prototype_value_of, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_object_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -3198,6 +3218,7 @@ static const njs_object_prop_t  njs_object_prototype_properties[] =
         .name = njs_string("hasOwnProperty"),
         .value = njs_native_function(njs_object_prototype_has_own_property, 0,
                                      NJS_OBJECT_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3205,6 +3226,7 @@ static const njs_object_prop_t  njs_object_prototype_properties[] =
         .name = njs_long_string("propertyIsEnumerable"),
         .value = njs_native_function(njs_object_prototype_prop_is_enumerable, 0,
                                      NJS_OBJECT_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3212,6 +3234,7 @@ static const njs_object_prop_t  njs_object_prototype_properties[] =
         .name = njs_string("isPrototypeOf"),
         .value = njs_native_function(njs_object_prototype_is_prototype_of, 0,
                                      NJS_OBJECT_ARG, NJS_OBJECT_ARG),
+        .configurable = 1,
     },
 };
 
index de28e8a99fb6958b5430679fd691edd269dd3d01..69be226dd11cfcae795601a88689d92a9b8aebf9 100644 (file)
@@ -64,6 +64,7 @@ typedef struct {
         (pq)->lhq.key.length = 0;                                             \
         (pq)->lhq.value = NULL;                                               \
         (pq)->query = _query;                                                 \
+        (pq)->shared = 0;                                                     \
         (pq)->own = _own;                                                     \
     } while (0)
 
index ade1af9e09de511442b39c2d77ce56365ddfd0a2..c7312145743e33cf1c2bd4d59c0afbfc471befa1 100644 (file)
@@ -986,6 +986,7 @@ static const njs_object_prop_t  njs_regexp_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("RegExp"),
+        .configurable = 1,
     },
 
     /* RegExp.length == 2. */
@@ -993,6 +994,7 @@ static const njs_object_prop_t  njs_regexp_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 2.0),
+        .configurable = 1,
     },
 
     /* RegExp.prototype. */
@@ -1029,30 +1031,35 @@ static const njs_object_prop_t  njs_regexp_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("global"),
         .value = njs_prop_handler(njs_regexp_prototype_global),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("ignoreCase"),
         .value = njs_prop_handler(njs_regexp_prototype_ignore_case),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("multiline"),
         .value = njs_prop_handler(njs_regexp_prototype_multiline),
+        .configurable = 1,
     },
 
     {
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("source"),
         .value = njs_prop_handler(njs_regexp_prototype_source),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_regexp_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -1060,6 +1067,7 @@ static const njs_object_prop_t  njs_regexp_prototype_properties[] =
         .name = njs_string("test"),
         .value = njs_native_function(njs_regexp_prototype_test, 0,
                      NJS_OBJECT_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     {
@@ -1067,6 +1075,7 @@ static const njs_object_prop_t  njs_regexp_prototype_properties[] =
         .name = njs_string("exec"),
         .value = njs_native_function(njs_regexp_prototype_exec, 0,
                      NJS_OBJECT_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 };
 
index 89dafd8f88e7cc7ec06f62fbe33227ceade44f3e..abc9cba59fe70c16e37d25161565f7e1c5ea45c3 100644 (file)
@@ -574,6 +574,7 @@ static const njs_object_prop_t  njs_string_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("String"),
+        .configurable = 1,
     },
 
     /* String.length == 1. */
@@ -581,6 +582,7 @@ static const njs_object_prop_t  njs_string_constructor_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 
     /* String.prototype. */
@@ -596,6 +598,7 @@ static const njs_object_prop_t  njs_string_constructor_properties[] =
         .name = njs_string("bytesFrom"),
         .value = njs_native_function(njs_string_bytes_from, 0, NJS_SKIP_ARG,
                                      NJS_SKIP_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     /* String.fromCharCode(). */
@@ -603,6 +606,7 @@ static const njs_object_prop_t  njs_string_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("fromCharCode"),
         .value = njs_native_function(njs_string_from_char_code, 0, 0),
+        .configurable = 1,
     },
 
     /* String.fromCodePoint(), ECMAScript 6. */
@@ -610,6 +614,7 @@ static const njs_object_prop_t  njs_string_constructor_properties[] =
         .type = NJS_METHOD,
         .name = njs_string("fromCodePoint"),
         .value = njs_native_function(njs_string_from_char_code, 0, 0),
+        .configurable = 1,
     },
 };
 
@@ -3784,30 +3789,35 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .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_string_prototype_value_of, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("toString"),
         .value = njs_native_function(njs_string_prototype_to_string, 0, 0),
+        .configurable = 1,
     },
 
     {
         .type = NJS_METHOD,
         .name = njs_string("concat"),
         .value = njs_native_function(njs_string_prototype_concat, 0, 0),
+        .configurable = 1,
     },
 
     {
@@ -3815,6 +3825,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("fromUTF8"),
         .value = njs_native_function(njs_string_prototype_from_utf8, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3822,6 +3833,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("toUTF8"),
         .value = njs_native_function(njs_string_prototype_to_utf8, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3829,6 +3841,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("fromBytes"),
         .value = njs_native_function(njs_string_prototype_from_bytes, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3836,6 +3849,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("toBytes"),
         .value = njs_native_function(njs_string_prototype_to_bytes, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3843,6 +3857,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("slice"),
         .value = njs_native_function(njs_string_prototype_slice, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3850,6 +3865,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("substring"),
         .value = njs_native_function(njs_string_prototype_substring, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3857,6 +3873,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("substr"),
         .value = njs_native_function(njs_string_prototype_substr, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3864,6 +3881,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("charAt"),
         .value = njs_native_function(njs_string_prototype_char_at, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3871,6 +3889,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("charCodeAt"),
         .value = njs_native_function(njs_string_prototype_char_code_at, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* String.codePointAt(), ECMAScript 6. */
@@ -3879,6 +3898,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("codePointAt"),
         .value = njs_native_function(njs_string_prototype_char_code_at, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3886,6 +3906,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("indexOf"),
         .value = njs_native_function(njs_string_prototype_index_of, 0,
                      NJS_STRING_OBJECT_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3893,6 +3914,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("lastIndexOf"),
         .value = njs_native_function(njs_string_prototype_last_index_of, 0,
                      NJS_STRING_OBJECT_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -3901,6 +3923,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("includes"),
         .value = njs_native_function(njs_string_prototype_includes, 0,
                      NJS_STRING_OBJECT_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -3909,6 +3932,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("startsWith"),
         .value = njs_native_function(njs_string_prototype_starts_with, 0,
                      NJS_STRING_OBJECT_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -3917,6 +3941,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("endsWith"),
         .value = njs_native_function(njs_string_prototype_ends_with, 0,
                      NJS_STRING_OBJECT_ARG, NJS_STRING_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3924,6 +3949,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("toLowerCase"),
         .value = njs_native_function(njs_string_prototype_to_lower_case, 0,
                      NJS_STRING_OBJECT_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3931,6 +3957,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("toUpperCase"),
         .value = njs_native_function(njs_string_prototype_to_upper_case, 0,
                      NJS_STRING_OBJECT_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3938,6 +3965,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("trim"),
         .value = njs_native_function(njs_string_prototype_trim, 0,
                      NJS_STRING_OBJECT_ARG),
+        .configurable = 1,
     },
 
     /* ES6. */
@@ -3946,6 +3974,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("repeat"),
         .value = njs_native_function(njs_string_prototype_repeat, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     /* ES8. */
@@ -3954,6 +3983,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("padStart"),
         .value = njs_native_function(njs_string_prototype_pad_start, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     /* ES8. */
@@ -3962,6 +3992,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("padEnd"),
         .value = njs_native_function(njs_string_prototype_pad_end, 0,
                      NJS_STRING_OBJECT_ARG, NJS_INTEGER_ARG, NJS_STRING_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3969,6 +4000,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("search"),
         .value = njs_native_function(njs_string_prototype_search, 0,
                      NJS_STRING_OBJECT_ARG, NJS_REGEXP_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3976,6 +4008,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("match"),
         .value = njs_native_function(njs_string_prototype_match, 0,
                      NJS_STRING_OBJECT_ARG, NJS_REGEXP_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3983,6 +4016,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .name = njs_string("split"),
         .value = njs_native_function(njs_string_prototype_split, 0,
                      NJS_STRING_OBJECT_ARG, NJS_REGEXP_ARG, NJS_INTEGER_ARG),
+        .configurable = 1,
     },
 
     {
@@ -3991,6 +4025,7 @@ static const njs_object_prop_t  njs_string_prototype_properties[] =
         .value = njs_native_function(njs_string_prototype_replace,
                      njs_continuation_size(njs_string_replace_t),
                      NJS_STRING_OBJECT_ARG, NJS_REGEXP_ARG, NJS_FUNCTION_ARG),
+        .configurable = 1,
     },
 };
 
@@ -4501,6 +4536,7 @@ static const njs_object_prop_t  njs_to_string_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("toString"),
+        .configurable = 1,
     },
 
     /* toString.length == 0. */
@@ -4508,6 +4544,7 @@ static const njs_object_prop_t  njs_to_string_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 0, 0.0),
+        .configurable = 1,
     },
 };
 
@@ -4526,6 +4563,7 @@ static const njs_object_prop_t  njs_encode_uri_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("encodeURI"),
+        .configurable = 1,
     },
 
     /* encodeURI.length == 1. */
@@ -4533,6 +4571,7 @@ static const njs_object_prop_t  njs_encode_uri_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
@@ -4551,6 +4590,7 @@ static const njs_object_prop_t  njs_encode_uri_component_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_long_string("encodeURIComponent"),
+        .configurable = 1,
     },
 
     /* encodeURIComponent.length == 1. */
@@ -4558,6 +4598,7 @@ static const njs_object_prop_t  njs_encode_uri_component_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
@@ -4576,6 +4617,7 @@ static const njs_object_prop_t  njs_decode_uri_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_string("decodeURI"),
+        .configurable = 1,
     },
 
     /* decodeURI.length == 1. */
@@ -4583,6 +4625,7 @@ static const njs_object_prop_t  njs_decode_uri_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
@@ -4601,6 +4644,7 @@ static const njs_object_prop_t  njs_decode_uri_component_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("name"),
         .value = njs_long_string("decodeURIComponent"),
+        .configurable = 1,
     },
 
     /* decodeURIComponent.length == 1. */
@@ -4608,6 +4652,7 @@ static const njs_object_prop_t  njs_decode_uri_component_function_properties[] =
         .type = NJS_PROPERTY,
         .name = njs_string("length"),
         .value = njs_value(NJS_NUMBER, 1, 1.0),
+        .configurable = 1,
     },
 };
 
index 00fa2dc35c690606c6ecfe9889685cbc7b8c9504..f2123512708123b1af380778e2649b151f4f6036 100644 (file)
@@ -712,7 +712,7 @@ njs_vmcode_property_delete(njs_vm_t *vm, njs_value_t *object,
     njs_value_t *property)
 {
     njs_ret_t             ret;
-    njs_object_prop_t     *prop;
+    njs_object_prop_t     *prop, *whipeout;
     njs_property_query_t  pq;
 
     njs_property_query_init(&pq, NJS_PROPERTY_QUERY_DELETE, 1);
@@ -724,6 +724,37 @@ njs_vmcode_property_delete(njs_vm_t *vm, njs_value_t *object,
     case NXT_OK:
         prop = pq.lhq.value;
 
+        if (nxt_slow_path(!prop->configurable)) {
+            njs_type_error(vm, "Cannot delete property \"%V\" of %s",
+                           &pq.lhq.key, njs_type_string(object->type));
+            return NXT_ERROR;
+        }
+
+        if (nxt_slow_path(pq.shared)) {
+            whipeout = nxt_mp_align(vm->mem_pool, sizeof(njs_value_t),
+                                    sizeof(njs_object_prop_t));
+            if (nxt_slow_path(whipeout == NULL)) {
+                njs_memory_error(vm);
+                return NXT_ERROR;
+            }
+
+            njs_set_invalid(&whipeout->value);
+            whipeout->name = prop->name;
+            whipeout->type = NJS_WHITEOUT;
+
+            pq.lhq.replace = 0;
+            pq.lhq.value = whipeout;
+            pq.lhq.pool = vm->mem_pool;
+
+            ret = nxt_lvlhsh_insert(&pq.prototype->hash, &pq.lhq);
+            if (nxt_slow_path(ret != NXT_OK)) {
+                njs_internal_error(vm, "lvlhsh insert failed");
+                return NXT_ERROR;
+            }
+
+            break;
+        }
+
         switch (prop->type) {
         case NJS_PROPERTY:
         case NJS_METHOD:
@@ -734,16 +765,12 @@ njs_vmcode_property_delete(njs_vm_t *vm, njs_value_t *object,
             goto done;
 
         case NJS_PROPERTY_HANDLER:
-            if (prop->configurable) {
-                ret = prop->value.data.u.prop_handler(vm, object, NULL, NULL);
-                if (nxt_slow_path(ret != NXT_OK)) {
-                    return ret;
-                }
-
-                goto done;
+            ret = prop->value.data.u.prop_handler(vm, object, NULL, NULL);
+            if (nxt_slow_path(ret != NXT_OK)) {
+                return ret;
             }
 
-            break;
+            goto done;
 
         default:
             njs_internal_error(vm, "unexpected property type \"%s\" "
@@ -753,12 +780,6 @@ njs_vmcode_property_delete(njs_vm_t *vm, njs_value_t *object,
             return NXT_ERROR;
         }
 
-        if (nxt_slow_path(!prop->configurable)) {
-            njs_type_error(vm, "Cannot delete property \"%V\" of %s",
-                           &pq.lhq.key, njs_type_string(object->type));
-            return NXT_ERROR;
-        }
-
         /* GC: release value. */
         prop->type = NJS_WHITEOUT;
         njs_set_invalid(&prop->value);
index 9abf5ed92782a18058aeb7e2e13e4a88cc8847a0..e4167cf19bc23bdb7da4bf3179a0f1a5f3a73dfa 100644 (file)
@@ -3164,6 +3164,19 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("var o = Object.create({a:1}); o.a = 2; delete o.a; o.a"),
       nxt_string("1") },
 
+    { nxt_string("delete Array.name"),
+      nxt_string("true") },
+
+    { nxt_string("delete Math.max"),
+      nxt_string("true") },
+
+    { nxt_string("delete Math.max.length"),
+      nxt_string("true") },
+
+    { nxt_string("function f(a,b) {} "
+                 "[f.length, delete f.length, f.length, delete f.length]"),
+      nxt_string("2,true,0,true") },
+
     { nxt_string("njs.dump({break:1,3:2,'a':4,\"b\":2,true:1,null:0})"),
       nxt_string("{break:1,3:2,a:4,b:2,true:1,null:0}") },
 
@@ -3186,10 +3199,10 @@ static njs_unit_test_t  njs_test[] =
                  "var c = new Cl('a', 'b'); Cl.prototype.z = 1; c.z"),
       nxt_string("1") },
 
-    /* Math object is immutable. */
+    /**/
 
-    { nxt_string("delete Math.max"),
-      nxt_string("TypeError: Cannot delete property \"max\" of object") },
+    { nxt_string("delete Math.E"),
+      nxt_string("TypeError: Cannot delete property \"E\" of object") },
 
     { nxt_string("Math.E = 1"),
       nxt_string("TypeError: Cannot assign to read-only property \"E\" of object") },
@@ -9676,6 +9689,35 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("Object.isExtensible(Object.freeze([]))"),
       nxt_string("false") },
 
+    { nxt_string(
+        "var fail;"
+        "function isConfigurableMethods(o) {"
+        "    var except = ["
+        "        'prototype',"
+        "    ];"
+        "    return Object.getOwnPropertyNames(o)"
+        "                 .filter(v => !except.includes(v)"
+        "                              && typeof o[v] == 'function')"
+        "                 .every(v => Object.getOwnPropertyDescriptor(o, v)"
+        "                                   .configurable"
+        "                             || !(fail = `${o.name}.${v}`));"
+        "}"
+        "["
+        "    Boolean, Boolean.prototype,"
+        "    Number, Number.prototype,"
+        "    String, String.prototype,"
+        "    Object, Object.prototype,"
+        "    Array, Array.prototype,"
+        "    Function, Function.prototype,"
+        "    RegExp, RegExp.prototype,"
+        "    Date, Date.prototype,"
+        "    Error, Error.prototype,"
+        "    Math,"
+        "    JSON,"
+        "].every(obj => isConfigurableMethods(obj)) || fail"),
+
+      nxt_string("true") },
+
     { nxt_string("new Date(undefined)"),
       nxt_string("Invalid Date") },