From fd35ca04f9dc09ca89ec50a4f0dbc35272c51cac Mon Sep 17 00:00:00 2001 From: "Artem S. Povalyukhin" Date: Fri, 11 Oct 2019 08:01:03 +0300 Subject: [PATCH] Fixed type of Date.prototype. This closes #237 issue on Github. --- src/njs_builtin.c | 3 +-- src/test/njs_unit_test.c | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/njs_builtin.c b/src/njs_builtin.c index 5c3b4088..614fbf74 100644 --- a/src/njs_builtin.c +++ b/src/njs_builtin.c @@ -190,8 +190,7 @@ const njs_object_prototype_t njs_prototype_values[] = { { .object = { .type = NJS_REGEXP } }, - { .date = { .time = NAN, - .object = { .type = NJS_DATE } } }, + { .object = { .type = NJS_OBJECT } }, { .object_value = { .value = njs_value(NJS_DATA, 0, 0.0), .object = { .type = NJS_OBJECT } } }, diff --git a/src/test/njs_unit_test.c b/src/test/njs_unit_test.c index 0de5d529..441f97bd 100644 --- a/src/test/njs_unit_test.c +++ b/src/test/njs_unit_test.c @@ -12002,12 +12002,6 @@ static njs_unit_test_t njs_test[] = "Date.prototype.toJSON.call(o, 1)"), njs_str("OK") }, - { njs_str("var d = new Date; d.__proto__"), - njs_str("Invalid Date") }, - - { njs_str("var d = new Date(); d.__proto__"), - njs_str("Invalid Date") }, - { njs_str("var d = new Date(); d.__proto__ === Date.prototype"), njs_str("true") }, @@ -12049,11 +12043,11 @@ static njs_unit_test_t njs_test[] = { njs_str("Date.prototype.__proto__ === Object.prototype"), njs_str("true") }, - { njs_str("Date.prototype"), - njs_str("Invalid Date") }, + { njs_str("njs.dump(Date.prototype)"), + njs_str("{}") }, { njs_str("Date.prototype.valueOf()"), - njs_str("NaN") }, + njs_str("TypeError: cannot convert object to date") }, { njs_str("Date.constructor === Function"), njs_str("true") }, -- 2.47.3