Re: firefox extension with webkit?



Matej Cepl wrote:
Hi,

how complicated is to make a firefox extension (Greasemonkey in this case) working with WebKit-based epiphany?
* different parameters to configure or something like that
* slight C fixes
* rewrite of WebKit to support firefox extensions


Hi Matej!

There are two questions here which I'll try to answer.

Will Firefox extensions work in Epiphany?

Not at all. The WebKit extension infrastructure (its public API) is completely different to that of Firefox, especially since WebKit is designed to be extended using standard programming languages while Firefox extensions are typically glued together with JavaScript.

Is it easy to implement Epiphany/WebKit extensions?

Absolutely. Extending Epiphany to support GreaseMonkey scripts out of the box is light work if you've familiar with WebKit/JavaScriptCore -- this could be a fun project for anyone looking to cut their teeth on extension hacking.

Implementing a GreaseMonkey extension for WebKit would involve:

1) Installing the appropriate custom script when the script-object-cleared signal is fired on WebView.

2) Installing JS callbacks to handle the 5 GreaseMonkey functions:

    * GM_log - log messages to the JavaScript Console
    * GM_getValue - get script-specific configuration value
    * GM_setValue - set script-specific configuration value
* GM_registerMenuCommand - add a menu item to the User Script Commands submenu
    * GM_xmlhttpRequest - make an arbitrary HTTP request

The Python binding isn't complete yet enough to do this, but you can do it in C or check out Vala, which has some fancy language integration with the runtime to make light work of a project like this. (Perhaps Jürg Billeter can demonstrate how this would be done, ccing him.)

(You'll also need to make a minor modification to Epiphany or the Epiphany Extensions system to expose the underlying WebKit instance to hook your extension up.)

Once the pieces fall into place, Epiphany should be easier to than it has been in the past.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]