[webkit-dev] problem with ChromeClient::createWindow & NewWindow policy

Anton V. Tarasov Anton.Tarasov at Sun.COM
Thu Sep 18 23:38:57 PDT 2008


Hello,

Ones again about creating new window & policy. Please, have a look.

Say, we have main.html as below:

<html>
<body>
   <a href="main.html" target="_blank">Open new window</a>
   <a href="javascript:window.open('main.html','_blank')">Open new window, JS</a>
</body>
</html>

The first link opens main.html in new window, the second does the same
by means of javascript.

However, I'm observing quite different behavior of WebCore.

A new window is opened by a client via ChromeClient::createWindow callback.
There's also a mechanism to check NewWindow policy, implemented
as FrameLoaderClient::dispatchDecidePolicyForNewWindowAction.

Now, when I'm clicking the first link, ChromeClient::createWindow is not called
at all, FrameLoaderClient::dispatchDecidePolicyForNewWindowAction is called.

Simple grep in WebCore sources gives the following. ChromeClient::createWindow
is called only by:

- ContextMenuController (on selecting "Open link in new window" item)
- javascript (in kjs_window.cpp, on executing 'open')

With the second link there's another issue. Just the reverse, ChromeClient::createWindow
is called, FrameLoaderClient::dispatchDecidePolicyForNewWindowAction is not...

Why that difference? How to open new window in the first case, and why policy check
is not triggered in the second?

Thanks,
Anton.


More information about the webkit-dev mailing list