diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-10-18 10:14:01 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-11-22 15:32:31 +0100 |
commit | 86800c93aecefb543c8576a310da285342d34a5f (patch) | |
tree | 9a4354448d97a776e17e9cdf3b0b08bf41901c07 | |
parent | 3a89e6a368d9574efaba9a2ee3a18cbaa54c8993 (diff) | |
download | qutebrowser-86800c93aecefb543c8576a310da285342d34a5f.tar.gz qutebrowser-86800c93aecefb543c8576a310da285342d34a5f.zip |
Fix crash with empty conf.colors.webpage.bg on QtWebKit
(cherry picked from commit 7eee69845348e7f39930ac3a2fa4330136334566)
(cherry picked from commit a33770d50e1dad2f5b453a69cb00a2f5190ee8a7)
-rw-r--r-- | doc/changelog.asciidoc | 2 | ||||
-rw-r--r-- | qutebrowser/browser/webkit/webview.py | 2 | ||||
-rw-r--r-- | tests/unit/browser/webkit/test_webview.py | 32 | ||||
-rw-r--r-- | tox.ini | 5 |
4 files changed, 39 insertions, 2 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index fcf3d4718..01d80fd83 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -38,6 +38,8 @@ Fixed - Errors while reading the state file are now displayed instead of causing a crash. - Crash when using `:debug-log-level` without a console attached. +- Downloads are now hidden properly when the browser is in fullscreen mode. +- Crash when setting `colors.webpage.bg` to an empty value with QtWebKit. v1.8.1 (2019-09-27) ------------------- diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index 54258f1a8..086a43aca 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -51,7 +51,9 @@ class WebView(QWebView): STYLESHEET = """ WebView { + {% if conf.colors.webpage.bg %} background-color: {{ qcolor_to_qsscolor(conf.colors.webpage.bg) }}; + {% endif %} } """ diff --git a/tests/unit/browser/webkit/test_webview.py b/tests/unit/browser/webkit/test_webview.py new file mode 100644 index 000000000..3b0b9d98f --- /dev/null +++ b/tests/unit/browser/webkit/test_webview.py @@ -0,0 +1,32 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. + +import pytest +webview = pytest.importorskip('qutebrowser.browser.webkit.webview') + + +@pytest.fixture +def real_webview(webkit_tab, qtbot): + wv = webview.WebView(win_id=0, tab_id=0, tab=webkit_tab, private=False) + qtbot.add_widget(wv) + return wv + + +def test_background_color_none(config_stub, real_webview): + config_stub.val.colors.webpage.bg = None @@ -193,14 +193,15 @@ commands = eslint --color --report-unused-disable-directives . [testenv:mypy] basepython = {env:PYTHON:python3} -passenv = +passenv = TERM deps = -r{toxinidir}/requirements.txt -r{toxinidir}/misc/requirements/requirements-dev.txt + -r{toxinidir}/misc/requirements/requirements-tests.txt -r{toxinidir}/misc/requirements/requirements-pyqt.txt -r{toxinidir}/misc/requirements/requirements-mypy.txt commands = - {envpython} -m mypy qutebrowser {posargs} + {envpython} -m mypy qutebrowser tests {posargs} [testenv:sphinx] basepython = {env:PYTHON:python3} |