summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-12-05 14:31:58 +0100
committerFlorian Bruhin <me@the-compiler.org>2023-12-05 14:31:58 +0100
commitc698091f55d9b92286fe7f48ed2304f00387f301 (patch)
treee771c99aedd3930a76d399e2b9e5892d7688d89b
parent9d8c263e9a37a14474db659039c0890b334bc813 (diff)
downloadqutebrowser-c698091f55d9b92286fe7f48ed2304f00387f301.tar.gz
qutebrowser-c698091f55d9b92286fe7f48ed2304f00387f301.zip
Avoid calling DownloadItem.origin() if unneeded
See #7854
-rw-r--r--doc/changelog.asciidoc2
-rw-r--r--qutebrowser/browser/downloads.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc
index bb424242f..98a10ad48 100644
--- a/doc/changelog.asciidoc
+++ b/doc/changelog.asciidoc
@@ -53,6 +53,8 @@ Fixed
- Added an elaborate workaround for a bug in QtWebEngine 6.6.0 causing crashes
on Google Mail/Meet/Chat, and a bug in QtWebEngine 6.5.0/.1/.2 causing crashes
there with dark mode.
+- Made a rare crash in QtWebEngine when starting/retrying a download less likely
+ to happen.
- Graphical glitches in Google sheets and PDF.js, again. Removed the version
restriction for the default application of
`qt.workarounds.disable_accelerated_2d_canvas` as the issue was still
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py
index 9525c0618..28f20b0ef 100644
--- a/qutebrowser/browser/downloads.py
+++ b/qutebrowser/browser/downloads.py
@@ -817,8 +817,13 @@ class AbstractDownloadItem(QObject):
- file:// downloads from file:// URLs (open the file instead)
- http:// downloads from https:// URLs (mixed content)
"""
- origin = self.origin()
url = self.url()
+ if url.scheme() not in ["file", "http"]:
+ # WORKAROUND to avoid calling self.origin() if unneeded:
+ # https://github.com/qutebrowser/qutebrowser/issues/7854
+ return False
+
+ origin = self.origin()
if not origin.isValid():
return False
@@ -828,7 +833,7 @@ class AbstractDownloadItem(QObject):
return True
if (url.scheme() == "http" and
- origin.isValid() and origin.scheme() == "https" and
+ origin.scheme() == "https" and
config.instance.get("downloads.prevent_mixed_content", url=origin)):
self._die("Aborting insecure download from secure page "
"(see downloads.prevent_mixed_content).")