Bug 18737

Summary: __lookupSetter__ and __lookupGetter__ don't work for getting native setters and getters
Product: WebKit Reporter: Michael A. Puls II <shadow2531>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: barraclough, joker806, webmaster
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
URL: javascript:alert(Attr.prototype.__lookupSetter__("value"));
Attachments:
Description Flags
Example that works in Opera 9.5 and Firefox 3, but not in Safari with latest webkit none

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 ***