RESOLVED FIXED 220574
Object literal doesn't properly resolve name clash between an accessor and a constant property
https://bugs.webkit.org/show_bug.cgi?id=220574
Summary Object literal doesn't properly resolve name clash between an accessor and a ...
NWU_NISL
Reported 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.
Attachments
Patch (8.50 KB, patch)
2022-02-05 18:16 PST, Alexey Shvayka
no flags
Patch (14.61 KB, patch)
2022-02-05 19:37 PST, Alexey Shvayka
no flags
NWU_NISL
Comment 1 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.
NWU_NISL
Comment 2 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.
Radar WebKit Bug Importer
Comment 3 2021-01-19 17:59:13 PST
Alexey Shvayka
Comment 4 2022-02-05 18:16:09 PST
Alexey Shvayka
Comment 5 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.
Yusuke Suzuki
Comment 6 2022-02-06 01:02:46 PST
Comment on attachment 451019 [details] Patch r=me
Alexey Shvayka
Comment 7 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!
EWS
Comment 8 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].
Note You need to log in before you can comment on or make changes to this bug.