Bug 221176

Summary: An issue about redefining attributes
Product: WebKit Reporter: NWU_NISL <nisl_grammarly1>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ashvayka, fpizlo, ysuzuki
Priority: P2    
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   

Description NWU_NISL 2021-01-30 04:57:08 PST
#version: d940b47

#Testcase
var proto = {};
Object.defineProperty(proto, 'prop', {
    enumerable: true,
});
var Con = function() {};
Con.prototype = proto;
var obj = new Con();
Object.defineProperty(obj, 'prop', {
    enumerable: false,
});
var arr = Object.keys(obj);
for (var p in obj) {
    print(1)
}

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

#Output:
1

#Expected output:


# Description
When executing this test case, the prop property of obj was redefined, and other engines (SpiderMonkey, v8, chakra, etc.) set it as the redefined property, but the property of JavascriptCore is still the property on the prototype. So I suspect this is an implementation error of JavascriptCore.
Comment 1 Alexey Shvayka 2021-01-30 09:23:00 PST
(In reply to NWU_NISL from comment #0)
> # Description
> When executing this test case, the prop property of obj was redefined, and
> other engines (SpiderMonkey, v8, chakra, etc.) set it as the redefined
> property, but the property of JavascriptCore is still the property on the
> prototype. So I suspect this is an implementation error of JavascriptCore.

Thank you for the test case!
It was a long-standing issue, but as of r270874, JSC doesn't enumerate "prop" either.

*** This bug has been marked as a duplicate of bug 38970 ***