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.
On Lion, if you implement *both* invokeUndefinedMethodFromWebScript:withArguments: (which is never called) and valueForUndefinedKey:, valueForUndefinedKey: will be called correctly.