Bug 54289 - Object.defineProperty does not override existing properties
Summary: Object.defineProperty does not override existing properties
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 09:27 PST by Jürg Lehni
Modified: 2012-03-12 16:00 PDT (History)
2 users (show)

See Also:


Attachments
Code to replicate behavior. (377 bytes, text/html)
2011-02-11 09:28 PST, Jürg Lehni
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.