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
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Joe Hildebrand
On Lion, if you implement *both* invokeUndefinedMethodFromWebScript:withArguments: (which is never called) and valueForUndefinedKey:, valueForUndefinedKey: will be called correctly.