From a2ce7739bc65bfa5404538446c180dc0f8e5b95a Mon Sep 17 00:00:00 2001 From: Diego Gonzalez Date: Wed, 15 Jun 2011 15:08:23 +0000 Subject: [PATCH] 2011-06-15 Diego Gonzalez Reviewed by Kenneth Rohde Christiansen. [Qt] Inconsistent behavior on a form submit request... https://bugs.webkit.org/show_bug.cgi?id=45523 The inconsistency occurs when a form submission requests a new window. Two windows are opened (instead of only one) and the first window is opened as a blank page. By default each page is put into their own unique page group, which affects popup windows and visited links. Page groups (per process only) is a feature making it possible to use separate settings for each group, so that for instance an integrated browser/email reader can use different settings for displaying HTML pages and HTML email. To make QtWebKit work as expected out of the box, we use a default group similar to what other ports are doing. * Api/qwebpage.cpp: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@88933 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/qt/Api/qwebpage.cpp | 7 +++++++ Source/WebKit/qt/ChangeLog | 19 +++++++++++++++++++ Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 21 ++++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 5b70360..9a1e190 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -345,6 +345,13 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) #endif page = new Page(pageClients); + // By default each page is put into their own unique page group, which affects popup windows + // and visited links. Page groups (per process only) is a feature making it possible to use + // separate settings for each group, so that for instance an integrated browser/email reader + // can use different settings for displaying HTML pages and HTML email. To make QtWebKit work + // as expected out of the box, we use a default group similar to what other ports are doing. + page->setGroupName("Default Group"); + #if ENABLE(CLIENT_BASED_GEOLOCATION) // In case running in DumpRenderTree mode set the controller to mock provider. if (QWebPagePrivate::drtRun) diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 873e895..7041b01 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,22 @@ +2011-06-15 Diego Gonzalez + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Inconsistent behavior on a form submit request... + https://bugs.webkit.org/show_bug.cgi?id=45523 + + The inconsistency occurs when a form submission requests a new window. + Two windows are opened (instead of only one) and the first window is opened + as a blank page. + + By default each page is put into their own unique page group, which affects popup windows + and visited links. Page groups (per process only) is a feature making it possible to use + separate settings for each group, so that for instance an integrated browser/email reader + can use different settings for displaying HTML pages and HTML email. To make QtWebKit work + as expected out of the box, we use a default group similar to what other ports are doing. + + * Api/qwebpage.cpp: + 2011-06-14 Andreas Kling Reviewed by Benjamin Poulain. diff --git a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index fb6f1b7..efe3a3f 100644 --- a/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -89,11 +89,11 @@ public slots: private slots: void initTestCase(); void cleanupTestCase(); - void contextMenuCopy(); void acceptNavigationRequest(); void geolocationRequestJS(); void loadFinished(); + void popupFormSubmission(); void acceptNavigationRequestWithNewWindow(); void userStyleSheet(); void loadHtml5Video(); @@ -390,6 +390,25 @@ public: } }; +void tst_QWebPage::popupFormSubmission() +{ + TestPage page; + page.settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true); + page.mainFrame()->setHtml("
"\ + ""\ + "
"); + page.mainFrame()->evaluateJavaScript("window.open('', 'myNewWin', 'width=500,height=300,toolbar=0')"); + page.mainFrame()->evaluateJavaScript("document.form1.submit();"); + + QTest::qWait(500); + // The number of popup created should be one. + QVERIFY(page.createdWindows.size() == 1); + + QString url = page.createdWindows.takeFirst()->mainFrame()->url().toString(); + // Check if the form submission was OK. + QVERIFY(url.contains("?foo=bar")); +} + void tst_QWebPage::acceptNavigationRequestWithNewWindow() { TestPage* page = new TestPage(m_view); -- 2.1.4