[webkit-dev] WebScripting protocol: valueForUndefinedKey: never gets called
ggaren at apple.com
Tue Nov 17 12:02:18 PST 2009
This seems like a bug to me. Would you be willing to file it at bugs.webkit.org?
I have a guess at a possible work-around. In the class where you've implemented valueForUndefinedKey:, try also implementing invokeUndefinedMethodFromWebScript:withArguments:.
On Nov 17, 2009, at 7:37 AM, Eddy Bruël wrote:
> Hi everybody,
> I am in the process of writing some code in ObjC, which would allow
> simple reflection interface (it basically allows you to associated
> indices with names, and perform operations such as
> getting/setting/calling on these indices).
> In order to do this, I created a simple ObjC wrapper object around the
> C++ interface, which implements the WebScripting protocol. However,
> since this wrapper object does not have any member variables (they
> are all hidden behind the C++ interface), I cannot expose these to
> Instead, I've tried to make them available using KVC, specifically by
> using the methods valueForUndefinedKey: and
> setValue:forUndefinedKey:. For isKeyExcludedFromWebScript: and
> isSelectorExcludedFromWebScript: I simply always return YES.
> Setting properties like this seems to work fine. The method get called,
> and I simply forward it to the reflection interface. Getting properties, on
> the other hand, does not seem to work: valueForUndefinedKey: simply
> does not get called. At all.
> I found an entry on the Apple mailing lists of somebody seemingly
> having the same problem as me. Unfortunately, there was no answer:
> Am I overlooking something? Are there any other methods I need to
> override in order for this to work? Or is it simply a bug in WebKit, since
> this approach to exposing properties seems to be non-standard, at least.
> Any feedback on this issue would be very much appreciated! :-)
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev