diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2010-01-29 13:59:39 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2010-01-29 13:59:39 (GMT) |
commit | 4919286e4e9de496514f28432a81deb91d530fd1 (patch) | |
tree | 4c45598161818ef575bddf6d67d4064a19281b6b /src/3rdparty/webkit/WebKit/qt/tests | |
parent | ecd6cdbe4389de8cf8cc65a09050b257ff921686 (diff) | |
download | Qt-4919286e4e9de496514f28432a81deb91d530fd1.zip Qt-4919286e4e9de496514f28432a81deb91d530fd1.tar.gz Qt-4919286e4e9de496514f28432a81deb91d530fd1.tar.bz2 |
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( ca7b2e1e1ca558050cf49dd8f7c9b35e4b9d4df5 )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2010-01-28 Trond Kjernåsen <trond@trolltech.com>
Reviewed by Simon Hausmann.
[Qt] Fix for endless print loop when printing web pages
* Api/qwebframe.cpp:
(QWebFrame::print):
2010-01-26 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] Show comboboxes on Maemo 5
https://bugs.webkit.org/show_bug.cgi?id=34088
Don't try to show the combobox by simulating a mouse event from QCursor::pos() to
get the combobox position right. The position on Maemo 5 is independent from the mouse
and there's no QCursor::pos().
* WebCoreSupport/QtFallbackWebPopup.cpp:
(WebCore::QtFallbackWebPopup::show):
2010-01-26 Holger Hans Peter Freyther <zecke@selfish.org>
Reviewed by Simon Hausmann.
[Qt] JavaScript prompt is currently broken
https://bugs.webkit.org/show_bug.cgi?id=30914
In r52152 a patch was landed to convert a null QString
to an empty WebCore::String in case the prompt was accepted
but the default implementation returned the null QString.
The patch tried to avoid assign to result twice and
was not checking the QString if it is null but the default
value. This lead to always returning an empty string on
successful prompts. Fix it by checking the variable 'x'
for isNull.
The manual test case used didn't cover the case of non
empty input, replace it with an automatic test case that
should cover all cases.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::runJavaScriptPrompt): Fix the bug.
* tests/qwebpage/tst_qwebpage.cpp: Add automatic test case
(JSPromptPage::JSPromptPage):
(JSPromptPage::javaScriptPrompt):
(tst_QWebPage::testJSPrompt):
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index ee1969d..0e04acc 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> + Copyright (C) 2010 Holger Hans Peter Freyther This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -154,6 +155,7 @@ private slots: void screenshot(); void originatingObjectInNetworkRequests(); + void testJSPrompt(); private: QWebView* m_view; @@ -1781,5 +1783,72 @@ void tst_QWebPage::originatingObjectInNetworkRequests() #endif } +/** + * Test fixups for https://bugs.webkit.org/show_bug.cgi?id=30914 + * + * From JS we test the following conditions. + * + * OK + QString() => SUCCESS, empty string (but not null) + * OK + "text" => SUCCESS, "text" + * CANCEL + QString() => CANCEL, null string + * CANCEL + "text" => CANCEL, null string + */ +class JSPromptPage : public QWebPage { + Q_OBJECT +public: + JSPromptPage() + {} + + bool javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result) + { + if (msg == QLatin1String("test1")) { + *result = QString(); + return true; + } else if (msg == QLatin1String("test2")) { + *result = QLatin1String("text"); + return true; + } else if (msg == QLatin1String("test3")) { + *result = QString(); + return false; + } else if (msg == QLatin1String("test4")) { + *result = QLatin1String("text"); + return false; + } + + qFatal("Unknown msg."); + return QWebPage::javaScriptPrompt(frame, msg, defaultValue, result); + } +}; + +void tst_QWebPage::testJSPrompt() +{ + JSPromptPage page; + bool res; + + // OK + QString() + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test1');" + "retval=='' && retval.length == 0;").toBool(); + QVERIFY(res); + + // OK + "text" + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test2');" + "retval=='text' && retval.length == 4;").toBool(); + QVERIFY(res); + + // Cancel + QString() + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test3');" + "retval===null;").toBool(); + QVERIFY(res); + + // Cancel + "text" + res = page.mainFrame()->evaluateJavaScript( + "var retval = prompt('test4');" + "retval===null;").toBool(); + QVERIFY(res); +} + QTEST_MAIN(tst_QWebPage) #include "tst_qwebpage.moc" |