[webkit-dev] restricting the number of new windows created in response to a user gesture

Jochen Eisinger jochen at chromium.org
Fri Apr 12 05:05:53 PDT 2013


Hi,

currently, WebKit allows for an arbitrary number of new windows to be
created in response to a single user gesture. This is "used" for example to
create pop-unders.

In order to restrict the number of new windows to one per user gesture, a
port needs to invoke UserGestureIndicator::consumeUserGesture() in it's
ChromeClient::createWindow method.

In https://bugs.webkit.org/show_bug.cgi?id=114379 I add this for WK2 and
for WK1 mac/win.

Are other ports interested in this behavior? If not, I'd just skip the
corresponding tests.

There are some gotchas: e.g. if your port is using out of process plugins,
and the plugin wants to react to a user gesture, you're probably storing
whether WebKit is processing a user gesture before calling out to the
plugin, and restore a UserGestureIndicator once the plugin replies. To make
sure a plugin cannot use this to generate additional user gestures (after
the original user gesture was already consumed), you should store the
UserGestureIndicator::currentToken() and use that to create the
UserGestureIndicator (it's basically a ref-counted integer of how many
gestures are left to consume).

best
-jochen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130412/0658b958/attachment.html>


More information about the webkit-dev mailing list