Bug 18737 - __lookupSetter__ and __lookupGetter__ don't work for getting native setters and getters
Summary: __lookupSetter__ and __lookupGetter__ don't work for getting native setters a...
Status: RESOLVED DUPLICATE of bug 49739
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL: javascript:alert(Attr.prototype.__loo...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-25 01:12 PDT by Michael A. Puls II
Modified: 2012-03-07 00:10 PST (History)
3 users (show)

See Also:


Attachments
Example that works in Opera 9.5 and Firefox 3, but not in Safari with latest webkit (3.22 KB, text/html)
2008-07-24 09:49 PDT, Michael A. Puls II
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael A. Puls II 2008-04-25 01:12:46 PDT
Safari 3.1 (525.13) with WebKit-SVN-r32486.

Getting native setters and getters works in Firefox.
Comment 1 Michael A. Puls II 2008-04-25 23:05:54 PDT
It doesn't work on instances either.

javascript:alert(document.createAttribute("instance").__lookupGetter__("value"))

That works in FF and Opera 9.5.
Comment 2 Sam Weinig 2008-06-16 13:49:03 PDT
The reason this does not work is that value is a not a getter/setter, but rather an attribute.  It is an implementation detail that Firefox implements native attributes as getter/setter functions.  Changing our implementation to do this would be a probable performance hit, so I can only really see doing this if there is a real world need.
Comment 3 Michael A. Puls II 2008-06-17 03:57:46 PDT
(In reply to comment #2)
> The reason this does not work is that value is a not a getter/setter, but
> rather an attribute.  It is an implementation detail that Firefox implements
> native attributes as getter/setter functions.  Changing our implementation to
> do this would be a probable performance hit, so I can only really see doing
> this if there is a real world need.
> 

Would making it work for instances be acceptable, or would that be just as much as a performance concern?
Comment 4 Michael A. Puls II 2008-07-24 09:49:09 PDT
Created attachment 22467 [details]
Example that works in Opera 9.5 and Firefox 3, but not in Safari with latest webkit

(In reply to comment #2)
> so I can only really see doing
> this if there is a real world need.

See the source of the attachment for an example.

If not, how bout just for compatibility with Firefox and Opera?

Or, maybe try out the change and see how much performance is affected? (Maybe it'd be acceptable?)
Comment 5 Michael A. Puls II 2008-08-27 21:50:05 PDT
(In reply to comment #1)
> It doesn't work on instances either.
> 
> javascript:alert(document.createAttribute("instance").__lookupGetter__("value"))
> 
> That works in FF and Opera 9.5.
> 

This works in Opera 9.5+, Firefox and IE8 beta 2.

javascript:alert(document.createTextNode("instance").__lookupGetter__("nodeValue"))
Comment 6 Alexey Proskuryakov 2009-06-04 07:27:12 PDT
See also: bug 12721.
Comment 7 Gavin Barraclough 2012-03-07 00:10:12 PST
The problem here isn't that __lookupGetter__/Setter are doing the wrong thing, the problem is that the properties aren't actually accessors (but per the WebIDL spec should be).

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