Bug 31607

Summary: WebScriptable protocol: valueForUndefinedKey: selector never gets called
Product: WebKit Reporter: Eddy Bruel <ejpbruel>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED    
Severity: Normal CC: ggaren, joe-webkit, mrowe
Priority: P2 Keywords: NeedsReduction
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   

Eddy Bruel
Reported 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.
Attachments
Joe Hildebrand
Comment 1 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.
Note You need to log in before you can comment on or make changes to this bug.