From 9c559216b7b72cf5073cc4dea644ae332d3c140b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Lang=C3=B3?= Date: Fri, 10 Jul 2015 11:27:50 +0200 Subject: [PATCH] Primitive value of Date.prototype should be NaN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com --- jerry-core/ecma/builtin-objects/ecma-builtins.cpp | 2 +- tests/jerry/date-construct.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.cpp b/jerry-core/ecma/builtin-objects/ecma-builtins.cpp index 3567115be..62be3f2fb 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.cpp +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.cpp @@ -159,7 +159,7 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */ case ECMA_BUILTIN_ID_DATE_PROTOTYPE: { ecma_number_t *prim_prop_num_value_p = ecma_alloc_number (); - *prim_prop_num_value_p = ECMA_NUMBER_ZERO; + *prim_prop_num_value_p = ecma_number_make_nan (); ecma_property_t *prim_value_prop_p; prim_value_prop_p = ecma_create_internal_property (object_obj_p, diff --git a/tests/jerry/date-construct.js b/tests/jerry/date-construct.js index e46c24e51..55e6e2c59 100644 --- a/tests/jerry/date-construct.js +++ b/tests/jerry/date-construct.js @@ -29,6 +29,8 @@ catch (e) assert (e.message === "foo"); } +assert (isNaN(Date.prototype.valueOf.call(Date.prototype))); + d = Date("abcd"); assert (isNaN(d.valueOf()));