UNCONFIRMED 31607
WebScriptable protocol: valueForUndefinedKey: selector never gets called
https://bugs.webkit.org/show_bug.cgi?id=31607
Summary WebScriptable protocol: valueForUndefinedKey: selector never gets called
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.