summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2025-10-23 00:21:41 +0200
committerMichal Klocek <michal.klocek@qt.io>2025-11-27 09:56:57 +0100
commit290734db582235bae9b2cd41ca1d205c28d12db9 (patch)
treef7552211f9406347e3758d6832002bd8eb912702 /src
parent1b74fbaba2219ba97b35257e88ab76ef7633d40a (diff)
Cleanup. Remove null inteface
Running webview wihout plugin should be simply fatal. Task-number: QTBUG-131837 Change-Id: I223a64e7aad98d8bf1f81a3b71af2effcce454f6 Reviewed-by: Moss Heim <moss.heim@qt.io> Reviewed-by: Kaloyan Chehlarski <kaloyan.chehlarski@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webview/qwebviewfactory.cpp59
1 files changed, 1 insertions, 58 deletions
diff --git a/src/webview/qwebviewfactory.cpp b/src/webview/qwebviewfactory.cpp
index 8a2d6b1..f4a2b15 100644
--- a/src/webview/qwebviewfactory.cpp
+++ b/src/webview/qwebviewfactory.cpp
@@ -19,62 +19,6 @@ static QString getPluginName()
return name;
}
-class QNullWebViewSettings : public QAbstractWebViewSettings
-{
-public:
- explicit QNullWebViewSettings(QObject *p) : QAbstractWebViewSettings(p) {}
- bool localStorageEnabled() const override { return false; }
- bool javaScriptEnabled() const override { return false; }
- bool localContentCanAccessFileUrls() const override { return false; }
- bool allowFileAccess() const override { return false; }
- void setLocalContentCanAccessFileUrls(bool) override {}
- void setJavaScriptEnabled(bool) override {}
- void setLocalStorageEnabled(bool) override {}
- void setAllowFileAccess(bool) override {}
-};
-
-class QNullWebView : public QAbstractWebView
-{
-public:
- explicit QNullWebView(QObject *p = nullptr)
- : QAbstractWebView(p)
- , m_settings(new QNullWebViewSettings(this))
- {}
-
- QString httpUserAgent() const override { return QString(); }
- void setHttpUserAgent(const QString &userAgent) override { Q_UNUSED(userAgent); }
- QUrl url() const override { return QUrl(); }
- void setUrl(const QUrl &url) override { Q_UNUSED(url); }
- bool canGoBack() const override { return false; }
- bool canGoForward() const override { return false; }
- QString title() const override { return QString(); }
- int loadProgress() const override { return 0; }
- bool isLoading() const override { return false; }
- void goBack() override { }
- void goForward() override { }
- void stop() override { }
- void reload() override { }
- void loadHtml(const QString &html, const QUrl &baseUrl) override
- { Q_UNUSED(html); Q_UNUSED(baseUrl); }
- void runJavaScriptPrivate(const QString &script, int callbackId) override
- { Q_UNUSED(script); Q_UNUSED(callbackId); }
- void setCookie(const QString &domain, const QString &name, const QString &value) override
- { Q_UNUSED(domain); Q_UNUSED(name); Q_UNUSED(value); }
- void deleteCookie(const QString &domain, const QString &name) override
- { Q_UNUSED(domain); Q_UNUSED(name); }
- void deleteAllCookies() override {}
- QWindow *nativeWindow() const override { return nullptr; }
-
-protected:
- QAbstractWebViewSettings *settings() const override
- {
- return m_settings;
- }
-
-private:
- QNullWebViewSettings *m_settings = nullptr;
-};
-
QAbstractWebView *QWebViewFactory::createWebView()
{
QAbstractWebView *wv = nullptr;
@@ -83,8 +27,7 @@ QAbstractWebView *QWebViewFactory::createWebView()
wv = plugin->create(QStringLiteral("webview"));
if (!wv || !plugin) {
- qWarning("No WebView plug-in found!");
- wv = new QNullWebView;
+ qFatal("No WebView plug-in found!");
}
return wv;