From d70ad72cc42949104a4dca73eec521ef4ef65920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Thu, 21 Feb 2019 08:41:15 +0100 Subject: [PATCH] add error logs in browser web view --- src/web/browser/WBWebView.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/web/browser/WBWebView.h b/src/web/browser/WBWebView.h index 7a0fb20a..480bbf8d 100644 --- a/src/web/browser/WBWebView.h +++ b/src/web/browser/WBWebView.h @@ -95,6 +95,33 @@ class WBWebPage : public UBWebPage QWebPage *createWindow(QWebPage::WebWindowType type); QObject *createPlugin(const QString &classId, const QUrl &url, const QStringList ¶mNames, const QStringList ¶mValues); + bool supportsExtension(Extension extension) const { + if (extension == QWebPage::ErrorPageExtension) + { + return true; + } + return false; + } + + bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) + { + if (extension != QWebPage::ErrorPageExtension) + return false; + + ErrorPageExtensionOption *errorOption = (ErrorPageExtensionOption*) option; + qDebug() << "Error loading " << qPrintable(errorOption->url.toString()); + if(errorOption->domain == QWebPage::QtNetwork) + qDebug() << "Network error (" << errorOption->error << "): "; + else if(errorOption->domain == QWebPage::Http) + qDebug() << "HTTP error (" << errorOption->error << "): "; + else if(errorOption->domain == QWebPage::WebKit) + qDebug() << "WebKit error (" << errorOption->error << "): "; + + qDebug() << qPrintable(errorOption->errorString); + + return false; + } + private slots: void handleUnsupportedContent(QNetworkReply *reply);