parent
5eeb89ec86
commit
4e6cedb1f7
@ -117,16 +117,21 @@ class BrowserPage(QWebPage):
|
||||
info.error))
|
||||
return False
|
||||
else:
|
||||
self._ignore_load_started = True
|
||||
self.error_occured = True
|
||||
error_str = info.errorString
|
||||
if error_str == networkmanager.HOSTBLOCK_ERROR_STRING:
|
||||
error_str = "Request blocked by host blocker."
|
||||
# we don't set error_occured in this case.
|
||||
else:
|
||||
self._ignore_load_started = True
|
||||
self.error_occured = True
|
||||
log.webview.error("Error while loading {}: {}".format(
|
||||
urlstr, info.errorString))
|
||||
urlstr, error_str))
|
||||
log.webview.debug("Error domain: {}, error code: {}".format(
|
||||
info.domain, info.error))
|
||||
title = "Error loading page: {}".format(urlstr)
|
||||
template = jinja.env.get_template('error.html')
|
||||
html = template.render( # pylint: disable=maybe-no-member
|
||||
title=title, url=urlstr, error=info.errorString, icon='')
|
||||
title=title, url=urlstr, error=error_str, icon='')
|
||||
errpage.content = html.encode('utf-8')
|
||||
errpage.encoding = 'utf-8'
|
||||
return True
|
||||
|
@ -35,6 +35,9 @@ from qutebrowser.network import qutescheme, networkreply
|
||||
from qutebrowser.browser import cookies
|
||||
|
||||
|
||||
HOSTBLOCK_ERROR_STRING = '%HOSTBLOCK%'
|
||||
|
||||
|
||||
class NetworkManager(QNetworkAccessManager):
|
||||
|
||||
"""Our own QNetworkAccessManager.
|
||||
@ -228,8 +231,8 @@ class NetworkManager(QNetworkAccessManager):
|
||||
log.webview.info("Request to {} blocked by host blocker.".format(
|
||||
req.url().host()))
|
||||
return networkreply.ErrorNetworkReply(
|
||||
req, "Request was blocked by host blocker.",
|
||||
QNetworkReply.ContentAccessDenied, self)
|
||||
req, HOSTBLOCK_ERROR_STRING, QNetworkReply.ContentAccessDenied,
|
||||
self)
|
||||
if config.get('network', 'do-not-track'):
|
||||
dnt = '1'.encode('ascii')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user