Commit 2ffcd62f authored by Laurent Montel's avatar Laurent Montel
Browse files

Allow to disable interceptor

parent 1a302345
Pipeline #56628 passed with stage
in 42 minutes and 22 seconds
...@@ -16,10 +16,18 @@ BlockExternalResourcesUrlInterceptor::~BlockExternalResourcesUrlInterceptor() ...@@ -16,10 +16,18 @@ BlockExternalResourcesUrlInterceptor::~BlockExternalResourcesUrlInterceptor()
{ {
} }
void BlockExternalResourcesUrlInterceptor::setEnabled(bool enabled)
{
mEnabled = enabled;
}
bool BlockExternalResourcesUrlInterceptor::interceptRequest(const QUrl &url, bool BlockExternalResourcesUrlInterceptor::interceptRequest(const QUrl &url,
QWebEngineUrlRequestInfo::ResourceType resourceType, QWebEngineUrlRequestInfo::ResourceType resourceType,
QWebEngineUrlRequestInfo::NavigationType navigationType) QWebEngineUrlRequestInfo::NavigationType navigationType)
{ {
if (!mEnabled) {
return false;
}
const QString scheme = url.scheme(); const QString scheme = url.scheme();
if (scheme == QLatin1String("data") || scheme == QLatin1String("file")) { if (scheme == QLatin1String("data") || scheme == QLatin1String("file")) {
return false; return false;
......
...@@ -22,7 +22,11 @@ public: ...@@ -22,7 +22,11 @@ public:
// Used by autotest only // Used by autotest only
Q_REQUIRED_RESULT bool Q_REQUIRED_RESULT bool
interceptRequest(const QUrl &url, QWebEngineUrlRequestInfo::ResourceType resourceType, QWebEngineUrlRequestInfo::NavigationType navigationType); interceptRequest(const QUrl &url, QWebEngineUrlRequestInfo::ResourceType resourceType, QWebEngineUrlRequestInfo::NavigationType navigationType);
void setEnabled(bool enabled);
Q_SIGNALS: Q_SIGNALS:
void formSubmittedForbidden(); void formSubmittedForbidden();
private:
bool mEnabled = true;
}; };
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment