Changeset 90844 in webkit


Ignore:
Timestamp:
Jul 12, 2011 1:25:22 PM (13 years ago)
Author:
andreas.kling@nokia.com
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):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r90838 r90844  
     12011-07-12  Andreas Kling  <kling@webkit.org>
     2
     3        [Qt][WK2] Navigation actions in incorrect state when loadStarted() is emitted.
     4        https://bugs.webkit.org/show_bug.cgi?id=64383
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Update the navigation actions before emitting loadStarted().
     9
     10        * UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp:
     11        (LoadStartedCatcher::LoadStartedCatcher):
     12        (LoadStartedCatcher::onLoadStarted):
     13        (tst_QDesktopWebView::stopActionEnabledAfterLoadStarted):
     14        * UIProcess/qt/ClientImpl.cpp:
     15        (qt_wk_didStartProvisionalLoadForFrame):
     16
    1172011-07-12  Benjamin Poulain  <benjamin@webkit.org>
    218
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qdesktopwebview/tst_qdesktopwebview.cpp

    r90837 r90844  
    2323#include <qdesktopwebview.h>
    2424#include "../testwindow.h"
     25#include "../util.h"
    2526
    2627class tst_QDesktopWebView : public QObject {
     
    3233
    3334    void navigationActionsStatusAtStartup();
     35    void stopActionEnabledAfterLoadStarted();
    3436
    3537private:
     
    7274}
    7375
     76class LoadStartedCatcher : public QObject {
     77    Q_OBJECT
     78public:
     79    LoadStartedCatcher(QDesktopWebView* webView)
     80        : m_webView(webView)
     81    {
     82        connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
     83    }
     84
     85public slots:
     86    void onLoadStarted()
     87    {
     88        QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
     89
     90        QAction* stopAction = m_webView->navigationAction(QtWebKit::Stop);
     91        QVERIFY(stopAction);
     92        QCOMPARE(stopAction->isEnabled(), true);
     93    }
     94
     95signals:
     96    void finished();
     97
     98private:
     99    QDesktopWebView* m_webView;
     100};
     101
     102void tst_QDesktopWebView::stopActionEnabledAfterLoadStarted()
     103{
     104    QAction* stopAction = webView()->navigationAction(QtWebKit::Stop);
     105    QVERIFY(stopAction);
     106    QCOMPARE(stopAction->isEnabled(), false);
     107
     108    LoadStartedCatcher catcher(webView());
     109    webView()->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")));
     110    waitForSignal(&catcher, SIGNAL(finished()));
     111
     112    QCOMPARE(stopAction->isEnabled(), true);
     113
     114    waitForSignal(webView(), SIGNAL(loadSucceeded()));
     115}
     116
    74117QTEST_MAIN(tst_QDesktopWebView)
    75118
  • trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp

    r90820 r90844  
    7070    if (!WKFrameIsMainFrame(frame))
    7171        return;
     72
     73    toQtWebPageProxy(clientInfo)->updateNavigationActions();
    7274    toQtWebPageProxy(clientInfo)->loadDidBegin();
    73     toQtWebPageProxy(clientInfo)->updateNavigationActions();
    7475}
    7576
Note: See TracChangeset for help on using the changeset viewer.