]> git.kaiwu.me - njs.git/commitdiff
Fixed type of Date.prototype.
authorArtem S. Povalyukhin <artem.povaluhin@gmail.com>
Fri, 11 Oct 2019 05:01:03 +0000 (08:01 +0300)
committerArtem S. Povalyukhin <artem.povaluhin@gmail.com>
Fri, 11 Oct 2019 05:01:03 +0000 (08:01 +0300)
This closes #237 issue on Github.

src/njs_builtin.c
src/test/njs_unit_test.c

index 5c3b408873f692cf27f743f935e1cac8723f3aa0..614fbf74cbfcdb83f11e68105b4ced76a98503f1 100644 (file)
@@ -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 } } },
index 0de5d5292db5bf5dfc28a855a5ccda0877f2118d..441f97bd77d8dee4af5935f60d82ffd4ac3cbe8d 100644 (file)
@@ -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") },