]> git.kaiwu.me - njs.git/commitdiff
Made all constructor properties configurable.
authorValentin Bartenev <vbart@nginx.com>
Tue, 7 May 2019 17:41:07 +0000 (20:41 +0300)
committerValentin Bartenev <vbart@nginx.com>
Tue, 7 May 2019 17:41:07 +0000 (20:41 +0300)
Note that actual "constructor" property is created on demand in the prototypes'
private hash with "configurable" option set.  This change corrects its state
before any access.

njs/njs_array.c
njs/njs_date.c
njs/njs_error.c
njs/njs_regexp.c

index a55d441e8df5fe3450dd8e8dcb9ae79d2c9c2c0f..da6e5857644865ca485a804d57eec4e102b32244 100644 (file)
@@ -2252,6 +2252,7 @@ static const njs_object_prop_t  njs_array_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
index 3b6e9d40e852c961bcdc8f9e0e439be42525a218..99ecf37304ba5c345b980ba969a7578a9475485a 100644 (file)
@@ -1951,6 +1951,7 @@ static const njs_object_prop_t  njs_date_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
index ee5ab4159c13aa5228f5b9358444ed49d0385b40..a3deac74ef9525e90f6d3403cb34efb097c39336 100644 (file)
@@ -748,6 +748,7 @@ static const njs_object_prop_t  njs_eval_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 };
 
@@ -818,6 +819,7 @@ static const njs_object_prop_t  njs_range_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 };
 
@@ -842,6 +844,7 @@ static const njs_object_prop_t  njs_reference_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 };
 
@@ -866,6 +869,7 @@ static const njs_object_prop_t  njs_syntax_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 };
 
@@ -890,6 +894,7 @@ static const njs_object_prop_t  njs_type_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 };
 
@@ -907,6 +912,7 @@ static const njs_object_prop_t  njs_uri_error_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
index c7312145743e33cf1c2bd4d59c0afbfc471befa1..bc1544ce7bc7b4146e2924fc5b534f5658dd3100 100644 (file)
@@ -1019,6 +1019,7 @@ static const njs_object_prop_t  njs_regexp_prototype_properties[] =
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {