[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [PATCH] Handle open-new-window requests correctly in webkitkde
From:       Arno Rehn <kde-devel () arnorehn ! de>
Date:       2009-04-28 17:05:05
Message-ID: 200904281905.05613.kde-devel () arnorehn ! de
[Download RAW message or body]

On Thursday 23 April 2009 01:16:51 Michael Howell wrote:
> On Sunday 05 April 2009 05:43:31 am Arno Rehn wrote:
> > On Saturday 04 April 2009 05:24:48 Michael Howell wrote:
> > > On Friday 03 April 2009 08:21:35 Arno Rehn wrote:
> > > > Hi,
> > > >
> > > > webkitkde doesn't handle requests to open new windows correctly. The
> > > > attached patch fixes this.
> > > > Additionally windows opened by javascript look the same as with khtml
> > > > with this patch, i.e. no menubar, no toolbar and no statusbar.
> > > > Is this ok to check in?
> > >
> > > Dissecting your patch line-by-line:
> > > > +    // Open new windows that are requested by links here, so
> > > > newWindow()
> > >
> > > only receives
> > >
> > > > +    // calls from javascript.
> > > > +    if (!frame && type == NavigationTypeLinkClicked) {
> > > > +        emit m_part->browserExtension()-
> > > >createNewWindow(KUrl(request.url()));
> > > > +        return false;
> > > > +    }
> > > > +
> > >
> > > This is supposed to be handled by WebKit itself, beside not supporting
> > > POST or PUT requests.
> >
> > How else can we differentiate between javascript popups (i.e. opened with
> > window.open()) and links that have target="_blank" set? If we want to
> > have the same behaviour as khtml, we will always have to open the
> > javascript popups in new windows, whereas we should respect the user's
> > settings for opening new windows in neCw tabs for the simple links.
>
> createWindow() is a protected method in QWebPage that we override. In order
> to implement KJS policies, we add a new protected function, newWindow(),
> that should be used by any classes that inherit KWebPage.
>
> Any ideas on why it isn't working?
It only says

if (WebKitSettings::self()->windowOpenPolicy(mainFrame()->url().host()) == 
WebKitSettings::KJSWindowOpenDeny)
	return 0;

in KWebPage::createWindow() - so if the user doesn't want javascript popups, 
there will never be a new window, because createWindow() is called whenever 
webkit wants to create a new window, not just for javascript windows. 

-- 
Arno Rehn
arno@arnorehn.de
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic