[webkit-gtk] [RFC] New API: support user content filters in WebKitUserContentManager

Adrián Pérez de Castro aperez at igalia.com
Tue Feb 16 07:22:37 PST 2016


Hi everybody!

This is a proposal to expose support for “content blockers” [1] (a.k.a.
“user content filters”) in the WebKitGTK+ API. Yesterday I took a quick
look to the Cocoa port, and it turns out that the implementation is in
WebCore waiting to be wrapped. Like user style sheets and user scripts,
I think it fits to expose it with methods on WebKitUserContentManager [2]:

  void webkit_user_content_manager_add_filter(WebKitUserContentManager*
                                              WebKitUserContentFilter*);

  void webkit_user_content_manager_remove_all_filters(WebKitUserContentManager*);

(Plus functions to instantiate and ref/unref WebKitUserContentFilter objects,
like it's done for WebKitUser{Script,StyleSheet}.)

It would be great to support this, because it would allow programs using
WebKitGTK+ to reuse the user content filtering framework, and avoid the
current situation in which each has to reimplement this functionality
as a WebProcess plug-in. Not to mention that the user content filter
support from WebCore is faaaast (rules are compiled to machine code!) :-)

If this sounds like a good idea, I can invest some of my time to make it
happen — I have implemented most of WebKitUserContentManager and I it does
not look like it would take a lot of effort.

WDYT?

--
 ⌨ Adrian

P.S: I would love to see Epiphany's ad blocking support rewritten to make use
of user content filters. I could even try to do that myself as to exercise
the new API.

---
[1] https://webkit.org/blog/3476/content-blockers-first-look/
[2] http://webkitgtk.org/reference/webkit2gtk/stable/WebKitUserContentManager.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: signature
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20160216/4e992c6f/attachment.sig>


More information about the webkit-gtk mailing list