[webkit-gtk] Selective blocking of image requests

Carlos Garcia Campos cgarcia at igalia.com
Tue Sep 10 01:23:18 PDT 2013


El jue, 29-08-2013 a las 03:44 +0000, Ben Boeckel escribió:
> [Sorry for digging up an old thread.]
> 
> On Mon, 25 Mar, 2013 at 07:18:00 GMT, Carlos Garcia Campos wrote:
> > Yes, there's a low-level API called Web Extensions API[1], that allow
> > you to run code in the Web process. In such API there's
> > WebKitWebPage::send-request signal[2] that you can connect to intercept
> > any resource request for a page. You don't need to change the URI to
> > about:blank, simply return TRUE from the callback and the request won't
> > be sent.=20
> >
> > To use the Web Extensions API you need to provide a plugin with an
> > initialization function[3] that receives a WebKitWebExtension object[4]
> > and tell the UI process where your plugin is[5]. You can connect to the
> > WebKitWebExtension::page-created signal[6] to be notified when a web
> > page is created and get the pointer to the WebKitWebPage to connect a
> > callback to send-request signal.
> >
> > You have examples of how to do this in Epiphany[7], although the ephy
> > web extension is a lot more complex. To implement only the send-request
> > feature you don't need any communication with between the UI process and
> > your extension.=20
> >
> >> Thanks for any help!
> >
> > Hope it helps, if you have any other question, do not hesitate to ask
> > here or in the IRC channel.=20
> >
> > [1] http://www.webkitgtk.org/reference/webkit2gtk/unstable/ch02.html
> > [2] http://www.webkitgtk.org/reference/webkit2gtk/unstable/WebKitWebPage.html#WebKitWebPage-send-request
> > [3] http://www.webkitgtk.org/reference/webkit2gtk/unstable/WebKitWebExtension.html#WebKitWebExtensionInitializeFunction
> > [4] http://www.webkitgtk.org/reference/webkit2gtk/unstable/WebKitWebExtension.html
> > [5] http://www.webkitgtk.org/reference/webkit2gtk/unstable/WebKitWebContext.html#webkit-web-context-set-web-extensions-directory
> > [6] http://www.webkitgtk.org/reference/webkit2gtk/unstable/WebKitWebExtension.html#WebKitWebExtension-page-created
> > [7] https://git.gnome.org/browse/epiphany/tree/embed/web-extension
> 
> Could this information be put into the docs (ideally before 2.2.0)? The
> docs just give a typedef for the function to implement, not a name for
> it. Some docs on what an extension could be used for would be great as
> well.

http://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/

I hope this helps, my idea is to add this documentation to the API docs
too.

> Thanks,
> 
> --Ben
> 

-- 
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20130910/9720436b/attachment.sig>


More information about the webkit-gtk mailing list