From 0266d41ebe9aed389759f158ae7468d2902bccea Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 7 May 2019 20:41:07 +0300 Subject: [PATCH] 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. --- 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(+) diff --git a/njs/njs_array.c b/njs/njs_array.c index a55d441e..da6e5857 100644 --- a/njs/njs_array.c +++ b/njs/njs_array.c @@ -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, }, { diff --git a/njs/njs_date.c b/njs/njs_date.c index 3b6e9d40..99ecf373 100644 --- a/njs/njs_date.c +++ b/njs/njs_date.c @@ -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, }, { diff --git a/njs/njs_error.c b/njs/njs_error.c index ee5ab415..a3deac74 100644 --- a/njs/njs_error.c +++ b/njs/njs_error.c @@ -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, }, { diff --git a/njs/njs_regexp.c b/njs/njs_regexp.c index c7312145..bc1544ce 100644 --- a/njs/njs_regexp.c +++ b/njs/njs_regexp.c @@ -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, }, { -- 2.47.3