[webkit-qt] Preventing net access for specific WebView

Jocelyn Turcotte jocelyn.turcotte at digia.com
Wed Mar 20 09:24:46 PDT 2013


Hello,

On Thu, Mar 14, 2013 at 03:10:10PM +0100, Thomas McGuire wrote:
> I would appreciate any ideas how to restrict network traffic in some specific 
> WebViews, but not all. Ideally I would prefer a solution where I can write an 
> upstreamable patch. Well better even making this work without a patch :)
> 
> Any ideas are welcome, I am that desperate that I even considered creating URL 
> scheme delegates for HTTP and HTTPS... 

I think that this is one of the most difficult, popular use case yet to be solved in WebKit2 with Qt.
We have to find a way to make it powerful enough without spreading too much of our Qt-specific code/hacks around WebKit2.

I don't have much idea about the details but one thing is that this doesn't need to be easy to do as this is an advanced use case, but it should be straightforward.
A thought I had has been that maybe we should have our own injected-bundle-like API that uses QtPlugins, uses ProcessLauncher::LaunchOptions::extraInitializationData to provide it to the spawned Web/Network process, and allow providing your own QNetworkAccessManager from an inside API there.

This is only a rough architectural idea that might not be the best. Even with my limited knowledge of the problem I can see many ways on how this could be difficult to achieve:
- WebKit::WebPage isn't connected to QNAM the same way that QWebPage was, and this can be tricky to connect them through the WebKit2 and WebCore layers without using hacks.
- We would need a way to send string messages back and forth from the plugin to the UI process to permit any use case where the plugin needs to exchange information with the application.
- This should probably re-use or play well with the custom URL scheme code.
- etc.

I don't know any plan to implement such thing from our side short term, but this might at least give you something to chew on and decide what to do until then.
Hope it helps.

Cheers,
Jocelyn


More information about the webkit-qt mailing list