Bug 12721 - getter/setter does not follow the behavior of Firefox
Summary: getter/setter does not follow the behavior of Firefox
Status: RESOLVED DUPLICATE of bug 49739
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 26127 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-02-09 15:53 PST by Feng Qian
Modified: 2012-03-07 18:21 PST (History)
6 users (show)

See Also:


Attachments
test case (521 bytes, text/html)
2007-02-10 10:29 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Feng Qian 2007-02-09 15:53:21 PST
Case:  window.screen.__defineGetter__("width", function(){return "foo";});

Firefox allows defining a getter on a readonly property, WebKit ignores it.
Comment 1 Alexey Proskuryakov 2007-02-10 10:29:12 PST
Created attachment 13106 [details]
test case
Comment 2 Alexey Proskuryakov 2009-06-04 04:10:27 PDT
See also: bug 18737.
Comment 3 Alexey Proskuryakov 2009-06-04 04:10:37 PDT
*** Bug 26127 has been marked as a duplicate of this bug. ***
Comment 4 T. Brains 2009-06-04 06:52:35 PDT
(In reply to comment #3)
> *** Bug 26127 has been marked as a duplicate of this bug. ***

As I described under bug 26127, this isn't limited to "read-only" properties as described here, but rather getters and setters on any native DOM property.

And this contradicts the behavior of Firefox, IE8 and even Chrome.
Comment 5 William J. Edney 2010-02-03 17:26:08 PST
I've confirmed this behavior as well.

Any fix to this would be most welcome! :-)

Cheers,

- Bill
Comment 6 Gavin Barraclough 2012-03-07 18:21:24 PST
The behaviour of __defineGetter__ is correct here, we should not be able to redefine non-configurable properties.  The problem is likely that these properties are directly on the instance of the object, rather than accessors on the prototype.  Per WebIDL, this is a bug in our implementation.

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