Changeset 128177 in webkit


Ignore:
Timestamp:
Sep 11, 2012 6:49:30 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Qt][WK2] Page loading status API lacks a status for intentionally stopped loading
https://bugs.webkit.org/show_bug.cgi?id=83062

Patch by Marcelo Lira <marcelo.lira@openbossa.org> on 2012-09-11
Reviewed by Tor Arne Vestbø.

When the loading of a page is intentionally interrupted, the loading
status is set to the new state LoadStoppedStatus. This reflects
reality more accurately because the page was not fully loaded
(a LoadSucceededStatus), and it wasn't an unexpected error
(a LoadFailedStatus).

  • UIProcess/API/qt/qquickwebview.cpp:

(QQuickWebViewPrivate::loadDidStop):

  • UIProcess/API/qt/qquickwebview_p.h:
  • UIProcess/API/qt/qquickwebview_p_p.h:

(QQuickWebViewPrivate):

  • UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
  • UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml:
  • UIProcess/API/qt/tests/qmltests/common/TestWebView.qml:
  • UIProcess/qt/QtWebPageLoadClient.cpp:

(WebKit::QtWebPageLoadClient::dispatchLoadStopped):
(WebKit):
(WebKit::QtWebPageLoadClient::dispatchLoadFailed):

  • UIProcess/qt/QtWebPageLoadClient.h:

(QtWebPageLoadClient):

Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r128174 r128177  
     12012-09-11  Marcelo Lira  <marcelo.lira@openbossa.org>
     2
     3        [Qt][WK2] Page loading status API lacks a status for intentionally stopped loading
     4        https://bugs.webkit.org/show_bug.cgi?id=83062
     5
     6        Reviewed by Tor Arne Vestbø.
     7
     8        When the loading of a page is intentionally interrupted, the loading
     9        status is set to the new state LoadStoppedStatus. This reflects
     10        reality more accurately because the page was not fully loaded
     11        (a LoadSucceededStatus), and it wasn't an unexpected error
     12        (a LoadFailedStatus).
     13
     14        * UIProcess/API/qt/qquickwebview.cpp:
     15        (QQuickWebViewPrivate::loadDidStop):
     16        * UIProcess/API/qt/qquickwebview_p.h:
     17        * UIProcess/API/qt/qquickwebview_p_p.h:
     18        (QQuickWebViewPrivate):
     19        * UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:
     20        * UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml:
     21        * UIProcess/API/qt/tests/qmltests/common/TestWebView.qml:
     22        * UIProcess/qt/QtWebPageLoadClient.cpp:
     23        (WebKit::QtWebPageLoadClient::dispatchLoadStopped):
     24        (WebKit):
     25        (WebKit::QtWebPageLoadClient::dispatchLoadFailed):
     26        * UIProcess/qt/QtWebPageLoadClient.h:
     27        (QtWebPageLoadClient):
     28
    1292012-09-11  Tor Arne Vestbø  <tor.arne.vestbo@nokia.com>
    230
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

    r127720 r128177  
    324324}
    325325
     326void QQuickWebViewPrivate::loadDidStop()
     327{
     328    Q_Q(QQuickWebView);
     329    ASSERT(!q->loading());
     330    QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadStoppedStatus);
     331    emit q->loadingChanged(&loadRequest);
     332}
     333
    326334void QQuickWebViewPrivate::onComponentComplete()
    327335{
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h

    r127726 r128177  
    9797    enum LoadStatus {
    9898        LoadStartedStatus,
     99        LoadStoppedStatus,
    99100        LoadSucceededStatus,
    100101        LoadFailedStatus
  • trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h

    r128035 r128177  
    8080    virtual void backForwardListDidChange();
    8181    virtual void loadDidSucceed();
     82    virtual void loadDidStop();
    8283    virtual void loadDidFail(const WebKit::QtWebError& error);
    8384    virtual void handleMouseEvent(QMouseEvent*);
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp

    r125603 r128177  
    4545    << "QQuickWebView.IgnoreRequest --> NavigationRequestAction"
    4646    << "QQuickWebView.LoadStartedStatus --> LoadStatus"
     47    << "QQuickWebView.LoadStoppedStatus --> LoadStatus"
    4748    << "QQuickWebView.LoadSucceededStatus --> LoadStatus"
    4849    << "QQuickWebView.LoadFailedStatus --> LoadStatus"
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml

    r118158 r128177  
    121121            compare(webView.url, url)
    122122        }
     123
     124        function test_stopStatus() {
     125            var url = Qt.resolvedUrl("../common/test1.html")
     126
     127            webView.loadingChanged.connect(function(loadRequest) {
     128                if (loadRequest.status == WebView.LoadStopStatus) {
     129                    compare(webView.url, url)
     130                    compare(loadRequest.url, url)
     131                }
     132            })
     133
     134            webView.url = url
     135            compare(webView.url, url)
     136            webView.stop()
     137            verify(webView.waitForLoadStopped())
     138            compare(webView.url, url)
     139        }
    123140    }
    124141}
  • trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml

    r108815 r128177  
    2929        return failure
    3030    }
     31    function waitForLoadStopped() {
     32        var timeout = 5000
     33        var i = 0
     34        while (i < timeout && loadStatus != WebView.LoadStoppedStatus) {
     35            testResult.wait(50)
     36            i += 50
     37        }
     38        var stop = loadStatus == WebView.LoadStoppedStatus
     39        loadStatus = null
     40        return stop
     41    }
    3142
    3243    TestResult { id: testResult }
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp

    r118158 r128177  
    9191}
    9292
     93void QtWebPageLoadClient::dispatchLoadStopped()
     94{
     95    m_webView->d_func()->loadDidStop();
     96}
     97
    9398void QtWebPageLoadClient::dispatchLoadFailed(WebFrameProxy* frame, const QtWebError& error)
    9499{
     100    if (error.isCancellation()) {
     101        dispatchLoadStopped();
     102        return;
     103    }
     104
    95105    int errorCode = error.errorCode();
    96106
    97     if (error.isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
     107    if (errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
    98108        // The active url might have changed
    99109        m_webView->emitUrlChangeIfNeeded();
  • trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h

    r118158 r128177  
    5151
    5252    void dispatchLoadSucceeded();
     53    void dispatchLoadStopped();
    5354    void dispatchLoadFailed(WebFrameProxy*, const QtWebError&);
    5455
Note: See TracChangeset for help on using the changeset viewer.