summaryrefslogtreecommitdiff
path: root/qutebrowser
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 /qutebrowser
parent9d8c263e9a37a14474db659039c0890b334bc813 (diff)
downloadqutebrowser-c698091f55d9b92286fe7f48ed2304f00387f301.tar.gz
qutebrowser-c698091f55d9b92286fe7f48ed2304f00387f301.zip
Avoid calling DownloadItem.origin() if unneeded
See #7854
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/browser/downloads.py9
1 files changed, 7 insertions, 2 deletions
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).")