[MacRuby-devel] WebScripting protocol

Thibault Martin-Lagardette thibault.ml at gmail.com
Mon Jun 7 17:26:09 PDT 2010


Hi!

I believe you are hitting this bug: http://www.macruby.org/trac/ticket/594
There is a workaround in the first comment: http://www.macruby.org/trac/ticket/594#comment:1

Let me know if that's not it though! :-)

-- 
Thibault Martin-Lagardette



On Jun 7, 2010, at 16:21, Michael Jackson wrote:

> Hi,
> 
> I'm trying to create an object that conforms to the WebScripting
> protocol, but the only method that is working is
> invokeUndefinedMethodFromWebScript:withArguments:. Here's a sample of
> my class so far. The puts statements are just there so I can see what
> is actually being called.
> 
> For reference, the WebScripting protocol is defined here:
> http://developer.apple.com/mac/library/documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html
> 
> 
> class HelloScriptObject
> 
>  def self.isKeyExcludedFromWebScript(key)
>    puts key.inspect
>  end
> 
>  def self.webScriptNameForKey(key)
>    puts key.inspect
>  end
> 
>  def self.isSelectorExcludedFromWebScript(sel)
>    puts sel.inspect
>  end
> 
>  def self.webScriptNameForSelector(sel)
>    puts sel.inspect
>  end
> 
>  def invokeUndefinedMethodFromWebScript(name, withArguments:args)
>    puts name
> 	puts args.inspect
>  end
> 
>  def sayHi
>    puts 'hi'
>  end
> 
> end
> 
> 
> The sayHi method is the one that I'm calling via JavaScript, but every
> time it just defaults to using
> invokeUndefinedMethodFromWebScript:withArguments: instead of using
> self.isSelectorExcludedFromWebScript: to first check if the selector
> is valid or not. Is support for this implemented yet (in 0.6)? If so,
> what am I missing?
> 
> Thanks,
> 
> Michael
> 
> --
> Michael Jackson
> http://mjijackson.com
> @mjijackson
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100607/e4c6e8d5/attachment.html>


More information about the MacRuby-devel mailing list