Bug 220574 - Object literal doesn't properly resolve name clash between an accessor and a constant property
Summary: Object literal doesn't properly resolve name clash between an accessor and a ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Minor
Assignee: Alexey Shvayka
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-12 17:58 PST by NWU_NISL
Modified: 2022-02-06 04:35 PST (History)
12 users (show)

See Also:


Attachments
Patch (8.50 KB, patch)
2022-02-05 18:16 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Patch (14.61 KB, patch)
2022-02-05 19:37 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description NWU_NISL 2021-01-12 17:58:08 PST
#version: dbae081(https://github.com/WebKit/WebKit-http/commit/dbae081ad7e22d9ab61edf2f337f6c2bb593c7f8)

#Testcase:
a = {
    get p() {print('get');},
    p: 2,
    set p(b) {print('set');}
};

a.p = 0;
print('a.p:', a.p);

#Command:
./webkit/WebKitBuild/Release/bin/jsc testcase.js

#Output:
a.p: 0

#Expected output:
set
a.p: undefined

#Description:
When executing this test case, other engines (such as v8, SpiderMonkey, chakra, etc.) seem to call the 'get' method defined in the 'a' object and output the value of 'a.p' as 'undefined', but JavascriptCore changed the value of 'a.p' to 0. Maybe this is a bug of JavascriptCore.
Comment 1 NWU_NISL 2021-01-14 18:16:22 PST
(In reply to NWU_NISL from comment #0)
> #version:
> dbae081(https://github.com/WebKit/WebKit-http/commit/
> dbae081ad7e22d9ab61edf2f337f6c2bb593c7f8)
> 
> #Testcase:
> a = {
>     get p() {print('get');},
>     p: 2,
>     set p(b) {print('set');}
> };
> 
> a.p = 0;
> print('a.p:', a.p);
> 
> #Command:
> ./webkit/WebKitBuild/Release/bin/jsc testcase.js
> 
> #Output:
> a.p: 0
> 
> #Expected output:
> set
> a.p: undefined
> 
> #Description:
> When executing this test case, other engines (such as v8, SpiderMonkey,
> chakra, etc.) seem to call the 'get' method defined in the 'a' object and
> output the value of 'a.p' as 'undefined', but JavascriptCore changed the
> value of 'a.p' to 0. Maybe this is a bug of JavascriptCore.
Comment 2 NWU_NISL 2021-01-14 18:30:17 PST
The test case in the description I found has some errors, I have modified it in the comments, please check it out.
Comment 3 Radar WebKit Bug Importer 2021-01-19 17:59:13 PST
<rdar://problem/73382771>
Comment 4 Alexey Shvayka 2022-02-05 18:16:09 PST
Created attachment 451017 [details]
Patch
Comment 5 Alexey Shvayka 2022-02-05 19:37:15 PST
Created attachment 451019 [details]
Patch

Adjust LayoutTests/js/class-syntax-method-names.html to pass on V8 / SM.
Comment 6 Yusuke Suzuki 2022-02-06 01:02:46 PST
Comment on attachment 451019 [details]
Patch

r=me
Comment 7 Alexey Shvayka 2022-02-06 04:31:07 PST
Comment on attachment 451019 [details]
Patch

(In reply to Yusuke Suzuki from comment #6)
> Comment on attachment 451019 [details]
> Patch
> 
> r=me

Thanks Yusuke!

(In reply to NWU_NISL from comment #2)
> The test case in the description I found has some errors, I have modified it
> in the comments, please check it out.

We very much appreciate you reporting all the bugs. You've caught some cases that our coverage, fuzzers, and test262 all missed. Please keep them coming!
Comment 8 EWS 2022-02-06 04:35:55 PST
Committed r289166 (246862@main): <https://commits.webkit.org/246862@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 451019 [details].