Bug 31607 - WebScriptable protocol: valueForUndefinedKey: selector never gets called
Summary: WebScriptable protocol: valueForUndefinedKey: selector never gets called
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: NeedsReduction
Depends on:
Blocks:
 
Reported: 2009-11-17 16:58 PST by Eddy Bruel
Modified: 2012-01-14 16:17 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eddy Bruel 2009-11-17 16:58:06 PST
In case we are accessing a property in Javascript by writing "obj.test", where obj represents a Cocoa object implementing the WebScripting informal protocol, the API reference states that:

"Additionally, the scripting environment can attempt any number of attribute requests or method invocations that are not exported by your class. You can manage these requests by overriding the setValue:forUndefinedKey: and valueForUndefinedKey: methods from the key-value coding protocol."

The valueForUndefinedKey: method never seems to get called though. setValue:forUndefinedKey: works fine for setting properties. So does invokeUndefinedMethodFromWebScript:withArguments: for calling methods this way. I therefore suspect that this is a bug in WebKit.
Comment 1 Joe Hildebrand 2012-01-14 16:17:00 PST
On Lion, if you implement *both* invokeUndefinedMethodFromWebScript:withArguments: (which is never called) and valueForUndefinedKey:, valueForUndefinedKey: will be called correctly.