From: Artem S. Povalyukhin Date: Fri, 11 Oct 2019 05:01:03 +0000 (+0300) Subject: Fixed type of Date.prototype. X-Git-Url: http://git.kaiwu.me/sitemap.xml?a=commitdiff_plain;h=fd35ca04f9dc09ca89ec50a4f0dbc35272c51cac;p=njs.git Fixed type of Date.prototype. This closes #237 issue on Github. --- 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") },