Bug 54289

Summary: Object.defineProperty does not override existing properties
Product: WebKit Reporter: Jürg Lehni <lists>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: barraclough, medikoo+webkit.org
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.6   
Attachments:
Description Flags
Code to replicate behavior. none

Description Jürg Lehni 2011-02-11 09:27:40 PST
Even if configurable: true was provided at definition time:

var obj = {};

Object.defineProperty(obj, 'test', { value: 10, configurable: true });

alert(obj.test); // 10

Object.defineProperty(obj, 'test', { value: 20, configurable: true });

alert(obj.test); // Should be 20, is still 10

The workaround is to call delete before the 2nd definition:

delete obj.test;

But it seems this contradicts the specifications. Or am I misinterpreting them?
Comment 1 Jürg Lehni 2011-02-11 09:28:29 PST
Created attachment 82140 [details]
Code to replicate behavior.
Comment 2 Jürg Lehni 2011-02-14 02:22:15 PST
Here the link to the same bug over at the Chromium site:

http://code.google.com/p/chromium/issues/detail?id=72736
Comment 3 Gavin Barraclough 2012-03-12 16:00:28 PDT
This works in ToT, a lot of defineOwnProperty bugs were fixed lately so it'll be hard to track down exactly which revision!  Please reopen if you are still seeing any issues.

cheers, G.