From f8aec212c8df15d5e3062176430b804467dbb2c4 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 20 Jan 2020 20:07:23 +0100 Subject: [PATCH] Add workaround for missing per-domain setting changes Fixes #4920 --- doc/changelog.asciidoc | 2 ++ qutebrowser/browser/webengine/webenginetab.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 34c67e931..74caf52f1 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -56,6 +56,8 @@ Fixed - When quitting qutebrowser, components are now cleaned up differently. This should fix certain (rare) segmentation faults and exceptions when quitting, especially with the new exit scheme introduced in in PyQt5 5.13.1. +- Added a workaround for per-domain settings (e.g. a JavaScript whitelist) not + being applied in some scenarios with Qt 5.13 and above. v1.9.0 (2020-01-08) ------------------- diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 0a41bc9ba..481fb113a 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -1490,6 +1490,21 @@ class WebEngineTab(browsertab.AbstractTab): except browsertab.WebTabError as e: message.error(str(e)) + @pyqtSlot(QUrl) + def _on_url_changed(self, url: QUrl) -> None: + """Update settings for the current URL. + + Normally this is done below in _on_navigation_request, but we also need + to do it here as WORKAROUND for + https://bugreports.qt.io/browse/QTBUG-77137 + + Since update_for_url() is idempotent, it doesn't matter much if we end + up doing it twice. + """ + super()._on_url_changed(url) + if url.isValid() and qtutils.version_check('5.13'): + self.settings.update_for_url(url) + @pyqtSlot(usertypes.NavigationRequest) def _on_navigation_request(self, navigation): super()._on_navigation_request(navigation)