Welcome! Log In Create A New Profile

Advanced

[njs] Fixed type of Date.prototype.

Dmitry Volyntsev
October 11, 2019 08:36AM
details: https://hg.nginx.org/njs/rev/9944f6e9f33a
branches:
changeset: 1181:9944f6e9f33a
user: Artem S. Povalyukhin <artem.povaluhin@gmail.com>
date: Fri Oct 11 08:01:03 2019 +0300
description:
Fixed type of Date.prototype.

This closes #237 issue on Github.

diffstat:

src/njs_builtin.c | 3 +--
src/test/njs_unit_test.c | 12 +++---------
2 files changed, 4 insertions(+), 11 deletions(-)

diffs (44 lines):

diff -r eb57c1e27495 -r 9944f6e9f33a src/njs_builtin.c
--- a/src/njs_builtin.c Thu Oct 10 20:54:03 2019 +0300
+++ b/src/njs_builtin.c Fri Oct 11 08:01:03 2019 +0300
@@ -190,8 +190,7 @@ const njs_object_prototype_t njs_protot

{ .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 -r eb57c1e27495 -r 9944f6e9f33a src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c Thu Oct 10 20:54:03 2019 +0300
+++ b/src/test/njs_unit_test.c Fri Oct 11 08:01:03 2019 +0300
@@ -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") },
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed type of Date.prototype.

Dmitry Volyntsev 56 October 11, 2019 08:36AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 91
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready