[webkit-gtk] Migrating to Webkit2 from WebKit1

Carlos Garcia Campos cgarcia at igalia.com
Fri Dec 13 00:24:44 PST 2013


El jue, 12-12-2013 a las 12:50 -0800, Niranjan Rao escribió:
> Hi,
> 
> Thank you for the response. Very helpful.
> 
> I am trying to understand web process separation and how it impacts our 
> code. Today we spawn multiple separate processes with web view embedded 
> and drive it. No data is shared between these processes.
> 
> With new architecture will this still be the case? Can I have multiple 
> processes running and still maintain data isolation between these 
> processes?

Yes, you can continue doing the same thing, for every process you spawn
you will have a web process spawned that you can set up with different
cookies file, icons dir, etc.

With WebKit2 it's also possible to share a common UI process with
multiple web processes that don't share anything, using multiple web
contexts, but we don't allow it yet in the GTK+ API, because we haven't
found a use case for that. If you need it, we will add it to the API.

>  Some of the data we get from sites visited is session based 
> and its important for us not to mix sessions when we are visiting same 
> sites using two different processes. We do especially care about cookies 
> and not mixing it. For current release we setup separate cookie jar file 
> for each process. I know they still share some HTML5 data, but not many 
> sites are using those features today.

You can handle those things in the web context API, see

http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebContext.html

webkit_web_context_set_disk_cache_directory()
webkit_web_context_set_web_extensions_directory()
webkit_web_context_set_favicon_database_directory()
webkit_web_context_get_cookie_manager() +
webkit_cookie_manager_set_persistent_storage()

If there's anything missing, please file a bug report.

> Regards,
> 
> Niranjan
> 
> On 12/12/2013 11:42 AM, Carlos Garcia Campos wrote:
> > El jue, 12-12-2013 a las 11:25 -0800, Niranjan Rao escribió:
> >> Greetings,
> > Hi,
> >
> >> I am trying scope efforts required to migrate to Webkit2 from Webkit1. I
> >> came across blog entry by Carlos Garcia Campos at
> >> http://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/,
> >> which answered some of questions/problems I had with newer release, it
> >> raised some new questions as I started digging into API.
> >>
> >> Currently we use webkit 2.0.1 release in Webkit1 mode. We would like to
> >> move latest and greatest to use some new useful features (big thank you
> >> for these features).
> >>
> >> My application is in Java using JNI calls to webkit. Its a scraping
> >> application for all practical purposes where code "understands" contents
> >> of the page and then decides which field needs to filled, selected or
> >> clicked. In other words it drives browser window in similar way a human
> >> will drive, but decisions coming from code which involves heavy DOM
> >> access and manipulation.
> >>
> >> 1. How long webkit1 support will be active? Will there be a cutoff point
> >> that says Webkit1 will not be supported after this point
> > WebKit1 is in maintenance mode, we only fix bugs and some minor API
> > additions like settings and all in a very low priority. But we don't
> > have plans to remove WebKit1 in the short term.
> >
> >> 2. Can  Webkit2 be used by python libraries using introspection? While
> >> not necessary for our code, it makes life easier to do quick test in python.
> > Yes, with some limitations. Web Extensions can't be used for now. We are
> > not generating the introspection files for the web extensions API (I
> > plan to fix that soon), but the main problem is that web extensions are
> > a shared library loaded at run time by the web process, so I don't know
> > how to make that work in python.
> >
> >> 3. New window - could not locate equivalent of "create-web-view" signal
> >> so far. If a page needs to have new window, how do I handle this?
> > http://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-create
> >
> >> 5. My code does lot of DOM manipulation. We have  a driver thread which
> >> channels DOM requests to GUI thread using gtk_idle_add. With new
> >> architecture with extensions and processes, do we need to change this
> >> strategy?
> > You need to move all that code to a web extension, and use a different
> > way to communicate with the UI process. In Epiphany, we use D-Bus for
> > such communication, see:
> >
> > https://git.gnome.org/browse/epiphany/tree/embed/web-extension
> >
> >> 6. WebKitWebPage::send-request - what exactly is treated as resource?
> > Everything that is loaded by the frame loader, CSS, images, scripts,
> > fonts, etc.
> >
> >> Any thing that will be fetched from remote server like images/css etc?
> > Yes.
> >
> >> What about pdf or other files than browser won't display.
> > This signal is emitted before the request is actually sent to the
> > server, so that it happens before the policy checker decides whether to
> > handle that in the web view or not.
> >
> >> 7. Any other notes/warnings your care to add
> > Feel free to ask any other question :-)
> >
> >> Appreciate the great work and new functionality,
> >>
> >> Niranjan
> > Regards,
> 
> 

-- 
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: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20131213/7f4637e0/attachment.sig>


More information about the webkit-gtk mailing list