- Revision
- 128177
- Author
- [email protected]
- Date
- 2012-09-11 06:49:30 -0700 (Tue, 11 Sep 2012)
Log 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 <[email protected]> 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):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (128176 => 128177)
--- trunk/Source/WebKit2/ChangeLog 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-11 13:49:30 UTC (rev 128177)
@@ -1,3 +1,31 @@
+2012-09-11 Marcelo Lira <[email protected]>
+
+ [Qt][WK2] Page loading status API lacks a status for intentionally stopped loading
+ https://bugs.webkit.org/show_bug.cgi?id=83062
+
+ 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):
+
2012-09-11 Tor Arne Vestbø <[email protected]>
[Qt] Add a configure step to the Qt build system
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-09-11 13:49:30 UTC (rev 128177)
@@ -323,6 +323,14 @@
webPageProxy->initializeWebPage();
}
+void QQuickWebViewPrivate::loadDidStop()
+{
+ Q_Q(QQuickWebView);
+ ASSERT(!q->loading());
+ QWebLoadRequest loadRequest(q->url(), QQuickWebView::LoadStoppedStatus);
+ emit q->loadingChanged(&loadRequest);
+}
+
void QQuickWebViewPrivate::onComponentComplete()
{
Q_Q(QQuickWebView);
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2012-09-11 13:49:30 UTC (rev 128177)
@@ -96,6 +96,7 @@
};
enum LoadStatus {
LoadStartedStatus,
+ LoadStoppedStatus,
LoadSucceededStatus,
LoadFailedStatus
};
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h 2012-09-11 13:49:30 UTC (rev 128177)
@@ -79,6 +79,7 @@
virtual void loadProgressDidChange(int loadProgress);
virtual void backForwardListDidChange();
virtual void loadDidSucceed();
+ virtual void loadDidStop();
virtual void loadDidFail(const WebKit::QtWebError& error);
virtual void handleMouseEvent(QMouseEvent*);
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp 2012-09-11 13:49:30 UTC (rev 128177)
@@ -44,6 +44,7 @@
<< "QQuickWebView.AcceptRequest --> NavigationRequestAction"
<< "QQuickWebView.IgnoreRequest --> NavigationRequestAction"
<< "QQuickWebView.LoadStartedStatus --> LoadStatus"
+ << "QQuickWebView.LoadStoppedStatus --> LoadStatus"
<< "QQuickWebView.LoadSucceededStatus --> LoadStatus"
<< "QQuickWebView.LoadFailedStatus --> LoadStatus"
<< "QQuickWebView.NoErrorDomain --> ErrorDomain"
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml 2012-09-11 13:49:30 UTC (rev 128177)
@@ -120,5 +120,22 @@
verify(webView.waitForLoadSucceeded())
compare(webView.url, url)
}
+
+ function test_stopStatus() {
+ var url = ""
+
+ webView.loadingChanged.connect(function(loadRequest) {
+ if (loadRequest.status == WebView.LoadStopStatus) {
+ compare(webView.url, url)
+ compare(loadRequest.url, url)
+ }
+ })
+
+ webView.url = ""
+ compare(webView.url, url)
+ webView.stop()
+ verify(webView.waitForLoadStopped())
+ compare(webView.url, url)
+ }
}
}
Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml 2012-09-11 13:49:30 UTC (rev 128177)
@@ -28,6 +28,17 @@
loadStatus = null
return failure
}
+ function waitForLoadStopped() {
+ var timeout = 5000
+ var i = 0
+ while (i < timeout && loadStatus != WebView.LoadStoppedStatus) {
+ testResult.wait(50)
+ i += 50
+ }
+ var stop = loadStatus == WebView.LoadStoppedStatus
+ loadStatus = null
+ return stop
+ }
TestResult { id: testResult }
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp 2012-09-11 13:49:30 UTC (rev 128177)
@@ -90,11 +90,21 @@
m_webView->d_func()->loadDidSucceed();
}
+void QtWebPageLoadClient::dispatchLoadStopped()
+{
+ m_webView->d_func()->loadDidStop();
+}
+
void QtWebPageLoadClient::dispatchLoadFailed(WebFrameProxy* frame, const QtWebError& error)
{
+ if (error.isCancellation()) {
+ dispatchLoadStopped();
+ return;
+ }
+
int errorCode = error.errorCode();
- if (error.isCancellation() || errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
+ if (errorCode == kWKErrorCodeFrameLoadInterruptedByPolicyChange || errorCode == kWKErrorCodePlugInWillHandleLoad) {
// The active url might have changed
m_webView->emitUrlChangeIfNeeded();
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h (128176 => 128177)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h 2012-09-11 13:21:53 UTC (rev 128176)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.h 2012-09-11 13:49:30 UTC (rev 128177)
@@ -50,6 +50,7 @@
void didChangeBackForwardList();
void dispatchLoadSucceeded();
+ void dispatchLoadStopped();
void dispatchLoadFailed(WebFrameProxy*, const QtWebError&);