Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jerry-core/ecma/builtin-objects/ecma-builtin-date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to t
{
ret_value = ecma_make_normal_completion_value (ecma_make_number_value (prim_value_p));
}
else
{
ecma_dealloc_number (prim_value_p);
}

return ret_value;
} /* ecma_date_construct_helper */
Expand Down
19 changes: 19 additions & 0 deletions tests/jerry/date-construct.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,22 @@ assert (d.valueOf() == 8.64e+15);

d = new Date(8.64e+15 + 1);
assert (isNaN(d.valueOf()));

var Obj = function (val)
{
this.value = val;
this.valueOf = function () { throw new ReferenceError ("valueOf-" + this.value); };
this.toString = function () { throw new ReferenceError ("toString-"+ this.value); };
};

try
{
d = new Date (new Obj (1), new Obj (2));
// Should not be reached.
assert (false);
}
catch (e)
{
assert (e instanceof ReferenceError);
assert (e.message === "valueOf-1");
}