Date.prototype.toJSON does not execute steps 1-2
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Sep 2019 00:24:23 +0000 (00:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Sep 2019 00:24:23 +0000 (00:24 +0000)
commit9f5cff5333bfc1fa170155a18b5717c54b2a83ab
treebc4d01c9cfd6b1db1856ef2c3d48ca1e558957f8
parent2fdbe7d46237a87ac2d876fb1a0518dd3d563a5f
Date.prototype.toJSON does not execute steps 1-2
https://bugs.webkit.org/show_bug.cgi?id=105282

Patch by Alexey Shvayka <shvaikalesh@gmail.com> on 2019-09-13
Reviewed by Ross Kirsling.

JSTests:

* test262/expectations.yaml: Mark 2 test cases as passing.

Source/JavaScriptCore:

According to https://tc39.es/ecma262/#sec-built-in-function-objects, built-in methods must be
strict mode functions. Before this change, `this` value in Date.prototype.toJSON was resolved
using sloppy mode semantics, resulting in `toISOString` being called on global object if `this`
value equals `null` or `undefined`.

* runtime/DatePrototype.cpp:
(JSC::dateProtoFuncToJSON): Resolve thisValue using strict semantics and simplify std::isfinite check.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/test262/expectations.yaml
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/DatePrototype.cpp