Title: [90844] trunk/Source/WebKit2
Revision
90844
Author
[email protected]
Date
2011-07-12 13:25:22 -0700 (Tue, 12 Jul 2011)

Log Message

[Qt][WK2] Navigation actions in incorrect state when loadStarted() is emitted.
https://bugs.webkit.org/show_bug.cgi?id=64383

Reviewed by Kenneth Rohde Christiansen.

Update the navigation actions before emitting loadStarted().

* UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
(LoadStartedCatcher::LoadStartedCatcher):
(LoadStartedCatcher::onLoadStarted):
(tst_QDesktopWebView::stopActionEnabledAfterLoadStarted):
* UIProcess/qt/ClientImpl.cpp:
(qt_wk_didStartProvisionalLoadForFrame):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (90843 => 90844)


--- trunk/Source/WebKit2/ChangeLog	2011-07-12 20:22:21 UTC (rev 90843)
+++ trunk/Source/WebKit2/ChangeLog	2011-07-12 20:25:22 UTC (rev 90844)
@@ -1,3 +1,19 @@
+2011-07-12  Andreas Kling  <[email protected]>
+
+        [Qt][WK2] Navigation actions in incorrect state when loadStarted() is emitted.
+        https://bugs.webkit.org/show_bug.cgi?id=64383
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Update the navigation actions before emitting loadStarted().
+
+        * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
+        (LoadStartedCatcher::LoadStartedCatcher):
+        (LoadStartedCatcher::onLoadStarted):
+        (tst_QDesktopWebView::stopActionEnabledAfterLoadStarted):
+        * UIProcess/qt/ClientImpl.cpp:
+        (qt_wk_didStartProvisionalLoadForFrame):
+
 2011-07-12  Benjamin Poulain  <[email protected]>
 
         [Qt][WK2] Add a basic Pinch gesture recognizer for WebKit2

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp (90843 => 90844)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp	2011-07-12 20:22:21 UTC (rev 90843)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp	2011-07-12 20:25:22 UTC (rev 90844)
@@ -22,6 +22,7 @@
 #include <QtTest/QtTest>
 #include <qdesktopwebview.h>
 #include "../testwindow.h"
+#include "../util.h"
 
 class tst_QDesktopWebView : public QObject {
     Q_OBJECT
@@ -31,6 +32,7 @@
     void cleanup();
 
     void navigationActionsStatusAtStartup();
+    void stopActionEnabledAfterLoadStarted();
 
 private:
     inline QDesktopWebView* webView() const;
@@ -71,6 +73,47 @@
     QCOMPARE(reloadAction->isEnabled(), false);
 }
 
+class LoadStartedCatcher : public QObject {
+    Q_OBJECT
+public:
+    LoadStartedCatcher(QDesktopWebView* webView)
+        : m_webView(webView)
+    {
+        connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
+    }
+
+public slots:
+    void onLoadStarted()
+    {
+        QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
+
+        QAction* stopAction = m_webView->navigationAction(QtWebKit::Stop);
+        QVERIFY(stopAction);
+        QCOMPARE(stopAction->isEnabled(), true);
+    }
+
+signals:
+    void finished();
+
+private:
+    QDesktopWebView* m_webView;
+};
+
+void tst_QDesktopWebView::stopActionEnabledAfterLoadStarted()
+{
+    QAction* stopAction = webView()->navigationAction(QtWebKit::Stop);
+    QVERIFY(stopAction);
+    QCOMPARE(stopAction->isEnabled(), false);
+
+    LoadStartedCatcher catcher(webView());
+    webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
+    waitForSignal(&catcher, SIGNAL(finished()));
+
+    QCOMPARE(stopAction->isEnabled(), true);
+
+    waitForSignal(webView(), SIGNAL(loadSucceeded()));
+}
+
 QTEST_MAIN(tst_QDesktopWebView)
 
 #include "tst_qdesktopwebview.moc"

Modified: trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp (90843 => 90844)


--- trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp	2011-07-12 20:22:21 UTC (rev 90843)
+++ trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp	2011-07-12 20:25:22 UTC (rev 90844)
@@ -69,8 +69,9 @@
 {
     if (!WKFrameIsMainFrame(frame))
         return;
+
+    toQtWebPageProxy(clientInfo)->updateNavigationActions();
     toQtWebPageProxy(clientInfo)->loadDidBegin();
-    toQtWebPageProxy(clientInfo)->updateNavigationActions();
 }
 
 void qt_wk_didReceiveServerRedirectForProvisionalLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to