Bug 71333

Summary: Object.getOwnPropertyDescriptor() does not retrieve the getter/setter from a property on the window that has been overridden with a getter/setter
Product: WebKit Reporter: Sam Weinig <sam>
Component: JavaScriptCoreAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch barraclough: review+

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>