summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-26 21:00:06 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-26 21:01:46 (GMT)
commit15382290683dfa469e64574b18ee6598d37433bb (patch)
tree9e384857065d52da024d6236038dc544c3a2eaa2
parent12ae11d144f713662d2a3ea6f49b97f03436e236 (diff)
Block other object type
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
index 390d7be..6ac5d53 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
@@ -35,22 +35,27 @@ BlockExternalResourcesUrlInterceptor::~BlockExternalResourcesUrlInterceptor()
bool BlockExternalResourcesUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
- const QWebEngineUrlRequestInfo::ResourceType type = info.resourceType();
- if (type == QWebEngineUrlRequestInfo::ResourceTypeMedia ||
- type == QWebEngineUrlRequestInfo::ResourceTypePing ||
- type == QWebEngineUrlRequestInfo::ResourceTypePrefetch ||
- type == QWebEngineUrlRequestInfo::ResourceTypeFavicon ||
- type == QWebEngineUrlRequestInfo::ResourceTypeXhr ||
+ const QWebEngineUrlRequestInfo::ResourceType resourceType = info.resourceType();
+ const QWebEngineUrlRequestInfo::NavigationType navigationType = info.navigationType();
+ if (resourceType == QWebEngineUrlRequestInfo::ResourceTypeMedia ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypePing ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypePrefetch ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeFavicon ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeXhr ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeObject ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeScript ||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
- type == QWebEngineUrlRequestInfo::ResourceTypePluginResource ||
- type == QWebEngineUrlRequestInfo::ResourceTypeCspReport ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypePluginResource ||
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeCspReport ||
#endif
- type == QWebEngineUrlRequestInfo::ResourceTypeUnknown
- ) {
+ resourceType == QWebEngineUrlRequestInfo::ResourceTypeUnknown) {
return true;
- } else if (info.navigationType() == QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted) {
+ } else if (navigationType == QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted) {
Q_EMIT formSubmittedForbidden();
return true;
+ } else if (navigationType == QWebEngineUrlRequestInfo::NavigationTypeReload ||
+ navigationType == QWebEngineUrlRequestInfo::NavigationTypeTyped) {
+ return true;
}
return false;
}