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 | |
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):
-rw-r--r-- | src/3rdparty/webkit/VERSION | 2 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/ChangeLog | 44 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/WebCore.pro | 2 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp | 22 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h | 3 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/ScrollView.cpp | 10 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/ScrollView.h | 10 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp | 13 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp | 7 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/ChangeLog | 51 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 2 | ||||
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 69 |
13 files changed, 183 insertions, 59 deletions
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 221c020..128df75 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - a54fd11a3abcd6d9c858e8162e85fd1f3aa21db1 + ca7b2e1e1ca558050cf49dd8f7c9b35e4b9d4df5 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index fd5606b..40a2149 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,47 @@ +2010-01-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Enable scrolling optimization for pages with embedded widgets + + https://bugs.webkit.org/show_bug.cgi?id=33373 + + Added a basic manual test for scrolling of embedded QWidgets. + + * manual-tests/qt/qtplugin-scrolling.html: Added. + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollContents): + (WebCore::ScrollView::setParent): + * platform/ScrollView.h: + * platform/qt/ScrollViewQt.cpp: + (WebCore::ScrollView::platformInit): + (WebCore::ScrollView::platformAddChild): + (WebCore::ScrollView::platformRemoveChild): + * plugins/qt/PluginViewQt.cpp: + (WebCore::PluginView::updatePluginWidget): + (WebCore::PluginView::invalidateRect): + +2010-01-29 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Turn off websocket support by default for Qt 4.6.x + https://bugs.webkit.org/show_bug.cgi?id=34284 + + * WebCore.pro: + +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 + + Remove the manual test case in favor of an automated + test case in WebKit/qt/tests/qwebpage. + + * manual-tests/qt/java-script-prompt.html: Removed. + 2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index bf4d6f9..f364d3b 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -186,7 +186,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { } # Web Socket support. -!contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=1 +!contains(DEFINES, ENABLE_WEB_SOCKETS=.): DEFINES += ENABLE_WEB_SOCKETS=0 # XSLT support with QtXmlPatterns !contains(DEFINES, ENABLE_XSLT=.) { diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp index 12edc42..d270e37 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.cpp @@ -216,7 +216,6 @@ #include "JSWebKitCSSTransformValue.h" #include "JSWebKitPoint.h" #include "JSWebKitTransitionEvent.h" -#include "JSWebSocket.h" #include "JSWheelEvent.h" #include "JSWorker.h" #include "JSXMLHttpRequest.h" @@ -247,7 +246,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSDOMWindow); /* Hash table */ -static const HashTableValue JSDOMWindowTableValues[297] = +static const HashTableValue JSDOMWindowTableValues[296] = { { "screen", DontDelete|ReadOnly, (intptr_t)jsDOMWindowScreen, (intptr_t)0 }, { "history", DontDelete|ReadOnly, (intptr_t)jsDOMWindowHistory, (intptr_t)0 }, @@ -540,7 +539,6 @@ static const HashTableValue JSDOMWindowTableValues[297] = { "MessageChannel", DontDelete, (intptr_t)jsDOMWindowMessageChannelConstructor, (intptr_t)setJSDOMWindowMessageChannelConstructor }, { "Worker", DontDelete, (intptr_t)jsDOMWindowWorkerConstructor, (intptr_t)setJSDOMWindowWorkerConstructor }, { "SharedWorker", DontDelete, (intptr_t)jsDOMWindowSharedWorkerConstructor, (intptr_t)setJSDOMWindowSharedWorkerConstructor }, - { "WebSocket", DontDelete, (intptr_t)jsDOMWindowWebSocketConstructor, (intptr_t)setJSDOMWindowWebSocketConstructor }, { "Plugin", DontDelete, (intptr_t)jsDOMWindowPluginConstructor, (intptr_t)setJSDOMWindowPluginConstructor }, { "PluginArray", DontDelete, (intptr_t)jsDOMWindowPluginArrayConstructor, (intptr_t)setJSDOMWindowPluginArrayConstructor }, { "MimeType", DontDelete, (intptr_t)jsDOMWindowMimeTypeConstructor, (intptr_t)setJSDOMWindowMimeTypeConstructor }, @@ -588,7 +586,7 @@ static JSC_CONST_HASHTABLE HashTable JSDOMWindowTable = #if ENABLE(PERFECT_HASH_SIZE) { 65535, JSDOMWindowTableValues, 0 }; #else - { 1068, 1023, JSDOMWindowTableValues, 0 }; + { 1067, 1023, JSDOMWindowTableValues, 0 }; #endif /* Hash table for prototype */ @@ -3275,14 +3273,6 @@ JSValue jsDOMWindowSharedWorkerConstructor(ExecState* exec, const Identifier&, c return castedThis->sharedWorker(exec); } -JSValue jsDOMWindowWebSocketConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) -{ - JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); - if (!castedThis->allowsAccessFrom(exec)) - return jsUndefined(); - return castedThis->webSocket(exec); -} - JSValue jsDOMWindowPluginConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSDOMWindow* castedThis = static_cast<JSDOMWindow*>(asObject(slot.slotBase())); @@ -5678,14 +5668,6 @@ void setJSDOMWindowSharedWorkerConstructor(ExecState* exec, JSObject* thisObject static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "SharedWorker"), value); } -void setJSDOMWindowWebSocketConstructor(ExecState* exec, JSObject* thisObject, JSValue value) -{ - if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) - return; - // Shadowing a built-in constructor - static_cast<JSDOMWindow*>(thisObject)->putDirect(Identifier(exec, "WebSocket"), value); -} - void setJSDOMWindowPluginConstructor(ExecState* exec, JSObject* thisObject, JSValue value) { if (!static_cast<JSDOMWindow*>(thisObject)->allowsAccessFrom(exec)) diff --git a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h index afc8106..5a087e7 100644 --- a/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h +++ b/src/3rdparty/webkit/WebCore/generated/JSDOMWindow.h @@ -82,7 +82,6 @@ public: JSC::JSValue messageChannel(JSC::ExecState*) const; JSC::JSValue worker(JSC::ExecState*) const; JSC::JSValue sharedWorker(JSC::ExecState*) const; - JSC::JSValue webSocket(JSC::ExecState*) const; JSC::JSValue audio(JSC::ExecState*) const; // Custom functions @@ -679,8 +678,6 @@ JSC::JSValue jsDOMWindowWorkerConstructor(JSC::ExecState*, const JSC::Identifier void setJSDOMWindowWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowSharedWorkerConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowSharedWorkerConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -JSC::JSValue jsDOMWindowWebSocketConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); -void setJSDOMWindowWebSocketConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); void setJSDOMWindowPluginConstructor(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsDOMWindowPluginArrayConstructor(JSC::ExecState*, const JSC::Identifier&, const JSC::PropertySlot&); diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp index ee8726a..e67daf9 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.cpp @@ -507,7 +507,7 @@ void ScrollView::scrollContents(const IntSize& scrollDelta) hostWindow()->repaint(panScrollIconDirtyRect, true); } - if (canBlitOnScroll() && !rootPreventsBlitting()) { // The main frame can just blit the WebView window + if (canBlitOnScroll()) { // The main frame can just blit the WebView window // FIXME: Find a way to blit subframes without blitting overlapping content hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect); } else { @@ -597,14 +597,6 @@ void ScrollView::setParent(ScrollView* parentView) if (m_scrollbarsAvoidingResizer && parent()) parent()->adjustScrollbarsAvoidingResizerCount(-m_scrollbarsAvoidingResizer); -#if PLATFORM(QT) - if (m_widgetsPreventingBlitting && parent()) - parent()->adjustWidgetsPreventingBlittingCount(-m_widgetsPreventingBlitting); - - if (m_widgetsPreventingBlitting && parentView) - parentView->adjustWidgetsPreventingBlittingCount(m_widgetsPreventingBlitting); -#endif - Widget::setParent(parentView); if (m_scrollbarsAvoidingResizer && parent()) diff --git a/src/3rdparty/webkit/WebCore/platform/ScrollView.h b/src/3rdparty/webkit/WebCore/platform/ScrollView.h index 1950a54..5dacff5 100644 --- a/src/3rdparty/webkit/WebCore/platform/ScrollView.h +++ b/src/3rdparty/webkit/WebCore/platform/ScrollView.h @@ -305,16 +305,6 @@ private: NSScrollView<WebCoreFrameScrollView>* scrollView() const; #endif -#if PLATFORM(QT) -public: - void adjustWidgetsPreventingBlittingCount(int delta); -private: - bool rootPreventsBlitting() const { return root()->m_widgetsPreventingBlitting > 0; } - unsigned m_widgetsPreventingBlitting; -#else - bool rootPreventsBlitting() const { return false; } -#endif - #if PLATFORM(GTK) public: void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj); diff --git a/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp b/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp index f7ebbc7..f6a8167 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/QWebPopup.cpp @@ -44,9 +44,16 @@ QWebPopup::QWebPopup(PopupMenuClient* client) void QWebPopup::exec() { + // QCursor::pos() is not a great idea for a touch screen, but we don't need the coordinates + // as comboboxes with Qt on Maemo 5 come up in their full width on the screen. + // On the other platforms it's okay to use QCursor::pos(). +#if defined(Q_WS_MAEMO_5) + showPopup(); +#else QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::sendEvent(this, &event); +#endif } void QWebPopup::showPopup() diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp index ccbd751..17ad253 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollViewQt.cpp @@ -36,32 +36,19 @@ namespace WebCore { void ScrollView::platformInit() { - m_widgetsPreventingBlitting = 0; } void ScrollView::platformDestroy() { } -// Windowed plugins are using native windows and are thus preventing -// us from doing any kind of scrolling optimization. - -void ScrollView::adjustWidgetsPreventingBlittingCount(int delta) -{ - m_widgetsPreventingBlitting += delta; - if (parent()) - parent()->adjustWidgetsPreventingBlittingCount(delta); -} - void ScrollView::platformAddChild(Widget*) { - adjustWidgetsPreventingBlittingCount(1); } void ScrollView::platformRemoveChild(Widget* child) { child->hide(); - adjustWidgetsPreventingBlittingCount(-1); } } diff --git a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp index e61736b..476ab8a 100644 --- a/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp +++ b/src/3rdparty/webkit/WebCore/plugins/qt/PluginViewQt.cpp @@ -126,6 +126,10 @@ void PluginView::updatePluginWidget() // scroll, we need to move/resize immediately. if (!m_windowRect.intersects(frameView->frameRect())) setNPWindowIfNeeded(); + + // Make sure we get repainted afterwards. This is necessary for downward + // scrolling to move the plugin widget properly. + invalidate(); } void PluginView::setFocus() @@ -657,7 +661,8 @@ NPError PluginView::getValue(NPNVariable variable, void* value) void PluginView::invalidateRect(const IntRect& rect) { if (m_isWindowed) { - platformWidget()->update(rect); + if (platformWidget()) + platformWidget()->update(rect); return; } diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 09acd47..697570f 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,54 @@ +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): + 2010-01-25 Janne Koskinen <janne.p.koskinen@digia.com> Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index c5d2792..0c5df4a 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -281,7 +281,7 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914. - if (rc && result.isNull()) + if (rc && x.isNull()) result = String(""); else result = x; 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" |