A WebKit Plugin Written in MacRuby

webkit.pngEloy Duran (of the Dutch Rails consultancy Fingertips) has put together an interesting side project: a WebKit plugin written in MacRuby. His ‘MacRubyWebKitPluginExample’ project on GitHub is a short, self contained example of how to pull it off, so it’s worth checking out if you want to do something similar. Eloy’s example simply allows Ruby code to be supplied by a text box in a WebView and then executed by MacRuby on the back end.

Here’s a video showing it in action:

Before you get too excited, there are some significant provisos. Eloy explains:

Whoa, hold your horses, son. Because this brings us to the most important note, and will most probably be sad news to you, which is that none of the common WebKit based browsers support this… This means no Safari nor Chrome. [Due to their lack of support for garbage collection.]

The latter could possibly be compiled with garbage collection support, it’s completely open-source after all, but I was not able to do so in my quick attempts. In case you’d like to have a go, I could not get ‘Chromium Framework.framework’ to support it. Let me know if you are successful.

However, it’s possible to use the plugin from a Web browser because, well, that’s what a WebView is. You can build a simple Web browser

Eloy Duran

So it’s early days, but these problems seem surmountable, and in the interim it could be a useful technique for those of you building MacRuby OS X apps with custom WebKit WebViews.

Thanks to Ilya Grigorik for pointing this project out on Twitter.

Leave a Reply

Your email address will not be published. Required fields are marked *