From c698091f55d9b92286fe7f48ed2304f00387f301 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 5 Dec 2023 14:31:58 +0100 Subject: Avoid calling DownloadItem.origin() if unneeded See #7854 --- doc/changelog.asciidoc | 2 ++ qutebrowser/browser/downloads.py | 9 +++++++-- 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).") -- cgit v1.2.3-54-g00ecf