Fix how JSFunction handles "caller" and "arguments" for functions that don't have...
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 17:29:21 +0000 (17:29 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Dec 2017 17:29:21 +0000 (17:29 +0000)
commitf37492c417d3f6c5c66185d852dd94f817ed25c4
tree4a1848621758adcd08d939566cdf94e93de86514
parentf345b447afacbd4761bf77641e6571212438aed9
Fix how JSFunction handles "caller" and "arguments" for functions that don't have those properties
https://bugs.webkit.org/show_bug.cgi?id=163579
<rdar://problem/35455798>

Reviewed by Mark Lam.

JSTests:

* stress/caller-and-arguments-properties-for-functions-that-dont-have-them.js: Added.
(assert):
(test1):
(i.test1):
(i.test1.C):
(i.test1.async.foo):
(i.test1.foo):
(test2):

Source/JavaScriptCore:

Some functions in JavaScript do not have the "caller" and "arguments" properties.
For example, strict functions do not. When reading our code that dealt with these
types of functions, it was simply all wrong. We were doing weird things depending
on the method table hook. This patch fixes this by doing what we should've been
doing all along: when the JSFunction does not own the "caller"/"arguments" property,
it should defer to its base class implementation for the various method table hooks.

* runtime/JSFunction.cpp:
(JSC::JSFunction::put):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::defineOwnProperty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/caller-and-arguments-properties-for-functions-that-dont-have-them.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSFunction.cpp