Bug 163579

Summary: Fix how JSFunction handles "caller" and "arguments" for functions that don't have those properties
Product: WebKit Reporter: Caitlin Potter (:caitp) <caitp>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, rmorisset, saam, ticaiolima, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch none

Description Caitlin Potter (:caitp) 2016-10-17 19:02:27 PDT
The following code in Source/JavaScriptCore/runtime/JSFunction.cpp, added in 2011, could use some investigation/auditing:

```
        // This will trigger the property to be reified, if this is not already the case!
         bool okay = thisObject->hasProperty(exec, propertyName);
         ASSERT_UNUSED(okay, okay);
         scope.release();
         return Base::put(thisObject, exec, propertyName, value, slot);
```

It's unclear what the purpose of reifying this is, as the properties in question are not lazy. Base::put() ought to be enough.
Comment 1 Saam Barati 2017-12-12 23:12:32 PST
It turns out that not only is this not needed, this weird behavior is causing observable side effects.
Comment 2 Saam Barati 2017-12-12 23:35:12 PST
<rdar://problem/35455798>
Comment 3 Saam Barati 2017-12-13 00:02:19 PST
Created attachment 329211 [details]
patch
Comment 4 Saam Barati 2017-12-13 00:05:04 PST
There's a chance I need to update test262 test expectations.
Comment 5 Mark Lam 2017-12-13 00:46:52 PST
Comment on attachment 329211 [details]
patch

r=me
Comment 6 WebKit Commit Bot 2017-12-13 09:29:25 PST
Comment on attachment 329211 [details]
patch

Clearing flags on attachment: 329211

Committed r225845: <https://trac.webkit.org/changeset/225845>
Comment 7 WebKit Commit Bot 2017-12-13 09:29:26 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Caitlin Potter (:caitp) 2017-12-13 09:42:16 PST
👏🙌
Comment 9 Alexey Shvayka 2021-05-14 04:51:58 PDT
*** Bug 157461 has been marked as a duplicate of this bug. ***