parent
1bf82bcf70
commit
9875bae124
|
|
@ -0,0 +1,23 @@
|
|||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# qutebrowser is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""Utilities related to Qt classes."""
|
||||
|
||||
# pylint: disable=unused-import
|
||||
from qutebrowser.utils.qtutils import ensure_valid
|
||||
|
|
@ -150,6 +150,11 @@ class RequestInterceptor(QWebEngineUrlRequestInterceptor):
|
|||
|
||||
url = info.requestUrl()
|
||||
first_party = info.firstPartyUrl()
|
||||
if not url.isValid():
|
||||
log.webview.debug("Ignoring invalid intercepted URL: {}".format(
|
||||
url.errorString()))
|
||||
return
|
||||
|
||||
# Per QWebEngineUrlRequestInfo::ResourceType documentation, if we fail
|
||||
# our lookup, we should fall back to ResourceTypeUnknown
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import pathlib
|
|||
from PyQt5.QtCore import QUrl
|
||||
|
||||
from qutebrowser.api import (cmdutils, hook, config, message, downloads,
|
||||
interceptor, apitypes)
|
||||
interceptor, apitypes, qtutils)
|
||||
|
||||
|
||||
logger = logging.getLogger('misc')
|
||||
|
|
@ -114,6 +114,8 @@ class HostBlocker:
|
|||
if first_party_url is not None and not first_party_url.isValid():
|
||||
first_party_url = None
|
||||
|
||||
qtutils.ensure_valid(request_url)
|
||||
|
||||
if not config.get('content.host_blocking.enabled',
|
||||
url=first_party_url):
|
||||
return False
|
||||
|
|
|
|||
Loading…
Reference in New Issue