[njs] Made all constructor properties configurable.

Valentin Bartenev vbart at nginx.com
Tue May 7 17:41:48 UTC 2019


details:   https://hg.nginx.org/njs/rev/ff76f83fc49a
branches:  
changeset: 957:ff76f83fc49a
user:      Valentin Bartenev <vbart at nginx.com>
date:      Tue May 07 20:41:07 2019 +0300
description:
Made all constructor properties configurable.

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.

diffstat:

 njs/njs_array.c  |  1 +
 njs/njs_date.c   |  1 +
 njs/njs_error.c  |  6 ++++++
 njs/njs_regexp.c |  1 +
 4 files changed, 9 insertions(+), 0 deletions(-)

diffs (84 lines):

diff -r 1b95bc101b4c -r ff76f83fc49a njs/njs_array.c
--- a/njs/njs_array.c	Tue May 07 19:50:39 2019 +0300
+++ b/njs/njs_array.c	Tue May 07 20:41:07 2019 +0300
@@ -2252,6 +2252,7 @@ static const njs_object_prop_t  njs_arra
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
diff -r 1b95bc101b4c -r ff76f83fc49a njs/njs_date.c
--- a/njs/njs_date.c	Tue May 07 19:50:39 2019 +0300
+++ b/njs/njs_date.c	Tue May 07 20:41:07 2019 +0300
@@ -1951,6 +1951,7 @@ static const njs_object_prop_t  njs_date
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
diff -r 1b95bc101b4c -r ff76f83fc49a njs/njs_error.c
--- a/njs/njs_error.c	Tue May 07 19:50:39 2019 +0300
+++ b/njs/njs_error.c	Tue May 07 20:41:07 2019 +0300
@@ -748,6 +748,7 @@ static const njs_object_prop_t  njs_eval
         .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_rang
         .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_refe
         .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_synt
         .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
         .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_
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {
diff -r 1b95bc101b4c -r ff76f83fc49a njs/njs_regexp.c
--- a/njs/njs_regexp.c	Tue May 07 19:50:39 2019 +0300
+++ b/njs/njs_regexp.c	Tue May 07 20:41:07 2019 +0300
@@ -1019,6 +1019,7 @@ static const njs_object_prop_t  njs_rege
         .type = NJS_PROPERTY_HANDLER,
         .name = njs_string("constructor"),
         .value = njs_prop_handler(njs_object_prototype_create_constructor),
+        .configurable = 1,
     },
 
     {


More information about the nginx-devel mailing list