From fc17444438ea70c1762b5927eac7ec02ef5bcc7c Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 30 Mar 2016 13:23:19 +0200 Subject: [PATCH] GM: Don't try to install userscripts from XHR See #1903 --- src/plugins/GreaseMonkey/gm_urlinterceptor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp b/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp index 81858a8a1..833e9c358 100644 --- a/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp +++ b/src/plugins/GreaseMonkey/gm_urlinterceptor.cpp @@ -26,7 +26,10 @@ GM_UrlInterceptor::GM_UrlInterceptor(GM_Manager *manager) 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; if (info.requestUrl().toString().endsWith(QLatin1String(".user.js"))) { @@ -34,3 +37,4 @@ void GM_UrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) info.block(true); } } +