From: Dmitry Volyntsev Date: Thu, 24 Oct 2019 13:17:17 +0000 (+0300) Subject: Fixed NativeError.prototype.message properties. X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/static/gitweb.js?a=commitdiff_plain;h=fd9c3d9d46408683a595c70708af73dc58bf59a9;p=njs.git Fixed NativeError.prototype.message properties. --- diff --git a/src/njs_error.c b/src/njs_error.c index 9baa9b83..bcda8702 100644 --- a/src/njs_error.c +++ b/src/njs_error.c @@ -778,6 +778,14 @@ static const njs_object_prop_t njs_eval_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY_HANDLER, .name = njs_string("constructor"), @@ -825,6 +833,14 @@ static const njs_object_prop_t njs_internal_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY, .name = njs_string("toString"), @@ -852,6 +868,14 @@ static const njs_object_prop_t njs_range_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY_HANDLER, .name = njs_string("constructor"), @@ -879,6 +903,14 @@ static const njs_object_prop_t njs_reference_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY_HANDLER, .name = njs_string("constructor"), @@ -906,6 +938,14 @@ static const njs_object_prop_t njs_syntax_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY_HANDLER, .name = njs_string("constructor"), @@ -933,6 +973,14 @@ static const njs_object_prop_t njs_type_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY_HANDLER, .name = njs_string("constructor"), @@ -960,6 +1008,14 @@ static const njs_object_prop_t njs_uri_error_prototype_properties[] = .configurable = 1, }, + { + .type = NJS_PROPERTY, + .name = njs_string("message"), + .value = njs_string(""), + .writable = 1, + .configurable = 1, + }, + { .type = NJS_PROPERTY, .name = njs_string("name"), diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 9c67131d..abbaf47b 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -8710,11 +8710,13 @@ static njs_unit_test_t njs_test[] = " var name2 = (inst = e('e'), inst.name = 'E', inst.toString() === 'E: e');" " var name3 = (inst = e('e'), inst.name = '', inst.toString() === 'e');" " var name4 = e().toString() === `${e.prototype.name}`;" + " var name_prop = Object.getOwnPropertyDescriptor(e.prototype, 'message');" + " name_prop = name_prop.writable && !name_prop.enumerable && name_prop.configurable;" " var own_proto_ctor = e.prototype.hasOwnProperty('constructor');" "" " return proto && proto2 && iproto && iproto2 " " && tpof && ctor && msg && name && name2 && name3 && name4 " - " && own_proto_ctor;" + " && name_prop && own_proto_ctor;" "};" "[" " EvalError," diff --git a/test/njs_expect_test.exp b/test/njs_expect_test.exp index 093b5125..2587f566 100644 --- a/test/njs_expect_test.exp +++ b/test/njs_expect_test.exp @@ -766,6 +766,9 @@ njs_test { "Error: loading exception\r\n at module \\(loading_exception.js:1\\)"} {"import lib3 from 'lib1.js'\r\n" "undefined\r\n"} +} "-p test/module/" + +njs_test { {"import m from 'export_name.js'\r\n" "undefined\r\n"} {"m.prod(3,4)\r\n"