Bug 71333 - Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter
Summary: Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-01 15:32 PDT by Sam Weinig
Modified: 2011-11-02 21:17 PDT (History)
0 users

See Also:


Attachments
Patch (3.73 KB, patch)
2011-11-02 20:39 PDT, Sam Weinig
barraclough: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2011-11-01 15:32:51 PDT
Object.getOwnPropertyDescriptor().get/set does not behave the same as __lookupGetter__/__lookupSetter__ on window properties.

For:

window.y = 1;
window.__defineGetter__("y", function() { return "window.y __getter__"; });

__lookupGetter__ doesn't do the same thing as Object.getOwnPropertyDescriptor:

typeof window.__lookupGetter__('y') != typeof Object.getOwnPropertyDescriptor(window, 'y').get;
Comment 1 Sam Weinig 2011-11-01 15:41:24 PDT
This is now tested in fast/dom/getter-on-window-object2.html.
Comment 2 Sam Weinig 2011-11-01 16:02:39 PDT
The real bug here is not that they behave inconsistently (that will be change shortly by implementing __lookupGetter__ in terms of Object.getOwnPropertyDescriptor()), but that Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter.
Comment 3 Sam Weinig 2011-11-01 19:37:10 PDT
As of r99034, __lookupGetter__/__lookupSetter__ match Object.getOwnPropertyDescriptor, and now both are wrong.
Comment 4 Sam Weinig 2011-11-02 20:39:16 PDT
Created attachment 113426 [details]
Patch
Comment 5 Sam Weinig 2011-11-02 21:17:59 PDT
Committed r99136: <http://trac.webkit.org/changeset/99136>