Guest User

Untitled

a guest
Jan 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. diff --git a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
  2. index 51ecbd4..128a097 100644
  3. --- a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
  4. +++ b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.cpp
  5. @@ -24,9 +24,11 @@
  6.  
  7. #include <QGraphicsSceneResizeEvent>
  8. #include <QStyleOptionGraphicsItem>
  9. +#include <QtDeclarative/qdeclarativeengine.h>
  10. #include <QtDeclarative/qsgcanvas.h>
  11. #include <QtDeclarative/qsgevent.h>
  12. #include <QtDeclarative/qsgitem.h>
  13. +#include <QtDeclarative/qsgview.h>
  14. #include <QtGui/QCursor>
  15. #include <QtGui/QFocusEvent>
  16. #include <QtGui/QGraphicsSceneEvent>
  17. @@ -36,6 +38,8 @@
  18. #include <QtGui/QTouchEvent>
  19. #include <QtGui/QWheelEvent>
  20.  
  21. +#include <QDebug>
  22. +
  23. QDesktopWebViewPrivate::QDesktopWebViewPrivate(QDesktopWebView* q, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
  24. : q(q)
  25. , page(this, contextRef, pageGroupRef)
  26. @@ -142,7 +146,14 @@ void QDesktopWebViewPrivate::loadDidSucceed()
  27.  
  28. void QDesktopWebViewPrivate::loadDidFail(const QWebError& error)
  29. {
  30. - emit q->loadFailed(error);
  31. + QSGView* view = qobject_cast<QSGView*>(q->canvas());
  32. + QJSValue value;
  33. + if (view) {
  34. + value = view->engine()->newObject();
  35. + value.setProperty(QLatin1String("errorCode"), true);
  36. + value.setProperty(QLatin1String("type"), error.type());
  37. + }
  38. + emit q->loadFailed(value);
  39. }
  40.  
  41. void QDesktopWebViewPrivate::didChangeLoadProgress(int percentageLoaded)
  42. diff --git a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
  43. index 034c216..616d070 100644
  44. --- a/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
  45. +++ b/Source/WebKit2/UIProcess/API/qt/qdesktopwebview.h
  46. @@ -80,7 +80,8 @@ Q_SIGNALS:
  47. void statusBarMessageChanged(const QString&);
  48. void loadStarted();
  49. void loadSucceeded();
  50. - void loadFailed(const QWebError&);
  51. + // The parameter needs to be explicitly named to work in QML.
  52. + void loadFailed(const QJSValue& error);
  53. void loadProgressChanged(int progress);
  54. void urlChanged(const QUrl&);
Add Comment
Please, Sign In to add comment