Hi Eddy.

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:.

Thanks,
Geoff

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
> me to make calls from Javascript to C++ objects implementing a
> 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
> Javascript directly.
> 
> 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:
> http://lists.apple.com/archives/webkitsdk-dev/2008/Oct/msg00021.html
> 
> 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! :-)
> 
> Cheers,
> 
> 
> Eddy
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to