Changeset 90820 in webkit
- Timestamp:
- Jul 12, 2011 9:15:58 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r90817 r90820 1 2011-07-12 Andreas Kling <kling@webkit.org> 2 3 [Qt][WK2] Add informative loadFailed() signal to web views. 4 https://bugs.webkit.org/show_bug.cgi?id=64362 5 6 Reviewed by Benjamin Poulain. 7 8 The web views will now emit loadFailed(QWebError) when a load failure occurs. 9 10 The QWebError object currently contains: 11 - Type of failure (whether it's an engine, network or protocol error.) 12 - The failing URL. 13 - Any error code associated with the failure. 14 15 * UIProcess/API/qt/qdesktopwebview.cpp: 16 (QDesktopWebViewPrivate::loadDidFail): 17 * UIProcess/API/qt/qdesktopwebview.h: 18 * UIProcess/API/qt/qdesktopwebview_p.h: 19 * UIProcess/API/qt/qtouchwebpage.h: 20 * UIProcess/API/qt/qweberror.cpp: Added. 21 (QWebError::QWebError): 22 (QWebErrorPrivate::createQWebError): 23 (QWebErrorPrivate::QWebErrorPrivate): 24 (QWebErrorPrivate::~QWebErrorPrivate): 25 (QWebError::type): 26 (QWebError::errorCode): 27 (QWebError::url): 28 * UIProcess/API/qt/qweberror.h: Added. 29 * UIProcess/API/qt/qweberror_p.h: Added. 30 * UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp: 31 (tst_CommonViewTests::loadNonexistentFileUrl): 32 * UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp: 33 (WebViewAbstraction::WebViewAbstraction): 34 (WebViewAbstraction::touchViewLoadFailed): 35 (WebViewAbstraction::desktopViewLoadFailed): 36 * UIProcess/API/qt/tests/commonviewtests/webviewabstraction.h: 37 * UIProcess/qt/ClientImpl.cpp: 38 (dispatchLoadSucceeded): 39 (dispatchLoadFailed): 40 (qt_wk_didFailProvisionalLoadWithErrorForFrame): 41 (qt_wk_didFinishLoadForFrame): 42 (qt_wk_didFailLoadWithErrorForFrame): 43 * UIProcess/qt/QtWebPageProxy.cpp: 44 (QtWebPageProxy::loadDidFail): 45 * UIProcess/qt/QtWebPageProxy.h: 46 * UIProcess/qt/TouchViewInterface.cpp: 47 (WebKit::TouchViewInterface::loadDidFail): 48 * UIProcess/qt/TouchViewInterface.h: 49 * UIProcess/qt/ViewInterface.h: 50 * WebKit2API.pri: 51 1 52 2011-07-12 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 53 -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
r90647 r90820 113 113 } 114 114 115 void QDesktopWebViewPrivate::loadDidFail(const QWebError& error) 116 { 117 emit q->loadFailed(error); 118 } 119 115 120 void QDesktopWebViewPrivate::didChangeLoadProgress(int percentageLoaded) 116 121 { -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
r90647 r90820 30 30 31 31 class QDesktopWebViewPrivate; 32 class QWebError; 32 33 33 34 namespace WTR { … … 57 58 void loadStarted(); 58 59 void loadSucceeded(); 60 void loadFailed(const QWebError&); 59 61 void loadProgress(int progress); 60 62 void urlChanged(const QUrl&); -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview_p.h
r90577 r90820 59 59 virtual void loadDidBegin(); 60 60 virtual void loadDidSucceed(); 61 virtual void loadDidFail(const QWebError&); 61 62 virtual void didChangeLoadProgress(int); 62 63 -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h
r90766 r90820 30 30 class QTouchWebPagePrivate; 31 31 class QTouchWebPageProxy; 32 class QWebError; 32 33 33 34 namespace WebKit { … … 60 61 void loadStarted(); 61 62 void loadSucceeded(); 63 void loadFailed(const QWebError&); 62 64 void loadProgress(int progress); 63 65 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp
r90647 r90820 34 34 void loadEmptyPageViewVisible(); 35 35 void loadEmptyPageViewHidden(); 36 void loadNonexistentFileUrl(); 36 37 void backAndForward(); 37 38 void reload(); … … 81 82 82 83 QCOMPARE(loadStartedSpy.size(), 1); 84 } 85 86 void tst_CommonViewTests::loadNonexistentFileUrl() 87 { 88 QSignalSpy loadFailedSpy(viewAbstraction.data(), SIGNAL(loadStarted())); 89 90 viewAbstraction->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html"))); 91 QVERIFY(waitForSignal(viewAbstraction.data(), SIGNAL(loadFailed(QWebError)))); 92 93 QCOMPARE(loadFailedSpy.size(), 1); 83 94 } 84 95 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp
r90647 r90820 35 35 connect(touchWebView()->page(), SIGNAL(loadStarted()), this, SLOT(touchViewLoadStarted())); 36 36 connect(touchWebView()->page(), SIGNAL(loadSucceeded()), this, SLOT(touchViewLoadSucceeded())); 37 connect(touchWebView()->page(), SIGNAL(loadFailed(QWebError)), this, SLOT(touchViewLoadFailed(QWebError))); 37 38 38 39 screenHalf.moveLeft(screenHalf.right()); … … 41 42 connect(desktopWebView(), SIGNAL(loadStarted()), this, SLOT(desktopViewLoadStarted())); 42 43 connect(desktopWebView(), SIGNAL(loadSucceeded()), this, SLOT(desktopViewLoadSucceeded())); 44 connect(desktopWebView(), SIGNAL(loadFailed(QWebError)), this, SLOT(desktopViewLoadFailed(QWebError))); 43 45 } 44 46 … … 114 116 } 115 117 118 void WebViewAbstraction::touchViewLoadFailed(const QWebError& error) 119 { 120 m_touchViewSignalsCounter[SIGNAL(loadFailed(QWebError))]++; 121 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(QWebError))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QWebError))]) 122 emit loadFailed(error); 123 } 124 125 void WebViewAbstraction::desktopViewLoadFailed(const QWebError& error) 126 { 127 m_desktopViewSignalsCounter[SIGNAL(loadFailed(QWebError))]++; 128 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(QWebError))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QWebError))]) 129 emit loadFailed(error); 130 } 131 116 132 QTouchWebView* WebViewAbstraction::touchWebView() const 117 133 { -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/webviewabstraction.h
r90647 r90820 46 46 void loadStarted(); 47 47 void loadSucceeded(); 48 void loadFailed(const QWebError&); 48 49 49 50 private Q_SLOTS: … … 52 53 void touchViewLoadSucceeded(); 53 54 void desktopViewLoadSucceeded(); 55 void touchViewLoadFailed(const QWebError&); 56 void desktopViewLoadFailed(const QWebError&); 54 57 55 58 private: -
trunk/Source/WebKit2/UIProcess/qt/ClientImpl.cpp
r90766 r90820 25 25 #include "WKStringQt.h" 26 26 #include "WKURLQt.h" 27 #include "qweberror.h" 28 #include "qweberror_p.h" 27 29 #include <qwkcontext.h> 28 30 #include <QtWebPageProxy.h> … … 46 48 } 47 49 48 static void loadFinished(WKFrameRef frame, const void* clientInfo, bool ok) 49 { 50 if (!WKFrameIsMainFrame(frame)) 51 return; 52 if (ok) 53 toQtWebPageProxy(clientInfo)->loadDidSucceed(); 54 else { 55 // FIXME: loadDidFail(). 56 } 57 toQtWebPageProxy(clientInfo)->updateNavigationActions(); 50 static void dispatchLoadSucceeded(WKFrameRef frame, const void* clientInfo) 51 { 52 if (!WKFrameIsMainFrame(frame)) 53 return; 54 55 toQtWebPageProxy(clientInfo)->updateNavigationActions(); 56 toQtWebPageProxy(clientInfo)->loadDidSucceed(); 57 } 58 59 static void dispatchLoadFailed(WKFrameRef frame, const void* clientInfo, WKErrorRef error) 60 { 61 if (!WKFrameIsMainFrame(frame)) 62 return; 63 64 toQtWebPageProxy(clientInfo)->updateNavigationActions(); 65 toQtWebPageProxy(clientInfo)->loadDidFail(QWebErrorPrivate::createQWebError(error)); 58 66 } 59 67 … … 72 80 void qt_wk_didFailProvisionalLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) 73 81 { 74 loadFinished(frame, clientInfo, false);82 dispatchLoadFailed(frame, clientInfo, error); 75 83 } 76 84 … … 93 101 void qt_wk_didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo) 94 102 { 95 loadFinished(frame, clientInfo, true);103 dispatchLoadSucceeded(frame, clientInfo); 96 104 } 97 105 98 106 void qt_wk_didFailLoadWithErrorForFrame(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void* clientInfo) 99 107 { 100 loadFinished(frame, clientInfo, false);108 dispatchLoadFailed(frame, clientInfo, error); 101 109 } 102 110 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r90750 r90820 456 456 } 457 457 458 void QtWebPageProxy::loadDidFail(const QWebError& error) 459 { 460 m_viewInterface->loadDidFail(error); 461 } 462 458 463 void QtWebPageProxy::didChangeLoadProgress(int newLoadProgress) 459 464 { -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r90766 r90820 148 148 void loadDidBegin(); 149 149 void loadDidSucceed(); 150 void loadDidFail(const QWebError&); 150 151 void didChangeLoadProgress(int); 151 152 -
trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp
r90750 r90820 135 135 } 136 136 137 void TouchViewInterface::loadDidFail(const QWebError& error) 138 { 139 emit m_pageView->loadFailed(error); 140 } 141 137 142 void TouchViewInterface::didChangeLoadProgress(int percentageLoaded) 138 143 { -
trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h
r90750 r90820 59 59 virtual void loadDidBegin(); 60 60 virtual void loadDidSucceed(); 61 virtual void loadDidFail(const QWebError&); 61 62 virtual void didChangeLoadProgress(int); 62 63 -
trunk/Source/WebKit2/UIProcess/qt/ViewInterface.h
r90577 r90820 25 25 #include <QtCore/QSize> 26 26 #include <QtGui/QMenu> 27 28 class QWebError; 27 29 28 30 QT_BEGIN_NAMESPACE … … 60 62 virtual void loadDidBegin() = 0; 61 63 virtual void loadDidSucceed() = 0; 64 virtual void loadDidFail(const QWebError&) = 0; 62 65 virtual void didChangeLoadProgress(int) = 0; 63 66 -
trunk/Source/WebKit2/WebKit2API.pri
r90647 r90820 7 7 $$SOURCE_DIR/WebKit2/Shared/API/c/WKContextMenuItem.cpp \ 8 8 $$SOURCE_DIR/WebKit2/Shared/API/c/WKDictionary.cpp \ 9 $$SOURCE_DIR/WebKit2/Shared/API/c/WKError.cpp \ 9 10 $$SOURCE_DIR/WebKit2/Shared/API/c/WKGraphicsContext.cpp \ 10 11 $$SOURCE_DIR/WebKit2/Shared/API/c/WKImage.cpp \ … … 48 49 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp \ 49 50 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebview.cpp \ 51 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qweberror.cpp \ 50 52 $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp \ 51 53 $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.cpp \ … … 70 72 $$SOURCE_DIR/WebKit2/Shared/API/c/WKContextMenuItemTypes.h \ 71 73 $$SOURCE_DIR/WebKit2/Shared/API/c/WKDictionary.h \ 74 $$SOURCE_DIR/WebKit2/Shared/API/c/WKError.h \ 72 75 $$SOURCE_DIR/WebKit2/Shared/API/c/WKGeometry.h \ 73 76 $$SOURCE_DIR/WebKit2/Shared/API/c/WKGraphicsContext.h \ … … 126 129 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebview.h \ 127 130 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qtouchwebview_p.h \ 131 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qweberror.h \ 132 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qweberror_p.h \ 128 133 $$SOURCE_DIR/WebKit2/UIProcess/API/qt/qwebkittypes.h \ 129 134 $$SOURCE_DIR/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardList.h \
Note: See TracChangeset
for help on using the changeset viewer.