Don't show SSL error page for subresources
This commit is contained in:
parent
d93bc8b26b
commit
c6f83d3148
@ -137,16 +137,23 @@ class WebEnginePage(QWebEnginePage):
|
|||||||
'error.html', title="Error loading page: {}".format(url_string),
|
'error.html', title="Error loading page: {}".format(url_string),
|
||||||
url=url_string, error=str(error), icon='')
|
url=url_string, error=str(error), icon='')
|
||||||
|
|
||||||
if not error.is_overridable():
|
if error.is_overridable():
|
||||||
log.webview.error("Non-overridable certificate error: "
|
|
||||||
"{}".format(error))
|
|
||||||
self.setHtml(error_page)
|
|
||||||
return False
|
|
||||||
|
|
||||||
ignore = shared.ignore_certificate_errors(
|
ignore = shared.ignore_certificate_errors(
|
||||||
url, [error], abort_on=[self.loadStarted, self.shutting_down])
|
url, [error], abort_on=[self.loadStarted, self.shutting_down])
|
||||||
|
else:
|
||||||
|
log.webview.error("Non-overridable certificate error: "
|
||||||
|
"{}".format(error))
|
||||||
|
ignore = False
|
||||||
|
|
||||||
if not ignore:
|
# We can't really know when to show an error page, as the error might
|
||||||
|
# have happened when loading some resource.
|
||||||
|
# However, self.url() is not available yet and self.requestedUrl() might
|
||||||
|
# not match the URL we get from the error - so we just apply a heuristic
|
||||||
|
# here.
|
||||||
|
# See https://bugreports.qt.io/browse/QTBUG-56207
|
||||||
|
log.webview.debug("ignore {}, URL {}, requested {}".format(
|
||||||
|
ignore, url, self.requestedUrl()))
|
||||||
|
if not ignore and url.matches(self.requestedUrl(), QUrl.RemoveScheme):
|
||||||
self.setHtml(error_page)
|
self.setHtml(error_page)
|
||||||
|
|
||||||
return ignore
|
return ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user