Commit 1297707f authored by Laurent Montel's avatar Laurent Montel 😁

Don't call all interceptor if we block it

parent 7a25c61a
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.2.46")
set(MESSAGELIB_LIB_VERSION "5.2.47")
set(KF5_VERSION "5.19.0")
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -44,14 +44,15 @@ LoadExternalReferencesUrlInterceptor::~LoadExternalReferencesUrlInterceptor()
delete d;
}
void LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
bool LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
if (!d->mAllowLoadExternalReference) {
//TODO add more resource type
if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeImage && !info.requestUrl().isLocalFile()) {
info.block(true);
return true;
}
}
return false;
}
void LoadExternalReferencesUrlInterceptor::setAllowExternalContent(bool b)
......
......@@ -30,7 +30,7 @@ public:
explicit LoadExternalReferencesUrlInterceptor(QObject *parent = Q_NULLPTR);
~LoadExternalReferencesUrlInterceptor();
void interceptRequest(QWebEngineUrlRequestInfo &info) Q_DECL_OVERRIDE;
bool interceptRequest(QWebEngineUrlRequestInfo &info) Q_DECL_OVERRIDE;
void setAllowExternalContent(bool b);
bool allowExternalContent() const;
private:
......
......@@ -35,7 +35,7 @@ public:
virtual void createActions(KActionCollection *ac);
virtual QList<QAction *> actions() const;
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
virtual bool interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
};
}
#endif // MAILNETWORKPLUGINURLINTERCEPTORINTERFACE_H
......@@ -47,7 +47,10 @@ void NetworkUrlInterceptorPrivate::addInterceptor(NetworkPluginUrlInterceptorInt
void NetworkUrlInterceptorPrivate::interceptRequest(QWebEngineUrlRequestInfo &info)
{
Q_FOREACH (NetworkPluginUrlInterceptorInterface *inter, listInterceptor) {
inter->interceptRequest(info);
if (inter->interceptRequest(info)) {
info.block(true);
break;
}
}
}
......
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