[Webkit-unassigned] [Bug 29847] New: [Qt] Add support for automatically creating new windows in QWebView

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 29 05:30:01 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=29847

           Summary: [Qt] Add support for automatically creating new
                    windows in QWebView
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Other
        OS/Version: Mac OS X 10.5
            Status: NEW
          Keywords: Qt
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: vestbo at webkit.org


This bug report originated from issue QTBUG-2162
http://bugreports.qt.nokia.com/browse/QTBUG-2162

--- Description ---

QWebView QWebPage - mainframe()-evaluateJavaScript("window.open('url')")
doesn't open new browser window.

When calling evaluateJavaScript("window.open('url')) on a mainFrame() or just
load a  webpage containing
<script>window.open('http://www.trolltech.com/');</script> should open a new
window containing the webpage.

This is due to QWebView::createWindow() not creating a new window by default.
We should consider adding a property to QWebView that enables the default
implementation to create new QWebView instances, something along the lines of a
'bool autoCreateWindows' property.


- How to reproduce:
1. Build and compile the code.
2. Start the application

- Expected result:
Two windows should appear. One containing the Trolltech webpage and one saying
foo... ect.
- Actual result:
Only the last page containing:

foo...before calling open

foo...after calling open. A new window should have popped up showing the
Trolltech webpage.


Test case main.cpp for above
=============================
class MainWidget : public QWidget {
 Q_OBJECT
public:
 MainWidget();
private:
 QWebPage *page;
 QWebView *view;
};
MainWidget::MainWidget(){
 view = new QWebView(this);
 page = new QWebPage(this);
 QUrl url("test.html");

 page->settings()->setAttribute(QWebSettings::JavascriptEnabled,true); // Make
sure JavaScript is enabled
 page->mainFrame()->load(url);            // Load the test case 
 view->setPage(page);

 QVariant variant =
page->mainFrame()->evaluateJavaScript("window.open('http://www.trolltech.com/');");
 qDebug() << variant.toString();            // This doesn't return anything
either.

 QVBoxLayout *layout = new QVBoxLayout;
 layout->addWidget(view);
 setLayout(layout);
}

int main(int argc, char *argv[]){
 QApplication app(argc, argv);
 MainWidget mainWid;
 mainWid.show();
 return app.exec();
}

--- Comments ---

Does this still occur when setting the property
QWebSettings::JavascriptCanOpenWindows ?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list