1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

GM: Don't try to install userscripts from XHR

See #1903
This commit is contained in:
David Rosca 2016-03-30 13:23:19 +02:00
parent bd75853929
commit fc17444438

View File

@ -26,7 +26,10 @@ GM_UrlInterceptor::GM_UrlInterceptor(GM_Manager *manager)
void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{ {
if (info.navigationType() != QWebEngineUrlRequestInfo::NavigationTypeLink) bool xhr = info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeXhr;
bool clickedLink = info.navigationType() == QWebEngineUrlRequestInfo::NavigationTypeLink;
if (xhr || !clickedLink)
return; return;
if (info.requestUrl().toString().endsWith(QLatin1String(".user.js"))) { if (info.requestUrl().toString().endsWith(QLatin1String(".user.js"))) {
@ -34,3 +37,4 @@ void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
info.block(true); info.block(true);
} }
} }