RESOLVED FIXED Bug 33946
Object.getOwnPropertyDescriptor always returns undefined for JS API objects
https://bugs.webkit.org/show_bug.cgi?id=33946
Summary Object.getOwnPropertyDescriptor always returns undefined for JS API objects
Kent Hansen
Reported 2010-01-21 06:22:19 PST
When Object.getOwnPropertyDescriptor is passed an object that was created using the C API JSObjectMake() function, it doesn't return a valid property descriptor, even if the property is defined in the JSClass.
Attachments
Proposed patch (6.43 KB, patch)
2010-01-21 08:38 PST, Kent Hansen
no flags
Kent Hansen
Comment 1 2010-01-21 08:38:37 PST
Created attachment 47125 [details] Proposed patch Implements the approach suggested by Geoffrey in https://bugs.webkit.org/show_bug.cgi?id=33603#c11. Descriptors always have enumerable=false, even though that might not be true. It's no worse than before, since Object.prototype.propertyIsEnumerable would also return false (since it calls getOwnPropertyDescriptor(), which wasn't implemented). Like I mention in a comment, it can be made more consistent by calling getPropertyNames and checking if the name is in the result, but I've opted not to add that overhead unless it's requested. In a full-blown solution (using access descriptors), the implementation would extract the attributes from the JSStaticValues/JSStaticFunctions if possible, but it doesn't look like the functionality can be completely supported without introducing a new callback in JSClassDefinition (i.e., to get attributes of non-static properties).
Geoffrey Garen
Comment 2 2010-01-21 09:44:40 PST
Comment on attachment 47125 [details] Proposed patch Nice. r=me
WebKit Commit Bot
Comment 3 2010-01-21 12:46:09 PST
Comment on attachment 47125 [details] Proposed patch Clearing flags on attachment: 47125 Committed r53638: <http://trac.webkit.org/changeset/53638>
WebKit Commit Bot
Comment 4 2010-01-21 12:46:13 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.