Changeset 95197 in webkit
- Timestamp:
- Sep 15, 2011 9:54:57 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r95195 r95197 1 2011-09-15 Alexis Menard <alexis.menard@openbossa.org> 2 3 [Qt][WK2] Make QWebError more friendly to QML. 4 https://bugs.webkit.org/show_bug.cgi?id=67785 5 6 Reviewed by Simon Hausmann. 7 8 Make sure that we can use the loading errors in QML. We send it via a QJSValue which 9 has the properties needed to get the error code, the url and the type of error. 10 11 * UIProcess/API/qt/qdesktopwebview.cpp: 12 (QDesktopWebViewPrivate::loadDidFail): 13 (QDesktopWebViewPrivate::engine): 14 * UIProcess/API/qt/qdesktopwebview.h: 15 * UIProcess/API/qt/qdesktopwebview_p.h: 16 * UIProcess/API/qt/qtouchwebpage.h: 17 * UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp: 18 (tst_CommonViewTests::loadNonexistentFileUrl): 19 * UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp: 20 (WebViewAbstraction::WebViewAbstraction): 21 (WebViewAbstraction::touchViewLoadFailed): 22 (WebViewAbstraction::desktopViewLoadFailed): 23 * UIProcess/API/qt/tests/commonviewtests/webviewabstraction.h: 24 * UIProcess/API/qt/tests/testwindow.h: 25 * UIProcess/qt/QtWebPageProxy.cpp: 26 (QtWebPageProxy::loadDidFail): 27 * UIProcess/qt/QtWebPageProxy.h: 28 * UIProcess/qt/TouchViewInterface.cpp: 29 (WebKit::TouchViewInterface::loadDidFail): 30 (WebKit::TouchViewInterface::engine): 31 * UIProcess/qt/TouchViewInterface.h: 32 * UIProcess/qt/ViewInterface.h: 33 1 34 2011-09-15 Adam Roben <aroben@apple.com> 2 35 -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
r94979 r95197 25 25 #include <QGraphicsSceneResizeEvent> 26 26 #include <QStyleOptionGraphicsItem> 27 #include <QtDeclarative/qdeclarativeengine.h> 27 28 #include <QtDeclarative/qsgcanvas.h> 28 29 #include <QtDeclarative/qsgevent.h> 29 30 #include <QtDeclarative/qsgitem.h> 31 #include <QtDeclarative/qsgview.h> 30 32 #include <QtGui/QCursor> 31 33 #include <QtGui/QFileDialog> … … 143 145 } 144 146 145 void QDesktopWebViewPrivate::loadDidFail(const Q WebError& error)147 void QDesktopWebViewPrivate::loadDidFail(const QJSValue& error) 146 148 { 147 149 emit q->loadFailed(error); … … 383 385 } 384 386 387 QJSEngine* QDesktopWebViewPrivate::engine() 388 { 389 QSGView* view = qobject_cast<QSGView*>(q->canvas()); 390 if (view) 391 return view->engine(); 392 return 0; 393 } 394 385 395 void QDesktopWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, ViewInterface::FileChooserType type) 386 396 { -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
r93427 r95197 29 29 30 30 class QDesktopWebViewPrivate; 31 class QWebError;32 31 class QWebNavigationController; 33 32 … … 81 80 void loadStarted(); 82 81 void loadSucceeded(); 83 void loadFailed(const QWebError&); 82 // The parameter needs to be explicitly named to work in QML. 83 void loadFailed(const QJSValue& error); 84 84 void loadProgressChanged(int progress); 85 85 void urlChanged(const QUrl&); -
trunk/Source/WebKit2/UIProcess/API/qt/qdesktopwebview_p.h
r94979 r95197 72 72 virtual void loadDidCommit(); 73 73 virtual void loadDidSucceed(); 74 virtual void loadDidFail(const Q WebError&);74 virtual void loadDidFail(const QJSValue&); 75 75 virtual void didChangeLoadProgress(int); 76 76 … … 80 80 virtual void processDidCrash(); 81 81 virtual void didRelaunchProcess(); 82 83 virtual QJSEngine* engine(); 82 84 83 85 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, ViewInterface::FileChooserType); -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h
r94673 r95197 30 30 class QTouchWebPagePrivate; 31 31 class QTouchWebPageProxy; 32 class QWebError;33 32 class QWebNavigationController; 34 33 … … 65 64 void loadStarted(); 66 65 void loadSucceeded(); 67 void loadFailed(const QWebError&); 66 // The parameter needs to be explicitly named to work in QML. 67 void loadFailed(const QJSValue& error); 68 68 void loadProgressChanged(int progress); 69 69 -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/tst_commonviewtests.cpp
r92199 r95197 98 98 99 99 viewAbstraction->load(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html"))); 100 QVERIFY(waitForSignal(viewAbstraction.data(), SIGNAL(loadFailed(Q WebError))));100 QVERIFY(waitForSignal(viewAbstraction.data(), SIGNAL(loadFailed(QJSValue)))); 101 101 102 102 QCOMPARE(loadFailedSpy.size(), 1); -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/webviewabstraction.cpp
r92373 r95197 36 36 connect(touchWebView()->page(), SIGNAL(loadStarted()), this, SLOT(touchViewLoadStarted())); 37 37 connect(touchWebView()->page(), SIGNAL(loadSucceeded()), this, SLOT(touchViewLoadSucceeded())); 38 connect(touchWebView()->page(), SIGNAL(loadFailed(Q WebError)), this, SLOT(touchViewLoadFailed(QWebError)));38 connect(touchWebView()->page(), SIGNAL(loadFailed(QJSValue)), this, SLOT(touchViewLoadFailed(QJSValue))); 39 39 connect(touchWebView()->page(), SIGNAL(loadProgressChanged(int)), this, SLOT(touchViewLoadProgressChanged(int))); 40 40 … … 44 44 connect(desktopWebView(), SIGNAL(loadStarted()), this, SLOT(desktopViewLoadStarted())); 45 45 connect(desktopWebView(), SIGNAL(loadSucceeded()), this, SLOT(desktopViewLoadSucceeded())); 46 connect(desktopWebView(), SIGNAL(loadFailed(Q WebError)), this, SLOT(desktopViewLoadFailed(QWebError)));46 connect(desktopWebView(), SIGNAL(loadFailed(QJSValue)), this, SLOT(desktopViewLoadFailed(QJSValue))); 47 47 connect(desktopWebView(), SIGNAL(loadProgressChanged(int)), this, SLOT(desktopViewLoadProgressChanged(int))); 48 48 } … … 134 134 } 135 135 136 void WebViewAbstraction::touchViewLoadFailed(const Q WebError& error)136 void WebViewAbstraction::touchViewLoadFailed(const QJSValue& error) 137 137 { 138 m_touchViewSignalsCounter[SIGNAL(loadFailed(Q WebError))]++;139 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(Q WebError))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QWebError))])138 m_touchViewSignalsCounter[SIGNAL(loadFailed(QJSValue))]++; 139 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(QJSValue))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QJSValue))]) 140 140 emit loadFailed(error); 141 141 } 142 142 143 void WebViewAbstraction::desktopViewLoadFailed(const Q WebError& error)143 void WebViewAbstraction::desktopViewLoadFailed(const QJSValue& error) 144 144 { 145 m_desktopViewSignalsCounter[SIGNAL(loadFailed(Q WebError))]++;146 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(Q WebError))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QWebError))])145 m_desktopViewSignalsCounter[SIGNAL(loadFailed(QJSValue))]++; 146 if (m_touchViewSignalsCounter[SIGNAL(loadFailed(QJSValue))] == m_desktopViewSignalsCounter[SIGNAL(loadFailed(QJSValue))]) 147 147 emit loadFailed(error); 148 148 } -
trunk/Source/WebKit2/UIProcess/API/qt/tests/commonviewtests/webviewabstraction.h
r91985 r95197 47 47 void loadStarted(); 48 48 void loadSucceeded(); 49 void loadFailed(const Q WebError&);49 void loadFailed(const QJSValue&); 50 50 void loadProgressChanged(int); 51 51 … … 55 55 void touchViewLoadSucceeded(); 56 56 void desktopViewLoadSucceeded(); 57 void touchViewLoadFailed(const Q WebError&);58 void desktopViewLoadFailed(const Q WebError&);57 void touchViewLoadFailed(const QJSValue&); 58 void desktopViewLoadFailed(const QJSValue&); 59 59 void touchViewLoadProgressChanged(int); 60 60 void desktopViewLoadProgressChanged(int); -
trunk/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h
r91863 r95197 23 23 #include <QResizeEvent> 24 24 #include <QScopedPointer> 25 #include <QtDeclarative/qsg canvas.h>25 #include <QtDeclarative/qsgview.h> 26 26 #include <QtDeclarative/qsgitem.h> 27 27 28 28 // TestWindow: Utility class to ignore QGraphicsView details. 29 class TestWindow : public QSG Canvas{29 class TestWindow : public QSGView { 30 30 public: 31 31 inline TestWindow(QSGItem* webView); -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp
r94979 r95197 22 22 #include "QtWebPageProxy.h" 23 23 24 #include "qweberror.h" 24 25 #include "qwkpreferences_p.h" 25 26 … … 45 46 #include <QApplication> 46 47 #include <QGraphicsSceneMouseEvent> 48 #include <QJSEngine> 47 49 #include <QStyle> 48 50 #include <QTouchEvent> … … 406 408 void QtWebPageProxy::loadDidFail(const QWebError& error) 407 409 { 408 m_viewInterface->loadDidFail(error); 410 QJSEngine* engine = m_viewInterface->engine(); 411 QJSValue value; 412 if (engine) { 413 value = engine->newObject(); 414 value.setProperty(QLatin1String("errorCode"), error.errorCode()); 415 value.setProperty(QLatin1String("url"), error.url().toString()); 416 value.setProperty(QLatin1String("type"), error.type()); 417 } 418 m_viewInterface->loadDidFail(value); 409 419 } 410 420 -
trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h
r93784 r95197 44 44 QT_END_NAMESPACE 45 45 46 class QWebError; 46 47 class QWKHistory; 47 48 class QWKPreferences; -
trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp
r94672 r95197 26 26 #include "qtouchwebview.h" 27 27 #include "qtouchwebview_p.h" 28 29 #include <QDeclarativeEngine> 30 #include <QSGView> 28 31 29 32 namespace WebKit { … … 129 132 } 130 133 131 void TouchViewInterface::loadDidFail(const Q WebError& error)134 void TouchViewInterface::loadDidFail(const QJSValue& error) 132 135 { 133 136 emit m_pageView->loadFailed(error); … … 159 162 } 160 163 164 QJSEngine* TouchViewInterface::engine() 165 { 166 QSGView* view = qobject_cast<QSGView*>(m_pageView->canvas()); 167 if (view) 168 return view->engine(); 169 return 0; 161 170 } 171 172 } -
trunk/Source/WebKit2/UIProcess/qt/TouchViewInterface.h
r94979 r95197 67 67 virtual void loadDidCommit(); 68 68 virtual void loadDidSucceed(); 69 virtual void loadDidFail(const Q WebError&);69 virtual void loadDidFail(const QJSValue&); 70 70 virtual void didChangeLoadProgress(int); 71 71 … … 75 75 virtual void processDidCrash(); 76 76 virtual void didRelaunchProcess(); 77 78 virtual QJSEngine* engine(); 77 79 78 80 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList&, FileChooserType) { } -
trunk/Source/WebKit2/UIProcess/qt/ViewInterface.h
r94979 r95197 27 27 #include <WebKit2/WKBase.h> 28 28 29 class QWebError;30 31 29 QT_BEGIN_NAMESPACE 32 30 class QCursor; 33 31 class QGraphicsWidget; 34 32 class QImage; 33 class QJSEngine; 34 class QJSValue; 35 35 class QMimeData; 36 36 class QPoint; … … 76 76 virtual void loadDidCommit() = 0; 77 77 virtual void loadDidSucceed() = 0; 78 virtual void loadDidFail(const Q WebError&) = 0;78 virtual void loadDidFail(const QJSValue&) = 0; 79 79 virtual void didChangeLoadProgress(int) = 0; 80 80 … … 85 85 virtual void didRelaunchProcess() = 0; 86 86 87 virtual QJSEngine* engine() = 0; 88 87 89 virtual void chooseFiles(WKOpenPanelResultListenerRef, const QStringList& selectedFileNames, FileChooserType) = 0; 88 90 };
Note: See TracChangeset
for help on using the changeset viewer.