diff options
author | Jay Kamat <jaygkamat@gmail.com> | 2019-03-17 23:36:46 -0700 |
---|---|---|
committer | Jay Kamat <jaygkamat@gmail.com> | 2019-03-17 23:36:46 -0700 |
commit | 4829a83fdec30f4cc9997023d420f3725c064f63 (patch) | |
tree | 49cbac26adb30b4a0d742fdead01cf1cfd83513c | |
parent | c4d254b59f223186c619a9d4c2e47b42d9fa54e2 (diff) | |
parent | 158b3be6ce48532b65457b17b7066850d16f6612 (diff) | |
download | qutebrowser-4829a83fdec30f4cc9997023d420f3725c064f63.tar.gz qutebrowser-4829a83fdec30f4cc9997023d420f3725c064f63.zip |
Merge branch 'master' of https://github.com/qutebrowser/qutebrowser into jay/keys-unneeeded-code
415 files changed, 1363 insertions, 879 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 92a20c0bd..42baac6c9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -5,15 +5,15 @@ cache: build: off environment: PYTHONUNBUFFERED: 1 - PYTHON: C:\Python36-x64\python.exe + PYTHON: C:\Python37-x64\python.exe matrix: - - TESTENV: py36-pyqt511 + - TESTENV: py37-pyqt512 - TESTENV: pylint install: - '%PYTHON% -m pip install -U pip' - '%PYTHON% -m pip install -r misc\requirements\requirements-tox.txt' - - 'set PATH=C:\Python36-x64;%PATH' + - 'set PATH=C:\Python37-x64;%PATH' test_script: - '%PYTHON% -m tox -e %TESTENV%' @@ -46,12 +46,11 @@ ignore = min-version = 3.4.0 max-complexity = 12 per-file-ignores = - /qutebrowser/api/hook.py : N801 - /tests/**/*.py : D100,D101,D401 - /tests/unit/browser/test_history.py : N806 - /tests/helpers/fixtures.py : N806 - /tests/unit/browser/webkit/http/test_content_disposition.py : D400 - /scripts/dev/ci/appveyor_install.py : FI53 + qutebrowser/api/hook.py : N801 + tests/* : D100,D101 + tests/unit/browser/test_history.py : D100,D101,N806 + tests/helpers/fixtures.py : D100,D101,N806 + tests/unit/browser/webkit/http/test_content_disposition.py : D100,D101,D400 copyright-check = True copyright-regexp = # Copyright [\d-]+ .* copyright-min-file-size = 110 diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md index 56566849d..5e86b9a76 100644 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.md @@ -6,7 +6,7 @@ about: Report errors and problems **Version info (see `:version`)**: -**Does the bug happen if you start with `--temp-basedir`?** (if applicable): +**Does the bug happen if you start with `--temp-basedir`?**: **Description** diff --git a/.travis.yml b/.travis.yml index dfa566671..f0959d2a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,55 +1,87 @@ dist: xenial language: python group: edge -python: 3.6 +python: 3.7 os: linux matrix: + fast_finish: true include: + ### Archlinux QtWebKit - env: DOCKER=archlinux services: docker + + ### Archlinux QtWebEngine - env: DOCKER=archlinux-webengine QUTE_BDD_WEBENGINE=true services: docker - - env: TESTENV=py36-pyqt571 + + ### PyQt 5.7.1 (Python 3.5) - python: 3.5 env: TESTENV=py35-pyqt571 - - env: TESTENV=py36-pyqt59 - - env: TESTENV=py36-pyqt510 + ### PyQt 5.7.1 (Python 3.6) + - python: 3.6 + env: TESTENV=py36-pyqt571 + + ### PyQt 5.9 + - env: TESTENV=py37-pyqt59 + + ### PyQt 5.10 + - env: TESTENV=py37-pyqt510 addons: apt: packages: - xfonts-base - - env: TESTENV=py36-pyqt511-cov - - python: 3.7 - env: TESTENV=py37-pyqt511 + + ### PyQt 5.11 + - env: TESTENV=py37-pyqt511 + + ### PyQt 5.12 (Python 3.7, with coverage) + - env: TESTENV=py37-pyqt512-cov + # http://code.qt.io/cgit/qt/qtbase.git/commit/?id=c3a963da1f9e7b1d37e63eedded61da4fbdaaf9a + addons: + apt: + packages: + - libxkbcommon-x11-0 + + ### macOS sierra - os: osx - env: TESTENV=py37 OSX=sierra + env: TESTENV=py37-pyqt512 OSX=sierra osx_image: xcode9.2 language: generic + ### macOS yosemite # https://github.com/qutebrowser/qutebrowser/issues/2013 # - os: osx # env: TESTENV=py35 OSX=yosemite # osx_image: xcode6.4 + + ### pylint/flake8/mypy - env: TESTENV=pylint - env: TESTENV=flake8 - env: TESTENV=mypy + + ### docs - env: TESTENV=docs addons: apt: packages: - asciidoc + + ### vulture/misc/pyroma/check-manifest - env: TESTENV=vulture - env: TESTENV=misc - env: TESTENV=pyroma - env: TESTENV=check-manifest + + ### eslint - env: TESTENV=eslint language: node_js python: null node_js: "lts/*" + + ### shellcheck - language: generic env: TESTENV=shellcheck services: docker - fast_finish: true cache: directories: diff --git a/MANIFEST.in b/MANIFEST.in index cd9e50cf9..49b1a383b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,8 +12,8 @@ recursive-include scripts *.py *.sh *.js include qutebrowser/utils/testfile include qutebrowser/git-commit-id include LICENSE doc/* README.asciidoc -include misc/qutebrowser.desktop -include misc/qutebrowser.appdata.xml +include misc/org.qutebrowser.qutebrowser.desktop +include misc/org.qutebrowser.qutebrowser.appdata.xml include misc/Makefile include requirements.txt include tox.ini diff --git a/README.asciidoc b/README.asciidoc index b2d882eae..334c0561e 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -97,7 +97,7 @@ Requirements The following software and libraries are required to run qutebrowser: * https://www.python.org/[Python] 3.5 or newer (3.6 recommended) -* https://www.qt.io/[Qt] 5.7.1 or newer (5.11 recommended, support for < 5.9 +* https://www.qt.io/[Qt] 5.7.1 or newer (5.12 recommended, support for < 5.9 will be dropped soon) with the following modules: - QtCore / qtbase - QtQuick (part of qtbase in some distributions) @@ -108,7 +108,7 @@ The following software and libraries are required to run qutebrowser: only the link:https://github.com/annulen/webkit/wiki[updated fork] (5.212) is supported * https://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.7.0 or newer - (5.11 recommended, support for < 5.9 will be dropped soon) for Python 3 + (5.12 recommended, support for < 5.9 will be dropped soon) for Python 3 * https://pypi.python.org/pypi/setuptools/[pkg_resources/setuptools] * https://fdik.org/pyPEG/[pyPEG2] * http://jinja.pocoo.org/[jinja2] diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index a116b53e6..6701779ca 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -15,31 +15,66 @@ breaking changes (such as renamed commands) can happen in minor releases. // `Fixed` for any bug fixes. // `Security` to invite users to upgrade in case of vulnerabilities. -v1.6.0 (unreleased) +v1.7.0 (unreleased) ------------------- Added ~~~~~ -- New `tabs.new_position.stacking` setting which controls whether new tabs - opened from a page should stack on each other or not. -- New `completion.open_categories` setting which allows to configure which - categories are shown in the `:open` completion, and how they are ordered. -- New `tabs.pinned.frozen` setting to allow/deny navigating in pinned tabs. +Changed +~~~~~~~ + +- The desktop file `qutebrowser.desktop` is now renamed to + `org.qutebrowser.qutebrowser.desktop`. +- Pinned tabs now always show a favicon (even if the site doesn't provide one) + when shrinking. + +Fixed +~~~~~ + +v1.6.0 +------ + +Added +~~~~~ + +- New settings: + * `tabs.new_position.stacking` which controls whether new tabs opened from a + page should stack on each other or not. + * `completion.open_categories` which allows to configure which categories are + shown in the `:open` completion, and how they are ordered. + * `tabs.pinned.frozen` to allow/deny navigating in pinned tabs. + * `hints.selectors` which allows to configure what CSS selectors are used for + hints, and also allows adding custom hint groups. + * `input.insert_mode.leave_on_load` to turn off leaving insert mode when a + new page is loaded. - New config manipulation commands: * `:config-dict-add` and `:config-list-add` to a new element to a dict/list setting. * `:config-dict-remove` and `:config-list-remove` to remove an element from a dict/list setting. -- New `hints.selectors` setting which allows to configure what CSS selectors - are used for hints, and also allows adding custom hint groups. - New `:yank markdown` feature which yanks the current URL and title in markdown format. +- Support for new QtWebEngine features in Qt 5.12: + * Basic support for client certificates. Selecting the certificate to use + when there are multiple matching certificates isn't implemented yet. + * Support for DNS prefetching (plus new `content.dns_prefetch` setting). Changed ~~~~~~~ -- `:q` now closes current window instead of quitting qutebrowser completely +- Various changes to the Windows and macOS builds: + * Bundling Qt 5.12.1, based on Chromium 69.0.3497.128 with security fixes up + to 71.0.3578.94. + * Windows: A 32-bit build is available again. + * Windows: The builds now bundle the Universal CRT DLLs, causing them to work + on earlier versions of Windows 10. + * macOS: Support for OS X 10.11 El Capitan was dropped, requiring macOS 10.12 + Sierra or newer. + * macOS: The IPC socket path used to communicate with existing instances + changed due to changes in Qt 5.12. Please make sure to quit qutebrowser + before upgrading. +- `:q` now closes the current window instead of quitting qutebrowser completely (`:close`), while `:qa` quits (`:quit`). The behavior of `:wq` remains unchanged (`:quit --save`), as closing a window while saving the session doesn't make sense. @@ -55,6 +90,17 @@ Changed - The Wayland check for QtWebEngine is now disabled on Qt >= 5.11.2, as those versions should work without any issues. - The JavaScript `console` object is now available in PAC files. +- PAC proxies currently don't work properly on QtWebEngine (and never did), so + an error is now shown when trying to configure a PAC proxy. +- The metainfo file `qutebrowser.appdata.xml` is now renamed to + `org.qutebrowser.qutebrowser.appdata.xml`. +- The `qute-pass` userscript now understands domains in gpg filenames + in addition to directory names. +- The autocompletion for `content.headers.user_agent` got updated to only + include the default and Chrome, as setting the UA to Firefox has various + bad side-effects. +- Combining Qt 5.12 with an older PyQt can lead to issues, so a warning is + now shown when starting qutebrowser with that combination. Fixed ~~~~~ @@ -69,12 +115,28 @@ Fixed `content.cookies.accept = no-3rdparty` from working properly on some pages like GMail. However, the default for `content.cookies.accept` is still `all` to be in line with what other browsers do. -- `:navigate` not incrementing in anchors or queries or anchors. +- `:navigate` not incrementing in anchors or queries. - Crash when trying to use a proxy requiring authentication with QtWebKit. - Slashes in search terms are now percent-escaped. - When `scrolling.bar = True` was set in versions before v1.5.0, this now correctly gets migrated to `always` instead of `when-searching`. - Completion highlighting now works again on Qt 5.11.3 and 5.12.1. +- The non-standard header `X-Do-Not-Track` is no longer sent. +- PAC proxies were never correctly supported with QtWebEngine, but are now + explicitly disallowed. +- macOS: Context menus for download items now show in the correct macOS style. +- Issues with fullscreen handling when exiting a video player. +- Various fixes for Qt 5.12 issues: + * A javascript error on page load was fixed. + * `window.print()` works with Qt 5.12 now. + * Fixed handling of duplicate download filenames. + * Fixed broken `qute://history` page. + * Fixed PDF.js not working properly. + * The download button in PDF.js now works (it's not possible to make + it work with earlier Qt versions). + * Since Greasemonkey scripts modifying the DOM fail when being run at + document-start, some known-broken scripts (Iridium, userstyles.org) are now + forced to run at document-end. v1.5.2 ------ @@ -374,11 +436,11 @@ v1.3.3 Security ~~~~~~~~ -- An XSS vulnerability on the `qute://history` page allowed websites to inject - HTML into the page via a crafted title tag. This could allow them to steal - your browsing history. If you're currently unable to upgrade, avoid using - `:history`. A CVE request for this issue is pending, see - https://github.com/qutebrowser/qutebrowser/issues/4011[#4011] for updates. +- CVE-2018-1000559: An XSS vulnerability on the `qute://history` page allowed + websites to inject HTML into the page via a crafted title tag. This could + allow them to steal your browsing history. If you're currently unable to + upgrade, avoid using `:history`. See the related GitHub issue for details: + https://github.com/qutebrowser/qutebrowser/issues/4011. Fixed ~~~~~ diff --git a/doc/contributing.asciidoc b/doc/contributing.asciidoc index dc52dd9a0..c0aeea17d 100644 --- a/doc/contributing.asciidoc +++ b/doc/contributing.asciidoc @@ -608,7 +608,7 @@ Style conventions ----------------- qutebrowser's coding conventions are based on -http://legacy.python.org/dev/peps/pep-0008/[PEP8] and the https://google-styleguide.googlecode.com/svn/trunk/pyguide.html[Google Python style guidelines] with some additions: +http://legacy.python.org/dev/peps/pep-0008/[PEP8] and the https://google.github.io/styleguide/pyguide.html[Google Python style guidelines] with some additions: * The _Raise:_ section is not added to the docstring. * Methods overriding Qt methods (obviously!) don't follow the naming schemes. @@ -710,6 +710,7 @@ qutebrowser release * Update changelog (remove *(unreleased)*). * Adjust `__version_info__` in `qutebrowser/__init__.py`. +* Consider updating the completions for `content.headers.user_agent` in `configdata.yml`. * Commit. * Create annotated git tag (`git tag -s "v1.$x.$y" -m "Release v1.$x.$y"`). @@ -723,7 +724,7 @@ as closed. * Windows: Run `git checkout v1.X.Y; py -3 scripts\dev\build_release.py --asciidoc C:\Python27\python %userprofile%\bin\asciidoc-8.6.10\asciidoc.py --upload v1.X.Y` (replace X/Y by hand). * macOS: Run `git checkout v1.X.Y && python3 scripts/dev/build_release.py --upload v1.X.Y` (replace X/Y by hand). * On server: - - Run `python3 scripts/dev/download_release.py v1.X.Y` (replace X/Y by hand). + - Run `bash download_release.sh 1.X.Y` (replace X/Y by hand). - Run `git pull github master && sudo python3 scripts/asciidoc2html.py --website /srv/http/qutebrowser` * Update `qutebrowser-git` PKGBUILD if dependencies/install changed. * Announce to qutebrowser and qutebrowser-announce mailinglist. diff --git a/doc/extapi/conf.py b/doc/extapi/conf.py index 4cc5c6803..aba5e93af 100644 --- a/doc/extapi/conf.py +++ b/doc/extapi/conf.py @@ -20,7 +20,7 @@ # -- Project information ----------------------------------------------------- project = 'qutebrowser extensions' -copyright = '2018, Florian Bruhin' +copyright = '2018-2019, Florian Bruhin' author = 'Florian Bruhin' # The short X.Y version diff --git a/doc/help/configuring.asciidoc b/doc/help/configuring.asciidoc index b04c9e9df..970a0e7dd 100644 --- a/doc/help/configuring.asciidoc +++ b/doc/help/configuring.asciidoc @@ -89,7 +89,7 @@ You can run `:config-edit` inside qutebrowser to open the file in your editor, The file should be located in the "config" location listed on link:qute://version[], which is typically `~/.config/qutebrowser/config.py` on Linux, `~/.qutebrowser/config.py` on macOS, and -`%APPDATA%/qutebrowser/config.py` on Windows. +`%APPDATA%/qutebrowser/config/config.py` on Windows. Two global objects are pre-defined when running `config.py`: `c` and `config`. diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index eb3907cce..266a5d2d0 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -215,6 +215,7 @@ |<<input.insert_mode.auto_enter,input.insert_mode.auto_enter>>|Enter insert mode if an editable element is clicked. |<<input.insert_mode.auto_leave,input.insert_mode.auto_leave>>|Leave insert mode if a non-editable element is clicked. |<<input.insert_mode.auto_load,input.insert_mode.auto_load>>|Automatically enter insert mode if an editable element is focused after loading the page. +|<<input.insert_mode.leave_on_load,input.insert_mode.leave_on_load>>|Leave insert mode when starting a new page load. |<<input.insert_mode.plugins,input.insert_mode.plugins>>|Switch to insert mode when clicking flash and other plugins. |<<input.links_included_in_focus_chain,input.links_included_in_focus_chain>>|Include hyperlinks in the keyboard focus chain when tabbing. |<<input.partial_timeout,input.partial_timeout>>|Timeout (in milliseconds) for partially typed key bindings. @@ -1647,7 +1648,7 @@ Type: <<types,Bool>> Default: +pass:[true]+ -This setting is only available with the QtWebKit backend. +On QtWebEngine, this setting requires Qt 5.12 or newer. [[content.frame_flattening]] === content.frame_flattening @@ -2711,6 +2712,17 @@ Type: <<types,Bool>> Default: +pass:[false]+ +[[input.insert_mode.leave_on_load]] +=== input.insert_mode.leave_on_load +Leave insert mode when starting a new page load. +Patterns may be unreliable on this setting, and they may match the url you are navigating to, or the URL you are navigating from. + +This setting supports URL patterns. + +Type: <<types,Bool>> + +Default: +pass:[true]+ + [[input.insert_mode.plugins]] === input.insert_mode.plugins Switch to insert mode when clicking flash and other plugins. diff --git a/misc/Makefile b/misc/Makefile index 4625b288e..ff5a2cca2 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -17,12 +17,12 @@ doc/qutebrowser.1.html: install: doc/qutebrowser.1.html $(PYTHON) setup.py install --prefix="$(PREFIX)" --optimize=1 $(SETUPTOOLSOPTS) - install -Dm644 misc/qutebrowser.appdata.xml \ - "$(DESTDIR)$(DATADIR)/metainfo/qutebrowser.appdata.xml" + install -Dm644 misc/org.qutebrowser.qutebrowser.appdata.xml \ + "$(DESTDIR)$(DATADIR)/metainfo/org.qutebrowser.qutebrowser.appdata.xml" install -Dm644 doc/qutebrowser.1 \ "$(DESTDIR)$(MANDIR)/man1/qutebrowser.1" - install -Dm644 misc/qutebrowser.desktop \ - "$(DESTDIR)$(DATADIR)/applications/qutebrowser.desktop" + install -Dm644 misc/org.qutebrowser.qutebrowser.desktop \ + "$(DESTDIR)$(DATADIR)/applications/org.qutebrowser.qutebrowser.desktop" $(foreach i,$(ICONSIZES),install -Dm644 "icons/qutebrowser-$(i)x$(i).png" \ "$(DESTDIR)$(DATADIR)/icons/hicolor/$(i)x$(i)/apps/qutebrowser.png";) install -Dm644 icons/qutebrowser.svg \ diff --git a/misc/qutebrowser.appdata.xml b/misc/org.qutebrowser.qutebrowser.appdata.xml index bdab55f54..e297bd9b4 100644 --- a/misc/qutebrowser.appdata.xml +++ b/misc/org.qutebrowser.qutebrowser.appdata.xml @@ -20,7 +20,7 @@ <provides> <binary>qutebrowser</binary> </provides> - <launchable type="desktop-id">qutebrowser.desktop</launchable> + <launchable type="desktop-id">org.qutebrowser.qutebrowser.desktop</launchable> <screenshots> <screenshot type="default"> <image>https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/main.png</image> diff --git a/misc/qutebrowser.desktop b/misc/org.qutebrowser.qutebrowser.desktop index 976803915..976803915 100644 --- a/misc/qutebrowser.desktop +++ b/misc/org.qutebrowser.qutebrowser.desktop diff --git a/misc/requirements/requirements-codecov.txt b/misc/requirements/requirements-codecov.txt index 19ae758af..3351640db 100644 --- a/misc/requirements/requirements-codecov.txt +++ b/misc/requirements/requirements-codecov.txt @@ -1,9 +1,9 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -certifi==2018.11.29 +certifi==2019.3.9 chardet==3.0.4 codecov==2.0.15 -coverage==4.5.2 +coverage==4.5.3 idna==2.8 requests==2.21.0 urllib3==1.24.1 diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index 42255f825..ff0d8aec1 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -1,27 +1,25 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -attrs==18.2.0 -flake8==3.6.0 +attrs==19.1.0 +entrypoints==0.3 +flake8==3.7.7 flake8-bugbear==18.8.0 flake8-builtins==1.4.1 -flake8-comprehensions==1.4.1 +flake8-comprehensions==2.1.0 flake8-copyright==0.2.2 flake8-debugger==3.1.0 flake8-deprecated==1.3 flake8-docstrings==1.3.0 flake8-future-import==0.4.5 flake8-mock==0.3 -flake8-per-file-ignores==0.7 flake8-polyfill==1.0.2 flake8-string-format==0.2.3 -flake8-tidy-imports==1.1.0 +flake8-tidy-imports==2.0.0 flake8-tuple==0.2.13 mccabe==0.6.1 -pathmatch==0.2.1 -pep8-naming==0.7.0 -pycodestyle==2.4.0 +pep8-naming==0.8.2 +pycodestyle==2.5.0 pydocstyle==3.0.0 -pyflakes==2.0.0 +pyflakes==2.1.1 six==1.12.0 snowballstemmer==1.2.1 -typing==3.6.6 diff --git a/misc/requirements/requirements-flake8.txt-raw b/misc/requirements/requirements-flake8.txt-raw index 1f30b83ae..1bdca6974 100644 --- a/misc/requirements/requirements-flake8.txt-raw +++ b/misc/requirements/requirements-flake8.txt-raw @@ -8,7 +8,6 @@ flake8-deprecated flake8-docstrings flake8-future-import flake8-mock -flake8-per-file-ignores flake8-string-format flake8-tidy-imports flake8-tuple diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt index 6b8c63e97..8cac2edcd 100644 --- a/misc/requirements/requirements-mypy.txt +++ b/misc/requirements/requirements-mypy.txt @@ -1,8 +1,8 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -mypy==0.650 +mypy==0.670 mypy-extensions==0.4.1 -PyQt5==5.11.3 -PyQt5-sip==4.19.13 +# PyQt5==5.11.3 +# PyQt5-sip==4.19.14 -e git+https://github.com/qutebrowser/PyQt5-stubs.git@wip#egg=PyQt5_stubs -typed-ast==1.1.1 +typed-ast==1.3.1 diff --git a/misc/requirements/requirements-mypy.txt-raw b/misc/requirements/requirements-mypy.txt-raw index 636ad43a4..92a35ab74 100644 --- a/misc/requirements/requirements-mypy.txt-raw +++ b/misc/requirements/requirements-mypy.txt-raw @@ -3,3 +3,4 @@ mypy # remove @commit-id for scm installs #@ replace: @.*# @wip# +#@ ignore: PyQt5, PyQt5-sip diff --git a/misc/requirements/requirements-optional.txt b/misc/requirements/requirements-optional.txt index aafa38e46..52d067f69 100644 --- a/misc/requirements/requirements-optional.txt +++ b/misc/requirements/requirements-optional.txt @@ -2,6 +2,5 @@ colorama==0.4.1 cssutils==1.0.2 -hunter==2.1.0 +hunter==2.2.1 Pympler==0.6 -six==1.12.0 diff --git a/misc/requirements/requirements-pip.txt b/misc/requirements/requirements-pip.txt index f15a3a3e1..38ea42d6f 100644 --- a/misc/requirements/requirements-pip.txt +++ b/misc/requirements/requirements-pip.txt @@ -1,8 +1,8 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py appdirs==1.4.3 -packaging==18.0 -pyparsing==2.3.0 -setuptools==40.6.3 +packaging==19.0 +pyparsing==2.3.1 +setuptools==40.8.0 six==1.12.0 -wheel==0.32.3 +wheel==0.33.1 diff --git a/misc/requirements/requirements-pylint.txt b/misc/requirements/requirements-pylint.txt index b3ecdaf70..d8d38f246 100644 --- a/misc/requirements/requirements-pylint.txt +++ b/misc/requirements/requirements-pylint.txt @@ -1,23 +1,23 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py asn1crypto==0.24.0 -astroid==2.1.0 -certifi==2018.11.29 -cffi==1.11.5 +astroid==2.2.5 +certifi==2019.3.9 +cffi==1.12.2 chardet==3.0.4 -cryptography==2.4.2 -github3.py==1.2.0 +cryptography==2.6.1 +github3.py==1.3.0 idna==2.8 -isort==4.3.4 +isort==4.3.15 jwcrypto==0.6.0 lazy-object-proxy==1.3.1 mccabe==0.6.1 pycparser==2.19 -pylint==2.2.2 -python-dateutil==2.7.5 +pylint==2.3.1 +python-dateutil==2.8.0 ./scripts/dev/pylint_checkers requests==2.21.0 six==1.12.0 uritemplate==3.0.0 urllib3==1.24.1 -wrapt==1.10.11 +wrapt==1.11.1 diff --git a/misc/requirements/requirements-pyqt.txt b/misc/requirements/requirements-pyqt.txt index 32aee87a9..63722a679 100644 --- a/misc/requirements/requirements-pyqt.txt +++ b/misc/requirements/requirements-pyqt.txt @@ -1,4 +1,5 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -PyQt5==5.11.3 -PyQt5-sip==4.19.13 +PyQt5==5.12 +PyQt5-sip==4.19.14 +PyQtWebEngine==5.12 diff --git a/misc/requirements/requirements-pyqt.txt-raw b/misc/requirements/requirements-pyqt.txt-raw index 37a69c45a..9c6afbf16 100644 --- a/misc/requirements/requirements-pyqt.txt-raw +++ b/misc/requirements/requirements-pyqt.txt-raw @@ -1 +1,2 @@ -PyQt5
\ No newline at end of file +PyQt5 +PyQtWebEngine diff --git a/misc/requirements/requirements-sphinx.txt b/misc/requirements/requirements-sphinx.txt index c089895d1..da9dd7911 100644 --- a/misc/requirements/requirements-sphinx.txt +++ b/misc/requirements/requirements-sphinx.txt @@ -2,20 +2,20 @@ alabaster==0.7.12 Babel==2.6.0 -certifi==2018.11.29 +certifi==2019.3.9 chardet==3.0.4 docutils==0.14 idna==2.8 imagesize==1.1.0 Jinja2==2.10 -MarkupSafe==1.1.0 -packaging==18.0 +MarkupSafe==1.1.1 +packaging==19.0 Pygments==2.3.1 -pyparsing==2.3.0 -pytz==2018.7 +pyparsing==2.3.1 +pytz==2018.9 requests==2.21.0 six==1.12.0 snowballstemmer==1.2.1 -Sphinx==1.8.3 +Sphinx==1.8.5 sphinxcontrib-websupport==1.1.0 urllib3==1.24.1 diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 228045f8c..a77b0c652 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -1,41 +1,42 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -atomicwrites==1.2.1 -attrs==18.2.0 +atomicwrites==1.3.0 +attrs==19.1.0 backports.functools-lru-cache==1.5 -beautifulsoup4==4.7.0 -cheroot==6.5.3 +beautifulsoup4==4.7.1 +cheroot==6.5.4 Click==7.0 # colorama==0.4.1 -coverage==4.5.2 +coverage==4.5.3 EasyProcess==0.2.5 Flask==1.0.2 glob2==0.6 -hunter==2.1.0 -hypothesis==3.85.2 +hunter==2.2.1 +hypothesis==4.10.0 itsdangerous==1.1.0 # Jinja2==2.10 Mako==1.0.7 # MarkupSafe==1.1.0 -more-itertools==5.0.0 -parse==1.9.0 +more-itertools==6.0.0 +parse==1.11.1 parse-type==0.4.2 -pluggy==0.8.0 -py==1.7.0 +pluggy==0.9.0 +py==1.8.0 py-cpuinfo==4.0.0 -pytest==4.0.2 -pytest-bdd==3.0.1 -pytest-benchmark==3.1.1 -pytest-cov==2.6.0 +pytest==4.3.0 +pytest-bdd==3.1.0 +pytest-benchmark==3.2.2 +pytest-cov==2.6.1 pytest-faulthandler==1.5.0 -pytest-instafail==0.4.0 -pytest-mock==1.10.0 +pytest-instafail==0.4.1 +pytest-mock==1.10.1 pytest-qt==3.2.2 -pytest-repeat==0.7.0 -pytest-rerunfailures==5.0 +pytest-repeat==0.8.0 +pytest-rerunfailures==6.0 pytest-travis-fold==1.3.0 -pytest-xvfb==1.1.0 +pytest-xvfb==1.2.0 PyVirtualDisplay==0.2.1 six==1.12.0 +soupsieve==1.8 vulture==1.0 Werkzeug==0.14.1 diff --git a/misc/requirements/requirements-tox.txt b/misc/requirements/requirements-tox.txt index ed0db2870..395595577 100644 --- a/misc/requirements/requirements-tox.txt +++ b/misc/requirements/requirements-tox.txt @@ -1,9 +1,9 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py filelock==3.0.10 -pluggy==0.8.0 -py==1.7.0 +pluggy==0.9.0 +py==1.8.0 six==1.12.0 toml==0.10.0 -tox==3.6.1 -virtualenv==16.1.0 +tox==3.7.0 +virtualenv==16.4.3 diff --git a/misc/userscripts/dmenu_qutebrowser b/misc/userscripts/dmenu_qutebrowser index 82e6d2f18..044889b1d 100755 --- a/misc/userscripts/dmenu_qutebrowser +++ b/misc/userscripts/dmenu_qutebrowser @@ -1,7 +1,7 @@ #!/usr/bin/env bash +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015 Zach-Button <zachrey.button@gmail.com> -# Copyright 2015-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/misc/userscripts/format_json b/misc/userscripts/format_json index 0d476b327..610cefbac 100755 --- a/misc/userscripts/format_json +++ b/misc/userscripts/format_json @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -euo pipefail # # Behavior: diff --git a/misc/userscripts/openfeeds b/misc/userscripts/openfeeds index 4a1a942e6..11feca966 100755 --- a/misc/userscripts/openfeeds +++ b/misc/userscripts/openfeeds @@ -1,8 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015 jnphilipp <me@jnphilipp.org> -# Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/misc/userscripts/qute-keepass b/misc/userscripts/qute-keepass index a21ebc9b3..fedc43cf2 100755 --- a/misc/userscripts/qute-keepass +++ b/misc/userscripts/qute-keepass @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2018 Jay Kamat <jaygkamat@gmail.com> +# Copyright 2018-2019 Jay Kamat <jaygkamat@gmail.com> # # This file is part of qutebrowser. # diff --git a/misc/userscripts/qute-pass b/misc/userscripts/qute-pass index ca9c4d4ca..bfc2cbeb9 100755 --- a/misc/userscripts/qute-pass +++ b/misc/userscripts/qute-pass @@ -97,13 +97,19 @@ def qute_command(command): def find_pass_candidates(domain, password_store_path): candidates = [] for path, directories, file_names in os.walk(password_store_path, followlinks=True): - if directories or domain not in path.split(os.path.sep): + secrets = fnmatch.filter(file_names, '*.gpg') + if not secrets: continue # Strip password store path prefix to get the relative pass path pass_path = path[len(password_store_path) + 1:] - secrets = fnmatch.filter(file_names, '*.gpg') - candidates.extend(os.path.join(pass_path, os.path.splitext(secret)[0]) for secret in secrets) + split_path = pass_path.split(os.path.sep) + for secret in secrets: + secret_base = os.path.splitext(secret)[0] + if domain not in (split_path + [secret_base]): + continue + + candidates.append(os.path.join(pass_path, secret_base)) return candidates diff --git a/pytest.ini b/pytest.ini index c278b0591..6ea9e5bf1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -65,10 +65,7 @@ qt_log_ignore = ^Icon theme ".*" not found ^Error receiving trust for a CA certificate ^QBackingStore::endPaint\(\) called with active painter on backingstore paint device + ^QPaintDevice: Cannot destroy paint device that is being painted + ^DirectWrite: CreateFontFaceFromHDC\(\) failed .* xfail_strict = true -filterwarnings = - error - # This happens in many qutebrowser dependencies... - ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working:DeprecationWarning - # WORKAROUND for https://github.com/ionelmc/pytest-benchmark/issues/124 - ignore:Node\.warn\(code, message\) form has been deprecated, use Node\.warn\(warning_instance\) instead:pytest.PytestDeprecationWarning +filterwarnings = error diff --git a/qutebrowser.py b/qutebrowser.py index 8dd81b01a..392db932c 100755 --- a/qutebrowser.py +++ b/qutebrowser.py @@ -2,7 +2,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/__init__.py b/qutebrowser/__init__.py index 8be3df172..713575646 100644 --- a/qutebrowser/__init__.py +++ b/qutebrowser/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -22,11 +22,11 @@ import os.path __author__ = "Florian Bruhin" -__copyright__ = "Copyright 2014-2018 Florian Bruhin (The Compiler)" +__copyright__ = "Copyright 2014-2019 Florian Bruhin (The Compiler)" __license__ = "GPL" __maintainer__ = __author__ __email__ = "mail@qutebrowser.org" -__version_info__ = (1, 5, 2) +__version_info__ = (1, 6, 0) __version__ = '.'.join(str(e) for e in __version_info__) __description__ = "A keyboard-driven, vim-like browser based on PyQt5." diff --git a/qutebrowser/__main__.py b/qutebrowser/__main__.py index 533cf6e67..9bbe390e5 100644 --- a/qutebrowser/__main__.py +++ b/qutebrowser/__main__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/__init__.py b/qutebrowser/api/__init__.py index 648887005..c579e52bc 100644 --- a/qutebrowser/api/__init__.py +++ b/qutebrowser/api/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/apitypes.py b/qutebrowser/api/apitypes.py index 8fbc1a9a7..dc0e8fa11 100644 --- a/qutebrowser/api/apitypes.py +++ b/qutebrowser/api/apitypes.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/cmdutils.py b/qutebrowser/api/cmdutils.py index cd43079ad..0efc187a5 100644 --- a/qutebrowser/api/cmdutils.py +++ b/qutebrowser/api/cmdutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/config.py b/qutebrowser/api/config.py index 0c633e54d..da6c40179 100644 --- a/qutebrowser/api/config.py +++ b/qutebrowser/api/config.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/downloads.py b/qutebrowser/api/downloads.py index a2a37d931..70389bc51 100644 --- a/qutebrowser/api/downloads.py +++ b/qutebrowser/api/downloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/hook.py b/qutebrowser/api/hook.py index 84e103cbd..0a9be4595 100644 --- a/qutebrowser/api/hook.py +++ b/qutebrowser/api/hook.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/api/interceptor.py b/qutebrowser/api/interceptor.py index 78819dc46..f19d30897 100644 --- a/qutebrowser/api/interceptor.py +++ b/qutebrowser/api/interceptor.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -27,6 +27,9 @@ from qutebrowser.extensions.interceptors import Request #: Type annotation for an interceptor function. InterceptorType = interceptors.InterceptorType +#: Possible resource types for requests sent to interceptor. +ResourceType = interceptors.ResourceType + def register(interceptor: InterceptorType) -> None: """Register a request interceptor. diff --git a/qutebrowser/api/message.py b/qutebrowser/api/message.py index fdb06354f..a225e12c0 100644 --- a/qutebrowser/api/message.py +++ b/qutebrowser/api/message.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 2b6896b76..5c347fa86 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -83,7 +83,7 @@ from qutebrowser.misc import utilcmds # pylint: enable=unused-import -qApp = None +q_app = None def run(args): @@ -101,25 +101,25 @@ def run(args): log.init.debug("Initializing config...") configinit.early_init(args) - global qApp - qApp = Application(args) - qApp.setOrganizationName("qutebrowser") - qApp.setApplicationName("qutebrowser") - qApp.setDesktopFileName("qutebrowser") - qApp.setApplicationVersion(qutebrowser.__version__) - qApp.lastWindowClosed.connect(quitter.on_last_window_closed) + global q_app + q_app = Application(args) + q_app.setOrganizationName("qutebrowser") + q_app.setApplicationName("qutebrowser") + q_app.setDesktopFileName("qutebrowser") + q_app.setApplicationVersion(qutebrowser.__version__) + q_app.lastWindowClosed.connect(quitter.on_last_window_closed) if args.version: print(version.version()) sys.exit(usertypes.Exit.ok) crash_handler = crashsignal.CrashHandler( - app=qApp, quitter=quitter, args=args, parent=qApp) + app=q_app, quitter=quitter, args=args, parent=q_app) crash_handler.activate() objreg.register('crash-handler', crash_handler) - signal_handler = crashsignal.SignalHandler(app=qApp, quitter=quitter, - parent=qApp) + signal_handler = crashsignal.SignalHandler(app=q_app, quitter=quitter, + parent=q_app) signal_handler.activate() objreg.register('signal-handler', signal_handler) @@ -151,7 +151,7 @@ def qt_mainloop(): WARNING: misc/crashdialog.py checks the stacktrace for this function name, so if this is changed, it should be changed there as well! """ - return qApp.exec_() + return q_app.exec_() def init(args, crash_handler): @@ -162,7 +162,7 @@ def init(args, crash_handler): crash_handler: The CrashHandler instance. """ log.init.debug("Starting init...") - qApp.setQuitOnLastWindowClosed(False) + q_app.setQuitOnLastWindowClosed(False) _init_icon() loader.init() @@ -175,12 +175,12 @@ def init(args, crash_handler): sys.exit(usertypes.Exit.err_init) log.init.debug("Initializing eventfilter...") - event_filter = EventFilter(qApp) - qApp.installEventFilter(event_filter) + event_filter = EventFilter(q_app) + q_app.installEventFilter(event_filter) objreg.register('event-filter', event_filter) log.init.debug("Connecting signals...") - qApp.focusChanged.connect(on_focus_changed) + q_app.focusChanged.connect(on_focus_changed) _process_args(args) @@ -207,7 +207,7 @@ def _init_icon(): if icon.isNull(): log.init.warning("Failed to load icon") else: - qApp.setWindowIcon(icon) + q_app.setWindowIcon(icon) def _process_args(args): @@ -220,7 +220,7 @@ def _process_args(args): window = mainwindow.MainWindow(private=None) if not args.nowindow: window.show() - qApp.setActiveWindow(window) + q_app.setActiveWindow(window) process_pos_args(args.command) _open_startpage() @@ -425,7 +425,7 @@ def _init_modules(args, crash_handler): crash_handler: The CrashHandler instance. """ log.init.debug("Initializing save manager...") - save_manager = savemanager.SaveManager(qApp) + save_manager = savemanager.SaveManager(q_app) objreg.register('save-manager', save_manager) configinit.late_init(save_manager) @@ -450,7 +450,7 @@ def _init_modules(args, crash_handler): sql.init(os.path.join(standarddir.data(), 'history.sqlite')) log.init.debug("Initializing web history...") - history.init(qApp) + history.init(q_app) except sql.SqlEnvironmentError as e: error.handle_fatal_exc(e, args, 'Error initializing SQL', pre_text='Error initializing SQL') @@ -464,31 +464,31 @@ def _init_modules(args, crash_handler): crash_handler.handle_segfault() log.init.debug("Initializing sessions...") - sessions.init(qApp) + sessions.init(q_app) log.init.debug("Initializing websettings...") websettings.init(args) log.init.debug("Initializing quickmarks...") - quickmark_manager = urlmarks.QuickmarkManager(qApp) + quickmark_manager = urlmarks.QuickmarkManager(q_app) objreg.register('quickmark-manager', quickmark_manager) log.init.debug("Initializing bookmarks...") - bookmark_manager = urlmarks.BookmarkManager(qApp) + bookmark_manager = urlmarks.BookmarkManager(q_app) objreg.register('bookmark-manager', bookmark_manager) log.init.debug("Initializing cookies...") - cookie_jar = cookies.CookieJar(qApp) - ram_cookie_jar = cookies.RAMCookieJar(qApp) + cookie_jar = cookies.CookieJar(q_app) + ram_cookie_jar = cookies.RAMCookieJar(q_app) objreg.register('cookie-jar', cookie_jar) objreg.register('ram-cookie-jar', ram_cookie_jar) log.init.debug("Initializing cache...") - diskcache = cache.DiskCache(standarddir.cache(), parent=qApp) + diskcache = cache.DiskCache(standarddir.cache(), parent=q_app) objreg.register('cache', diskcache) log.init.debug("Initializing downloads...") - download_manager = qtnetworkdownloads.DownloadManager(parent=qApp) + download_manager = qtnetworkdownloads.DownloadManager(parent=q_app) objreg.register('qtnetwork-download-manager', download_manager) log.init.debug("Initializing Greasemonkey...") @@ -735,7 +735,7 @@ class Quitter: def _shutdown(self, status, restart): # noqa """Second stage of shutdown.""" log.destroy.debug("Stage 2 of shutting down...") - if qApp is None: + if q_app is None: # No QApplication exists yet, so quit hard. sys.exit(status) # Remove eventfilter @@ -743,7 +743,7 @@ class Quitter: log.destroy.debug("Removing eventfilter...") event_filter = objreg.get('event-filter', None) if event_filter is not None: - qApp.removeEventFilter(event_filter) + q_app.removeEventFilter(event_filter) except AttributeError: pass # Close all windows @@ -792,7 +792,7 @@ class Quitter: session_manager.delete_autosave() # We use a singleshot timer to exit here to minimize the likelihood of # segfaults. - QTimer.singleShot(0, functools.partial(qApp.exit, status)) + QTimer.singleShot(0, functools.partial(q_app.exit, status)) class Application(QApplication): @@ -893,7 +893,7 @@ class EventFilter(QObject): Return: True if the event should be filtered, False if it's passed through. """ - if qApp.activeWindow() not in objreg.window_registry.values(): + if q_app.activeWindow() not in objreg.window_registry.values(): # Some other window (print dialog, etc.) is focused so we pass the # event through. return False diff --git a/qutebrowser/browser/__init__.py b/qutebrowser/browser/__init__.py index b565801d3..9b8251a75 100644 --- a/qutebrowser/browser/__init__.py +++ b/qutebrowser/browser/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 55ab89a20..c9770af5f 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 6ae47f9d9..d04c9ec91 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -479,7 +479,7 @@ class CommandDispatcher: # Catch common cases before e.g. cloning tab if not forward and not history.can_go_back(): raise cmdutils.CommandError("At beginning of history.") - elif forward and not history.can_go_forward(): + if forward and not history.can_go_forward(): raise cmdutils.CommandError("At end of history.") if tab or bg or window: diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index b18e426d7..671730b1f 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -1105,8 +1105,7 @@ class DownloadModel(QAbstractListModel): to_retry = [d for d in self if d.done and not d.successful] if not to_retry: raise cmdutils.CommandError("No failed downloads!") - else: - download = to_retry[0] + download = to_retry[0] download.try_retry() def can_clear(self): diff --git a/qutebrowser/browser/downloadview.py b/qutebrowser/browser/downloadview.py index 1ea2b6744..fc45fe26c 100644 --- a/qutebrowser/browser/downloadview.py +++ b/qutebrowser/browser/downloadview.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/greasemonkey.py b/qutebrowser/browser/greasemonkey.py index 9314f81c6..3a5b60544 100644 --- a/qutebrowser/browser/greasemonkey.py +++ b/qutebrowser/browser/greasemonkey.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -31,7 +31,8 @@ import attr from PyQt5.QtCore import pyqtSignal, QObject, QUrl from qutebrowser.utils import (log, standarddir, jinja, objreg, utils, - javascript, urlmatch, version, usertypes) + javascript, urlmatch, version, usertypes, + qtutils) from qutebrowser.api import cmdutils from qutebrowser.browser import downloads from qutebrowser.misc import objects @@ -116,6 +117,40 @@ class GreasemonkeyScript: script.includes = ['*'] return script + def needs_document_end_workaround(self): + """Check whether to force @run-at document-end. + + This needs to be done on QtWebEngine with Qt 5.12 for known-broken + scripts. + + On Qt 5.12, accessing the DOM isn't possible with "@run-at + document-start". It was documented to be impossible before, but seems + to work fine. + + However, some scripts do DOM access with "@run-at document-start". Fix + those by forcing them to use document-end instead. + """ + if objects.backend != usertypes.Backend.QtWebEngine: + return False + elif not qtutils.version_check('5.12', compiled=False): + return False + + broken_scripts = [ + ('http://userstyles.org', None), + ('https://github.com/ParticleCore', 'Iridium'), + ] + return any(self._matches_id(namespace=namespace, name=name) + for namespace, name in broken_scripts) + + def _matches_id(self, *, namespace, name): + """Check if this script matches the given namespace/name. + + Both namespace and name can be None in order to match any script. + """ + matches_namespace = namespace is None or self.namespace == namespace + matches_name = name is None or self.name == name + return matches_namespace and matches_name + def code(self): """Return the processed JavaScript code of this script. diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 43257d0a8..14f61de35 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -956,10 +956,9 @@ class HintManager(QObject): if keystring is None: if self._context.to_follow is None: raise cmdutils.CommandError("No hint to follow") - elif select: + if select: raise cmdutils.CommandError("Can't use --select without hint.") - else: - keystring = self._context.to_follow + keystring = self._context.to_follow elif keystring not in self._context.labels: raise cmdutils.CommandError("No hint {}!".format(keystring)) diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index 757a72e41..2480f7a7a 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/inspector.py b/qutebrowser/browser/inspector.py index 3334cea4e..9b9e37504 100644 --- a/qutebrowser/browser/inspector.py +++ b/qutebrowser/browser/inspector.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/mouse.py b/qutebrowser/browser/mouse.py index a73f28203..c2e39663b 100644 --- a/qutebrowser/browser/mouse.py +++ b/qutebrowser/browser/mouse.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/navigate.py b/qutebrowser/browser/navigate.py index 240878ed6..a7bf50bb6 100644 --- a/qutebrowser/browser/navigate.py +++ b/qutebrowser/browser/navigate.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/network/pac.py b/qutebrowser/browser/network/pac.py index bd060820b..cb3819bce 100644 --- a/qutebrowser/browser/network/pac.py +++ b/qutebrowser/browser/network/pac.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -142,7 +142,8 @@ class PACResolver: config = [c.strip() for c in proxy_str.split(' ') if c] if not config: raise ParseProxyError("Empty proxy entry") - elif config[0] == "DIRECT": + + if config[0] == "DIRECT": if len(config) != 1: raise ParseProxyError("Invalid number of parameters for " + "DIRECT") @@ -208,6 +209,8 @@ class PACResolver: Return: A list of QNetworkProxy objects in order of preference. """ + qtutils.ensure_valid(query.url()) + if from_file: string_flags = QUrl.PrettyDecoded else: diff --git a/qutebrowser/browser/network/proxy.py b/qutebrowser/browser/network/proxy.py index d3e25c23c..a14448512 100644 --- a/qutebrowser/browser/network/proxy.py +++ b/qutebrowser/browser/network/proxy.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -20,10 +20,12 @@ """Handling of proxies.""" +from PyQt5.QtCore import QUrl from PyQt5.QtNetwork import QNetworkProxy, QNetworkProxyFactory from qutebrowser.config import config, configtypes -from qutebrowser.utils import objreg +from qutebrowser.utils import objreg, message, usertypes, urlutils +from qutebrowser.misc import objects from qutebrowser.browser.network import pac @@ -33,6 +35,18 @@ def init(): objreg.register('proxy-factory', proxy_factory) QNetworkProxyFactory.setApplicationProxyFactory(proxy_factory) + config.instance.changed.connect(_warn_for_pac) + _warn_for_pac() + + +@config.change_filter('content.proxy', function=True) +def _warn_for_pac(): + """Show a warning if PAC is used with QtWebEngine.""" + proxy = config.val.content.proxy + if (isinstance(proxy, pac.PACFetcher) and + objects.backend == usertypes.Backend.QtWebEngine): + message.error("PAC support isn't implemented for QtWebEngine yet!") + def shutdown(): QNetworkProxyFactory.setApplicationProxyFactory(None) @@ -70,7 +84,11 @@ class ProxyFactory(QNetworkProxyFactory): # ref. http://doc.qt.io/qt-5/qnetworkproxyfactory.html#systemProxyForQuery proxies = QNetworkProxyFactory.systemProxyForQuery(query) elif isinstance(proxy, pac.PACFetcher): - proxies = proxy.resolve(query) + if objects.backend == usertypes.Backend.QtWebEngine: + # Looks like query.url() is always invalid on QtWebEngine... + proxies = [urlutils.proxy_from_url(QUrl('direct://'))] + else: + proxies = proxy.resolve(query) else: proxies = [proxy] for p in proxies: diff --git a/qutebrowser/browser/pdfjs.py b/qutebrowser/browser/pdfjs.py index 897f0407e..0fccaf4e2 100644 --- a/qutebrowser/browser/pdfjs.py +++ b/qutebrowser/browser/pdfjs.py @@ -1,7 +1,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015 Daniel Schadt -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/qtnetworkdownloads.py b/qutebrowser/browser/qtnetworkdownloads.py index bdd2b280a..5fb9ca95f 100644 --- a/qutebrowser/browser/qtnetworkdownloads.py +++ b/qutebrowser/browser/qtnetworkdownloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 14c43ad1e..606a05fc1 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -340,19 +340,11 @@ def qute_gpl(_url): def _asciidoc_fallback_path(html_path): """Fall back to plaintext asciidoc if the HTML is unavailable.""" - asciidoc_path = html_path.replace('.html', '.asciidoc') - asciidoc_paths = [asciidoc_path] - if asciidoc_path.startswith('html/doc/'): - asciidoc_paths += [asciidoc_path.replace('html/doc/', '../doc/help/'), - asciidoc_path.replace('html/doc/', '../doc/')] - - for path in asciidoc_paths: - try: - return utils.read_file(path) - except OSError: - pass - - return None + path = html_path.replace('.html', '.asciidoc') + try: + return utils.read_file(path) + except OSError: + return None @add_handler('help') diff --git a/qutebrowser/browser/shared.py b/qutebrowser/browser/shared.py index 0bf3301f9..194dc5b36 100644 --- a/qutebrowser/browser/shared.py +++ b/qutebrowser/browser/shared.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -42,7 +42,6 @@ def custom_headers(url): if dnt_config is not None: dnt = b'1' if dnt_config else b'0' headers[b'DNT'] = dnt - headers[b'X-Do-Not-Track'] = dnt conf_headers = config.instance.get('content.headers.custom', url=url) for header, value in conf_headers.items(): diff --git a/qutebrowser/browser/signalfilter.py b/qutebrowser/browser/signalfilter.py index 7cc46abdb..356cd27a6 100644 --- a/qutebrowser/browser/signalfilter.py +++ b/qutebrowser/browser/signalfilter.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/urlmarks.py b/qutebrowser/browser/urlmarks.py index 4d25dde45..2ff71c2df 100644 --- a/qutebrowser/browser/urlmarks.py +++ b/qutebrowser/browser/urlmarks.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Antoni Boucher <bouanto@zoho.com> # # This file is part of qutebrowser. diff --git a/qutebrowser/browser/webelem.py b/qutebrowser/browser/webelem.py index ac46fdcb9..3629ea0ef 100644 --- a/qutebrowser/browser/webelem.py +++ b/qutebrowser/browser/webelem.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/__init__.py b/qutebrowser/browser/webengine/__init__.py index 2649645d3..36a9a8b61 100644 --- a/qutebrowser/browser/webengine/__init__.py +++ b/qutebrowser/browser/webengine/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/certificateerror.py b/qutebrowser/browser/webengine/certificateerror.py index 768f54ec6..c3d6c74ab 100644 --- a/qutebrowser/browser/webengine/certificateerror.py +++ b/qutebrowser/browser/webengine/certificateerror.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/cookies.py b/qutebrowser/browser/webengine/cookies.py index e5abc20ea..7e5583152 100644 --- a/qutebrowser/browser/webengine/cookies.py +++ b/qutebrowser/browser/webengine/cookies.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/interceptor.py b/qutebrowser/browser/webengine/interceptor.py index a5b7721b8..8d8fb04dd 100644 --- a/qutebrowser/browser/webengine/interceptor.py +++ b/qutebrowser/browser/webengine/interceptor.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -33,6 +33,50 @@ class RequestInterceptor(QWebEngineUrlRequestInterceptor): """Handle ad blocking and custom headers.""" + # This dict should be from QWebEngine Resource Types to qutebrowser + # extension ResourceTypes. If a ResourceType is added to Qt, this table + # should be updated too. + RESOURCE_TYPES = { + QWebEngineUrlRequestInfo.ResourceTypeMainFrame: + interceptors.ResourceType.main_frame, + QWebEngineUrlRequestInfo.ResourceTypeSubFrame: + interceptors.ResourceType.sub_frame, + QWebEngineUrlRequestInfo.ResourceTypeStylesheet: + interceptors.ResourceType.stylesheet, + QWebEngineUrlRequestInfo.ResourceTypeScript: + interceptors.ResourceType.script, + QWebEngineUrlRequestInfo.ResourceTypeImage: + interceptors.ResourceType.image, + QWebEngineUrlRequestInfo.ResourceTypeFontResource: + interceptors.ResourceType.font_resource, + QWebEngineUrlRequestInfo.ResourceTypeSubResource: + interceptors.ResourceType.sub_resource, + QWebEngineUrlRequestInfo.ResourceTypeObject: + interceptors.ResourceType.object, + QWebEngineUrlRequestInfo.ResourceTypeMedia: + interceptors.ResourceType.media, + QWebEngineUrlRequestInfo.ResourceTypeWorker: + interceptors.ResourceType.worker, + QWebEngineUrlRequestInfo.ResourceTypeSharedWorker: + interceptors.ResourceType.shared_worker, + QWebEngineUrlRequestInfo.ResourceTypePrefetch: + interceptors.ResourceType.prefetch, + QWebEngineUrlRequestInfo.ResourceTypeFavicon: + interceptors.ResourceType.favicon, + QWebEngineUrlRequestInfo.ResourceTypeXhr: + interceptors.ResourceType.xhr, + QWebEngineUrlRequestInfo.ResourceTypePing: + interceptors.ResourceType.ping, + QWebEngineUrlRequestInfo.ResourceTypeServiceWorker: + interceptors.ResourceType.service_worker, + QWebEngineUrlRequestInfo.ResourceTypeCspReport: + interceptors.ResourceType.csp_report, + QWebEngineUrlRequestInfo.ResourceTypePluginResource: + interceptors.ResourceType.plugin_resource, + QWebEngineUrlRequestInfo.ResourceTypeUnknown: + interceptors.ResourceType.unknown, + } + def __init__(self, args, parent=None): super().__init__(parent) self._args = args @@ -71,6 +115,17 @@ class RequestInterceptor(QWebEngineUrlRequestInterceptor): url = info.requestUrl() first_party = info.firstPartyUrl() + # Per QWebEngineUrlRequestInfo::ResourceType documentation, if we fail + # our lookup, we should fall back to ResourceTypeUnknown + try: + resource_type = RequestInterceptor.RESOURCE_TYPES[ + info.resourceType()] + except KeyError: + log.webview.warning( + "Resource type {} not found in RequestInterceptor dict." + .format(debug.qenum_key(QWebEngineUrlRequestInfo, + info.resourceType()))) + resource_type = interceptors.ResourceType.unknown if ((url.scheme(), url.host(), url.path()) == ('qute', 'settings', '/set')): @@ -85,7 +140,8 @@ class RequestInterceptor(QWebEngineUrlRequestInterceptor): # FIXME:qtwebengine only block ads for NavigationTypeOther? request = interceptors.Request(first_party_url=first_party, - request_url=url) + request_url=url, + resource_type=resource_type) interceptors.run(request) if request.is_blocked: info.block(True) diff --git a/qutebrowser/browser/webengine/spell.py b/qutebrowser/browser/webengine/spell.py index 55d8aea5b..6653acdd6 100644 --- a/qutebrowser/browser/webengine/spell.py +++ b/qutebrowser/browser/webengine/spell.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2017-2018 Michal Siedlaczek <michal.siedlaczek@gmail.com> # This file is part of qutebrowser. diff --git a/qutebrowser/browser/webengine/tabhistory.py b/qutebrowser/browser/webengine/tabhistory.py index 81f0a3afd..592b64b6a 100644 --- a/qutebrowser/browser/webengine/tabhistory.py +++ b/qutebrowser/browser/webengine/tabhistory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/webenginedownloads.py b/qutebrowser/browser/webengine/webenginedownloads.py index 6dde42070..a9e4046a1 100644 --- a/qutebrowser/browser/webengine/webenginedownloads.py +++ b/qutebrowser/browser/webengine/webenginedownloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -180,7 +180,21 @@ def _get_suggested_filename(path): See https://bugreports.qt.io/browse/QTBUG-56978 """ filename = os.path.basename(path) - filename = re.sub(r'\([0-9]+\)(?=\.|$)', '', filename) + + suffix_re = re.compile(r""" + \ ? # Optional space between filename and suffix + ( + # Numerical suffix + \([0-9]+\) + | + # ISO-8601 suffix + # https://cs.chromium.org/chromium/src/base/time/time_to_iso8601.cc + \ -\ \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z + ) + (?=\.|$) # Begin of extension, or filename without extension + """, re.VERBOSE) + + filename = suffix_re.sub('', filename) if not qtutils.version_check('5.9', compiled=False): # https://bugreports.qt.io/browse/QTBUG-58155 filename = urllib.parse.unquote(filename) diff --git a/qutebrowser/browser/webengine/webengineelem.py b/qutebrowser/browser/webengine/webengineelem.py index 13292b45b..12aa28f33 100644 --- a/qutebrowser/browser/webengine/webengineelem.py +++ b/qutebrowser/browser/webengine/webengineelem.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/webengineinspector.py b/qutebrowser/browser/webengine/webengineinspector.py index 0b1ace3f3..4bf72502c 100644 --- a/qutebrowser/browser/webengine/webengineinspector.py +++ b/qutebrowser/browser/webengine/webengineinspector.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webengine/webenginequtescheme.py b/qutebrowser/browser/webengine/webenginequtescheme.py index 816589514..132005878 100644 --- a/qutebrowser/browser/webengine/webenginequtescheme.py +++ b/qutebrowser/browser/webengine/webenginequtescheme.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -62,18 +62,33 @@ class QuteSchemeHandler(QWebEngineUrlSchemeHandler): """ try: initiator = job.initiator() + request_url = job.requestUrl() except AttributeError: # Added in Qt 5.11 return True - if initiator == QUrl('null') and not qtutils.version_check('5.12'): + # https://codereview.qt-project.org/#/c/234849/ + is_opaque = initiator == QUrl('null') + target = request_url.scheme(), request_url.host() + + if is_opaque and not qtutils.version_check('5.12'): # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-70421 + # When we don't register the qute:// scheme, all requests are + # flagged as opaque. + return True + + if (target == ('qute', 'testdata') and + is_opaque and + qtutils.version_check('5.12')): + # Allow requests to qute://testdata, as this is needed in Qt 5.12 + # for all tests to work properly. No qute://testdata handler is + # installed outside of tests. return True if initiator.isValid() and initiator.scheme() != 'qute': log.misc.warning("Blocking malicious request from {} to {}".format( initiator.toDisplayString(), - job.requestUrl().toDisplayString())) + request_url.toDisplayString())) job.fail(QWebEngineUrlRequestJob.RequestDenied) return False diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 10c4d4e6b..315a0325f 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -25,6 +25,7 @@ Module attributes: """ import os +import operator from PyQt5.QtGui import QFont from PyQt5.QtWebEngineWidgets import (QWebEngineSettings, QWebEngineProfile, @@ -163,9 +164,14 @@ class WebEngineSettings(websettings.AbstractSettings): # Qt 5.8 'content.print_element_backgrounds': ('PrintElementBackgrounds', None), + # Qt 5.11 'content.autoplay': - ('PlaybackRequiresUserGesture', lambda val: not val), + ('PlaybackRequiresUserGesture', operator.not_), + + # Qt 5.12 + 'content.dns_prefetch': + ('DnsPrefetchEnabled', None), } for name, (attribute, converter) in new_attributes.items(): try: diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 22380cb1f..9ecdb1955 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -715,8 +715,6 @@ class _WebEnginePermissions(QObject): """Handling of various permission-related signals.""" - _abort_questions = pyqtSignal() - def __init__(self, tab, parent=None): super().__init__(parent) self._tab = tab @@ -736,9 +734,6 @@ class _WebEnginePermissions(QObject): page.registerProtocolHandlerRequested.connect( self._on_register_protocol_handler_requested) - self._tab.shutting_down.connect(self._abort_questions) - self._tab.load_started.connect(self._abort_questions) - @pyqtSlot('QWebEngineFullScreenRequest') def _on_fullscreen_requested(self, request): request.accept() @@ -816,7 +811,7 @@ class _WebEnginePermissions(QObject): question = shared.feature_permission( url=url, option=options[feature], msg=messages[feature], yes_action=yes_action, no_action=no_action, - abort_on=[self._abort_questions]) + abort_on=[self._tab.abort_questions]) if question is not None: page.featurePermissionRequestCanceled.connect( @@ -844,7 +839,7 @@ class _WebEnginePermissions(QObject): option='content.persistent_storage', msg='use {} of persistent storage'.format(size), yes_action=request.accept, no_action=request.reject, - abort_on=[self._abort_questions], + abort_on=[self._tab.abort_questions], blocking=True) def _on_register_protocol_handler_requested(self, request): @@ -853,7 +848,7 @@ class _WebEnginePermissions(QObject): option='content.register_protocol_handler', msg='open all {} links'.format(request.scheme()), yes_action=request.accept, no_action=request.reject, - abort_on=[self._abort_questions], + abort_on=[self._tab.abort_questions], blocking=True) @@ -927,10 +922,14 @@ class _WebEngineScripts(QObject): utils.read_file('javascript/webelem.js'), utils.read_file('javascript/caret.js'), ) - self._inject_early_js('js', - utils.read_file('javascript/print.js'), - subframes=True, - world=QWebEngineScript.MainWorld) + if not qtutils.version_check('5.12'): + # WORKAROUND for Qt versions < 5.12 not exposing window.print(). + # Qt 5.12 has a printRequested() signal so we don't need this hack + # anymore. + self._inject_early_js('js', + utils.read_file('javascript/print.js'), + subframes=True, + world=QWebEngineScript.MainWorld) # FIXME:qtwebengine what about subframes=True? self._inject_early_js('js', js_code, subframes=True) self._init_stylesheet() @@ -1039,9 +1038,15 @@ class _WebEngineScripts(QObject): new_script.setSourceCode(script.code()) new_script.setName("GM-{}".format(script.name)) new_script.setRunsOnSubFrames(script.runs_on_sub_frames) + # Override the @run-at value parsed by QWebEngineScript if desired. if injection_point: new_script.setInjectionPoint(injection_point) + elif script.needs_document_end_workaround(): + log.greasemonkey.debug("Forcing @run-at document-end for {}" + .format(script.name)) + new_script.setInjectionPoint(QWebEngineScript.DocumentReady) + log.greasemonkey.debug('adding script: {}' .format(new_script.name())) page_scripts.insert(new_script) @@ -1076,10 +1081,13 @@ class WebEngineTab(browsertab.AbstractTab): Signals: _load_finished_fake: Used in place of unreliable loadFinished + abort_questions: Emitted when a new load started or we're shutting + down. """ # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-65223 _load_finished_fake = pyqtSignal(bool) + abort_questions = pyqtSignal() def __init__(self, *, win_id, mode_manager, private, parent=None): super().__init__(win_id=win_id, private=private, parent=parent) @@ -1252,15 +1260,13 @@ class WebEngineTab(browsertab.AbstractTab): answer = message.ask( title="Proxy authentication required", text=msg, mode=usertypes.PromptMode.user_pwd, - abort_on=[self.shutting_down, self.load_started], url=urlstr) + abort_on=[self.abort_questions], url=urlstr) if answer is not None: authenticator.setUser(answer.user) authenticator.setPassword(answer.password) else: try: - # pylint: disable=no-member, useless-suppression sip.assign(authenticator, QAuthenticator()) - # pylint: enable=no-member, useless-suppression except AttributeError: self._show_error_page(url, "Proxy authentication required") @@ -1276,15 +1282,12 @@ class WebEngineTab(browsertab.AbstractTab): if not netrc_success: log.network.debug("Asking for credentials") - abort_on = [self.shutting_down, self.load_started] - answer = shared.authentication_required(url, authenticator, - abort_on) + answer = shared.authentication_required( + url, authenticator, abort_on=[self.abort_questions]) if not netrc_success and answer is None: log.network.debug("Aborting auth") try: - # pylint: disable=no-member, useless-suppression sip.assign(authenticator, QAuthenticator()) - # pylint: enable=no-member, useless-suppression except AttributeError: # WORKAROUND for # https://www.riverbankcomputing.com/pipermail/pyqt/2016-December/038400.html @@ -1389,7 +1392,7 @@ class WebEngineTab(browsertab.AbstractTab): if error.is_overridable(): error.ignore = shared.ignore_certificate_errors( - url, [error], abort_on=[self.shutting_down, self.load_started]) + url, [error], abort_on=[self.abort_questions]) else: log.webview.error("Non-overridable certificate error: " "{}".format(error)) @@ -1418,15 +1421,20 @@ class WebEngineTab(browsertab.AbstractTab): if not qtutils.version_check('5.11.1', compiled=False): self.settings.update_for_url(url) + @pyqtSlot() + def _on_print_requested(self): + """Slot for window.print() in JS.""" + try: + self.printing.show_dialog() + except browsertab.WebTabError as e: + message.error(str(e)) + @pyqtSlot(usertypes.NavigationRequest) def _on_navigation_request(self, navigation): super()._on_navigation_request(navigation) if navigation.url == QUrl('qute://print'): - try: - self.printing.show_dialog() - except browsertab.WebTabError as e: - message.error(str(e)) + self._on_print_requested() navigation.accepted = False if not navigation.accepted or not navigation.is_main_frame: @@ -1458,6 +1466,37 @@ class WebEngineTab(browsertab.AbstractTab): if reload_needed: self._reload_url = navigation.url + def _on_select_client_certificate(self, selection): + """Handle client certificates. + + Currently, we simply pick the first available certificate and show an + additional note if there are multiple matches. + """ + certificate = selection.certificates()[0] + text = ('<b>Subject:</b> {subj}<br/>' + '<b>Issuer:</b> {issuer}<br/>' + '<b>Serial:</b> {serial}'.format( + subj=html_utils.escape(certificate.subjectDisplayName()), + issuer=html_utils.escape(certificate.issuerDisplayName()), + serial=bytes(certificate.serialNumber()).decode('ascii'))) + if len(selection.certificates()) > 1: + text += ('<br/><br/><b>Note:</b> Multiple matching certificates ' + 'were found, but certificate selection is not ' + 'implemented yet!') + urlstr = selection.host().host() + + present = message.ask( + title='Present client certificate to {}?'.format(urlstr), + text=text, + mode=usertypes.PromptMode.yesno, + abort_on=[self.abort_questions], + url=urlstr) + + if present: + selection.select(certificate) + else: + selection.selectNone() + def _connect_signals(self): view = self._widget page = view.page() @@ -1473,6 +1512,11 @@ class WebEngineTab(browsertab.AbstractTab): page.contentsSizeChanged.connect(self.contents_size_changed) page.navigation_request.connect(self._on_navigation_request) + if qtutils.version_check('5.12'): + page.printRequested.connect(self._on_print_requested) + page.selectClientCertificate.connect( + self._on_select_client_certificate) + view.titleChanged.connect(self.title_changed) view.urlChanged.connect(self._on_url_changed) view.renderProcessTerminated.connect( @@ -1493,6 +1537,8 @@ class WebEngineTab(browsertab.AbstractTab): page.loadFinished.connect(self._on_load_finished) self.before_load_started.connect(self._on_before_load_started) + self.shutting_down.connect(self.abort_questions) + self.load_started.connect(self.abort_questions) # pylint: disable=protected-access self.audio._connect_signals() diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py index e70226f30..f808af592 100644 --- a/qutebrowser/browser/webengine/webview.py +++ b/qutebrowser/browser/webengine/webview.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -64,6 +64,8 @@ class WebEngineView(QWebEngineView): Normally, this would always be the focusProxy(). However, it sometimes isn't, so we use this as a WORKAROUND for https://bugreports.qt.io/browse/QTBUG-68727 + + This got introduced in Qt 5.11.0 and fixed in 5.12.0. """ if 'lost-focusproxy' not in objreg.get('args').debug_flags: proxy = self.focusProxy() diff --git a/qutebrowser/browser/webkit/__init__.py b/qutebrowser/browser/webkit/__init__.py index 5100b7a53..e276c8b2b 100644 --- a/qutebrowser/browser/webkit/__init__.py +++ b/qutebrowser/browser/webkit/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/cache.py b/qutebrowser/browser/webkit/cache.py index 163612ce9..4844ea0d3 100644 --- a/qutebrowser/browser/webkit/cache.py +++ b/qutebrowser/browser/webkit/cache.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/certificateerror.py b/qutebrowser/browser/webkit/certificateerror.py index cad17fba5..646de0bdc 100644 --- a/qutebrowser/browser/webkit/certificateerror.py +++ b/qutebrowser/browser/webkit/certificateerror.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/cookies.py b/qutebrowser/browser/webkit/cookies.py index 01b6842a0..9dce9bc11 100644 --- a/qutebrowser/browser/webkit/cookies.py +++ b/qutebrowser/browser/webkit/cookies.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/http.py b/qutebrowser/browser/webkit/http.py index 73e620015..d4d3802cd 100644 --- a/qutebrowser/browser/webkit/http.py +++ b/qutebrowser/browser/webkit/http.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/mhtml.py b/qutebrowser/browser/webkit/mhtml.py index 70a22351f..e0d714dce 100644 --- a/qutebrowser/browser/webkit/mhtml.py +++ b/qutebrowser/browser/webkit/mhtml.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Daniel Schadt # # This file is part of qutebrowser. diff --git a/qutebrowser/browser/webkit/network/filescheme.py b/qutebrowser/browser/webkit/network/filescheme.py index a29674e25..c036bd6e6 100644 --- a/qutebrowser/browser/webkit/network/filescheme.py +++ b/qutebrowser/browser/webkit/network/filescheme.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Antoni Boucher (antoyo) <bouanto@zoho.com> # # This file is part of qutebrowser. diff --git a/qutebrowser/browser/webkit/network/networkmanager.py b/qutebrowser/browser/webkit/network/networkmanager.py index dd3643c87..fd95f29fb 100644 --- a/qutebrowser/browser/webkit/network/networkmanager.py +++ b/qutebrowser/browser/webkit/network/networkmanager.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/network/networkreply.py b/qutebrowser/browser/webkit/network/networkreply.py index c56fe2a9b..99546c90d 100644 --- a/qutebrowser/browser/webkit/network/networkreply.py +++ b/qutebrowser/browser/webkit/network/networkreply.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # Based on the Eric5 helpviewer, # Copyright (c) 2009 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> @@ -34,8 +34,7 @@ class FixedDataNetworkReply(QNetworkReply): """QNetworkReply subclass for fixed data.""" - def __init__(self, request, fileData, mimeType, # noqa: N803 - parent=None): + def __init__(self, request, fileData, mimeType, parent=None): # noqa: N803 """Constructor. Args: diff --git a/qutebrowser/browser/webkit/network/webkitqutescheme.py b/qutebrowser/browser/webkit/network/webkitqutescheme.py index c05097b79..a90255323 100644 --- a/qutebrowser/browser/webkit/network/webkitqutescheme.py +++ b/qutebrowser/browser/webkit/network/webkitqutescheme.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/rfc6266.py b/qutebrowser/browser/webkit/rfc6266.py index 139b4f9df..2ffc39f88 100644 --- a/qutebrowser/browser/webkit/rfc6266.py +++ b/qutebrowser/browser/webkit/rfc6266.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/tabhistory.py b/qutebrowser/browser/webkit/tabhistory.py index 263bf6334..a4fd2ce85 100644 --- a/qutebrowser/browser/webkit/tabhistory.py +++ b/qutebrowser/browser/webkit/tabhistory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -89,8 +89,7 @@ def serialize(items): if current_idx is not None: raise ValueError("Multiple active items ({} and {}) " "found!".format(current_idx, i)) - else: - current_idx = i + current_idx = i if items: if current_idx is None: diff --git a/qutebrowser/browser/webkit/webkitelem.py b/qutebrowser/browser/webkit/webkitelem.py index af0db295d..c0188b683 100644 --- a/qutebrowser/browser/webkit/webkitelem.py +++ b/qutebrowser/browser/webkit/webkitelem.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webkithistory.py b/qutebrowser/browser/webkit/webkithistory.py index 65d9bbb01..a0d41088d 100644 --- a/qutebrowser/browser/webkit/webkithistory.py +++ b/qutebrowser/browser/webkit/webkithistory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webkitinspector.py b/qutebrowser/browser/webkit/webkitinspector.py index d590d4adf..e2652b9f4 100644 --- a/qutebrowser/browser/webkit/webkitinspector.py +++ b/qutebrowser/browser/webkit/webkitinspector.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webkitsettings.py b/qutebrowser/browser/webkit/webkitsettings.py index cce1dcec0..fac86285e 100644 --- a/qutebrowser/browser/webkit/webkitsettings.py +++ b/qutebrowser/browser/webkit/webkitsettings.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index c10c2aeec..8c72dbbf0 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webpage.py b/qutebrowser/browser/webkit/webpage.py index 0195ec17f..1b4b85c65 100644 --- a/qutebrowser/browser/webkit/webpage.py +++ b/qutebrowser/browser/webkit/webpage.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index 8921e211c..b6b4c0683 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/commands/__init__.py b/qutebrowser/commands/__init__.py index 6ba8a9ae3..25b9e9763 100644 --- a/qutebrowser/commands/__init__.py +++ b/qutebrowser/commands/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/commands/argparser.py b/qutebrowser/commands/argparser.py index 707324ede..289cdb54b 100644 --- a/qutebrowser/commands/argparser.py +++ b/qutebrowser/commands/argparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/commands/cmdexc.py b/qutebrowser/commands/cmdexc.py index f342f2436..5eb465a24 100644 --- a/qutebrowser/commands/cmdexc.py +++ b/qutebrowser/commands/cmdexc.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 46f92772f..044816fdb 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -402,7 +402,8 @@ class Command: if isinstance(typ, tuple): raise TypeError("{}: Legacy tuple type annotation!".format( self.name)) - elif getattr(typ, '__origin__', None) is typing.Union or ( + + if getattr(typ, '__origin__', None) is typing.Union or ( # Older Python 3.5 patch versions # pylint: disable=no-member,useless-suppression hasattr(typing, 'UnionMeta') and diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 666c79f3e..556a54d69 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 8d95db07d..6470a5365 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/__init__.py b/qutebrowser/completion/__init__.py index 2c9121699..ab188f92e 100644 --- a/qutebrowser/completion/__init__.py +++ b/qutebrowser/completion/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index ea64225d5..678a28af9 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/completiondelegate.py b/qutebrowser/completion/completiondelegate.py index b58f36372..63818598d 100644 --- a/qutebrowser/completion/completiondelegate.py +++ b/qutebrowser/completion/completiondelegate.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 0af4ecbe1..53eecc522 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/__init__.py b/qutebrowser/completion/models/__init__.py index 7f62829ba..960e0766c 100644 --- a/qutebrowser/completion/models/__init__.py +++ b/qutebrowser/completion/models/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/completionmodel.py b/qutebrowser/completion/models/completionmodel.py index 36a465fb7..d7cef71e2 100644 --- a/qutebrowser/completion/models/completionmodel.py +++ b/qutebrowser/completion/models/completionmodel.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/configmodel.py b/qutebrowser/completion/models/configmodel.py index 19b252242..9c1093532 100644 --- a/qutebrowser/completion/models/configmodel.py +++ b/qutebrowser/completion/models/configmodel.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/histcategory.py b/qutebrowser/completion/models/histcategory.py index 83eafef50..8b1be213a 100644 --- a/qutebrowser/completion/models/histcategory.py +++ b/qutebrowser/completion/models/histcategory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/listcategory.py b/qutebrowser/completion/models/listcategory.py index 78844f53f..1ff9dbab4 100644 --- a/qutebrowser/completion/models/listcategory.py +++ b/qutebrowser/completion/models/listcategory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/miscmodels.py b/qutebrowser/completion/models/miscmodels.py index 74b75aeb1..9c1cc20fc 100644 --- a/qutebrowser/completion/models/miscmodels.py +++ b/qutebrowser/completion/models/miscmodels.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index f2e6fe5f5..137afb00a 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/completion/models/util.py b/qutebrowser/completion/models/util.py index 08f99eb6c..32f32f1c6 100644 --- a/qutebrowser/completion/models/util.py +++ b/qutebrowser/completion/models/util.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/qutebrowser/components/__init__.py b/qutebrowser/components/__init__.py index 1a13763bf..63b8d8db3 100644 --- a/qutebrowser/components/__init__.py +++ b/qutebrowser/components/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/components/adblock.py b/qutebrowser/components/adblock.py index 9baa12d7c..8ceeccc1a 100644 --- a/qutebrowser/components/adblock.py +++ b/qutebrowser/components/adblock.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/components/caretcommands.py b/qutebrowser/components/caretcommands.py index 4bab6b6c6..c12dab270 100644 --- a/qutebrowser/components/caretcommands.py +++ b/qutebrowser/components/caretcommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/components/misccommands.py b/qutebrowser/components/misccommands.py index a65bdd235..fc5fce225 100644 --- a/qutebrowser/components/misccommands.py +++ b/qutebrowser/components/misccommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -292,8 +292,7 @@ def debug_crash(typ: str = 'exception') -> None: if typ == 'segfault': os.kill(os.getpid(), signal.SIGSEGV) raise Exception("Segfault failed (wat.)") - else: - raise Exception("Forced crash") + raise Exception("Forced crash") @cmdutils.register(debug=True, maxsplit=0, no_cmd_split=True) diff --git a/qutebrowser/components/scrollcommands.py b/qutebrowser/components/scrollcommands.py index 0b8943f2d..15030ec3d 100644 --- a/qutebrowser/components/scrollcommands.py +++ b/qutebrowser/components/scrollcommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/components/zoomcommands.py b/qutebrowser/components/zoomcommands.py index 51d01cfea..f2796cfcc 100644 --- a/qutebrowser/components/zoomcommands.py +++ b/qutebrowser/components/zoomcommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/__init__.py b/qutebrowser/config/__init__.py index e2c25cce8..b124d26ae 100644 --- a/qutebrowser/config/__init__.py +++ b/qutebrowser/config/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index 201b87fde..a51126c1b 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configcache.py b/qutebrowser/config/configcache.py index 15f343478..b417f2a8e 100644 --- a/qutebrowser/config/configcache.py +++ b/qutebrowser/config/configcache.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Jay Kamat <jaygkamat@gmail.com> +# Copyright 2018-2019 Jay Kamat <jaygkamat@gmail.com> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 5d5b2db7e..410d415d5 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 61e35fd53..73ccf6eda 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -91,15 +91,15 @@ def _parse_yaml_type( ) -> configtypes.BaseType: if isinstance(node, str): # e.g: - # type: Bool + # > type: Bool # -> create the type object without any arguments type_name = node kwargs = {} # type: typing.MutableMapping[str, typing.Any] elif isinstance(node, dict): # e.g: - # type: - # name: String - # none_ok: true + # > type: + # > name: String + # > none_ok: true # -> create the type object and pass arguments type_name = node.pop('name') kwargs = node @@ -164,6 +164,7 @@ def _parse_yaml_backends_dict( 'Qt 5.9.2': qtutils.version_check('5.9.2'), 'Qt 5.10': qtutils.version_check('5.10'), 'Qt 5.11': qtutils.version_check('5.11'), + 'Qt 5.12': qtutils.version_check('5.12'), } for key in sorted(node.keys()): if conditionals[node[key]]: diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index b6d4736ae..e2d443280 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -379,7 +379,9 @@ content.developer_extras: content.dns_prefetch: default: true type: Bool - backend: QtWebKit + backend: + QtWebKit: true + QtWebEngine: Qt 5.12 supports_pattern: true desc: Try to pre-fetch DNS entries to speed up browsing. @@ -476,46 +478,14 @@ content.headers.user_agent: # 'ua_fetch.py' # Vim-protip: Place your cursor below this comment and run # :r!python scripts/dev/ua_fetch.py - - - "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:53.0) Gecko/20100101 - Firefox/53.0" - - Firefox 53.0 Win8.1 - - - "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 - Firefox/53.0" - - Firefox 53.0 Linux - - - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:53.0) - Gecko/20100101 Firefox/53.0" - - Firefox 53.0 MacOSX - - - - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 - (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4" - - Safari Generic MacOSX - - - "Mozilla/5.0 (iPad; CPU OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 - (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1" - - Mobile Safari 10.0 iOS - - - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, - like Gecko) Chrome/58.0.3029.110 Safari/537.36" - - Chrome Generic Win10 - - - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 - (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" - - Chrome Generic MacOSX + like Gecko) Chrome/71.0.3578.98 Safari/537.36" + - Chrome 71.0 Win10 - - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like - Gecko) Chrome/58.0.3029.110 Safari/537.36" - - Chrome Generic Linux - - - - "Mozilla/5.0 (compatible; Googlebot/2.1; - +http://www.google.com/bot.html" - - Google Bot - - - "Wget/1.16.1 (linux-gnu)" - - wget 1.16.1 - - - "curl/7.40.0" - - curl 7.40.0 - - - "Mozilla/5.0 (Linux; U; Android 7.1.2) AppleWebKit/534.30 (KHTML, - like Gecko) Version/4.0 Mobile Safari/534.30" - - Mobile Generic Android - - - "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like - Gecko" - - IE 11.0 for Desktop Win7 64-bit + Gecko) Chrome/71.0.3578.98 Safari/537.36" + - Chrome 71.0 Linux + - - "" + - Use default QtWebKit/QtWebEngine User-Agent supports_pattern: true desc: >- @@ -1266,6 +1236,16 @@ input.insert_mode.plugins: type: Bool desc: Switch to insert mode when clicking flash and other plugins. +input.insert_mode.leave_on_load: + default: true + type: Bool + supports_pattern: true + desc: >- + Leave insert mode when starting a new page load. + + Patterns may be unreliable on this setting, and they may match the url you + are navigating to, or the URL you are navigating from. + input.links_included_in_focus_chain: default: true type: Bool diff --git a/qutebrowser/config/configdiff.py b/qutebrowser/config/configdiff.py index ba78f64b4..beefc3d8a 100644 --- a/qutebrowser/config/configdiff.py +++ b/qutebrowser/config/configdiff.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configexc.py b/qutebrowser/config/configexc.py index 80a2cedb2..9f53847cb 100644 --- a/qutebrowser/config/configexc.py +++ b/qutebrowser/config/configexc.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configfiles.py b/qutebrowser/config/configfiles.py index de50dfca9..0d1dcb22f 100644 --- a/qutebrowser/config/configfiles.py +++ b/qutebrowser/config/configfiles.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configinit.py b/qutebrowser/config/configinit.py index ff0fd0e41..cfde2d076 100644 --- a/qutebrowser/config/configinit.py +++ b/qutebrowser/config/configinit.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 3f134f770..2a855a42d 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -176,8 +176,7 @@ class BaseType: (pytype == dict and value == {})): if not self.none_ok: raise configexc.ValidationError(value, "may not be null!") - else: - return + return if (not isinstance(value, pytype) or pytype is int and isinstance(value, bool)): @@ -365,9 +364,9 @@ class String(BaseType): if minlen is not None and minlen < 1: raise ValueError("minlen ({}) needs to be >= 1!".format(minlen)) - elif maxlen is not None and maxlen < 1: + if maxlen is not None and maxlen < 1: raise ValueError("maxlen ({}) needs to be >= 1!".format(maxlen)) - elif maxlen is not None and minlen is not None and maxlen < minlen: + if maxlen is not None and minlen is not None and maxlen < minlen: raise ValueError("minlen ({}) needs to be <= maxlen ({})!".format( minlen, maxlen)) self.minlen = minlen @@ -1271,8 +1270,7 @@ class Regex(BaseType): str(w.message).startswith('bad escape')): raise configexc.ValidationError( pattern, "must be a valid regex - " + str(w.message)) - else: - warnings.warn(w.message) + warnings.warn(w.message) return compiled @@ -1803,7 +1801,7 @@ class ConfirmQuit(FlagList): raise configexc.ValidationError( values, "List cannot contain never!") # Always can't be set with other options - elif 'always' in values and len(values) > 1: + if 'always' in values and len(values) > 1: raise configexc.ValidationError( values, "List cannot contain always!") diff --git a/qutebrowser/config/configutils.py b/qutebrowser/config/configutils.py index 47cac4bff..6392e4ca6 100644 --- a/qutebrowser/config/configutils.py +++ b/qutebrowser/config/configutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index 5a21af7e3..8883864fc 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/extensions/interceptors.py b/qutebrowser/extensions/interceptors.py index 7defcf213..7b95cff72 100644 --- a/qutebrowser/extensions/interceptors.py +++ b/qutebrowser/extensions/interceptors.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -20,6 +20,7 @@ """Infrastructure for intercepting requests.""" import typing +import enum import attr @@ -29,6 +30,34 @@ if MYPY: from PyQt5.QtCore import QUrl +class ResourceType(enum.Enum): + """Possible request types that can be received. + + Currently corresponds to the QWebEngineUrlRequestInfo Enum: + https://doc.qt.io/qt-5/qwebengineurlrequestinfo.html#ResourceType-enum + """ + + main_frame = 0 + sub_frame = 1 + stylesheet = 2 + script = 3 + image = 4 + font_resource = 5 + sub_resource = 6 + object = 7 + media = 8 + worker = 9 + shared_worker = 10 + prefetch = 11 + favicon = 12 + xhr = 13 + ping = 14 + service_worker = 15 + csp_report = 16 + plugin_resource = 17 + unknown = 255 + + @attr.s class Request: @@ -42,6 +71,9 @@ class Request: is_blocked = attr.ib(False) # type: bool + #: The resource type of the request. None if not supported on this backend. + resource_type = attr.ib(None) # type: typing.Optional[ResourceType] + def block(self) -> None: """Block this request.""" self.is_blocked = True diff --git a/qutebrowser/extensions/loader.py b/qutebrowser/extensions/loader.py index 1383adfef..d10e0919f 100644 --- a/qutebrowser/extensions/loader.py +++ b/qutebrowser/extensions/loader.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/javascript/.eslintrc.yaml b/qutebrowser/javascript/.eslintrc.yaml index cb1bb1fcb..f4af6914b 100644 --- a/qutebrowser/javascript/.eslintrc.yaml +++ b/qutebrowser/javascript/.eslintrc.yaml @@ -60,3 +60,4 @@ rules: max-lines-per-function: "off" require-unicode-regexp: "off" max-params: "off" + prefer-named-capture-group: "off" diff --git a/qutebrowser/javascript/caret.js b/qutebrowser/javascript/caret.js index 5e6640311..73b763af2 100644 --- a/qutebrowser/javascript/caret.js +++ b/qutebrowser/javascript/caret.js @@ -30,7 +30,7 @@ default-case */ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** - * Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> + * Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * * This file is part of qutebrowser. * diff --git a/qutebrowser/javascript/history.js b/qutebrowser/javascript/history.js index 093b95b4e..706db9c65 100644 --- a/qutebrowser/javascript/history.js +++ b/qutebrowser/javascript/history.js @@ -1,4 +1,5 @@ /** + * Copyright 2017-2019 Florian Bruhin (The-Compiler) <me@the-compiler.org> * Copyright 2017 Imran Sobir * * This file is part of qutebrowser. diff --git a/qutebrowser/javascript/position_caret.js b/qutebrowser/javascript/position_caret.js index 0ead360fb..5aeff44fa 100644 --- a/qutebrowser/javascript/position_caret.js +++ b/qutebrowser/javascript/position_caret.js @@ -1,6 +1,6 @@ /** +* Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * Copyright 2015 Artur Shaik <ashaihullin@gmail.com> -* Copyright 2015-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * * This file is part of qutebrowser. * diff --git a/qutebrowser/javascript/print.js b/qutebrowser/javascript/print.js index ceb34aa65..b91b45c97 100644 --- a/qutebrowser/javascript/print.js +++ b/qutebrowser/javascript/print.js @@ -1,5 +1,5 @@ /** - * Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> + * Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * * This file is part of qutebrowser. * diff --git a/qutebrowser/javascript/scroll.js b/qutebrowser/javascript/scroll.js index 7205cb151..1f74a9956 100644 --- a/qutebrowser/javascript/scroll.js +++ b/qutebrowser/javascript/scroll.js @@ -1,5 +1,5 @@ /** - * Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> + * Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * * This file is part of qutebrowser. * diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index b1cdeb26e..549d9b88b 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -1,4 +1,5 @@ /** + * Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * Copyright 2017 Ulrik de Muelenaere <ulrikdem@gmail.com> * * This file is part of qutebrowser. @@ -40,6 +41,11 @@ window._qutebrowser.stylesheet = (function() { // then move the stylesheet to the end. Partially inspired by Stylus: // https://github.com/openstyles/stylus/blob/1.1.4.2/content/apply.js#L235-L355 function watch_root() { + if (!document.documentElement) { + root_observer.observe(document, {"childList": true}); + return; + } + if (root_elem !== document.documentElement) { root_elem = document.documentElement; root_observer.disconnect(); @@ -53,7 +59,8 @@ window._qutebrowser.stylesheet = (function() { function create_style() { let ns = xhtml_ns; - if (document.documentElement.namespaceURI === svg_ns) { + if (document.documentElement && + document.documentElement.namespaceURI === svg_ns) { ns = svg_ns; } style_elem = document.createElementNS(ns, "style"); diff --git a/qutebrowser/javascript/webelem.js b/qutebrowser/javascript/webelem.js index c9d2d09a6..069b0484d 100644 --- a/qutebrowser/javascript/webelem.js +++ b/qutebrowser/javascript/webelem.js @@ -1,5 +1,5 @@ /** - * Copyright 2016-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> + * Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> * * This file is part of qutebrowser. * diff --git a/qutebrowser/keyinput/__init__.py b/qutebrowser/keyinput/__init__.py index 1cff4943b..c292f2df3 100644 --- a/qutebrowser/keyinput/__init__.py +++ b/qutebrowser/keyinput/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/keyinput/basekeyparser.py b/qutebrowser/keyinput/basekeyparser.py index 8161293cc..a6d257617 100644 --- a/qutebrowser/keyinput/basekeyparser.py +++ b/qutebrowser/keyinput/basekeyparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/keyinput/keyutils.py b/qutebrowser/keyinput/keyutils.py index 3d47aad80..0eaf91efc 100644 --- a/qutebrowser/keyinput/keyutils.py +++ b/qutebrowser/keyinput/keyutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/keyinput/macros.py b/qutebrowser/keyinput/macros.py index 5bf1ab18b..a0116c19f 100644 --- a/qutebrowser/keyinput/macros.py +++ b/qutebrowser/keyinput/macros.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2016-2018 Jan Verbeek (blyxxyz) <ring@openmailbox.org> # # This file is part of qutebrowser. diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index e9b3f1db3..2fcf0df72 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/keyinput/modeparsers.py b/qutebrowser/keyinput/modeparsers.py index 209d7dea2..e40d89f58 100644 --- a/qutebrowser/keyinput/modeparsers.py +++ b/qutebrowser/keyinput/modeparsers.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/__init__.py b/qutebrowser/mainwindow/__init__.py index 1b76e9b5a..50bf30add 100644 --- a/qutebrowser/mainwindow/__init__.py +++ b/qutebrowser/mainwindow/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 34dc5c507..a80fa0150 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/messageview.py b/qutebrowser/mainwindow/messageview.py index 43ddd5248..fd6beb2dc 100644 --- a/qutebrowser/mainwindow/messageview.py +++ b/qutebrowser/mainwindow/messageview.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/prompt.py b/qutebrowser/mainwindow/prompt.py index f666aa837..4f9457acd 100644 --- a/qutebrowser/mainwindow/prompt.py +++ b/qutebrowser/mainwindow/prompt.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/__init__.py b/qutebrowser/mainwindow/statusbar/__init__.py index eee7cf990..a65da3461 100644 --- a/qutebrowser/mainwindow/statusbar/__init__.py +++ b/qutebrowser/mainwindow/statusbar/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/backforward.py b/qutebrowser/mainwindow/statusbar/backforward.py index 5e244cf8c..63f502be7 100644 --- a/qutebrowser/mainwindow/statusbar/backforward.py +++ b/qutebrowser/mainwindow/statusbar/backforward.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index 13a368f05..545d6d288 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/command.py b/qutebrowser/mainwindow/statusbar/command.py index 1661d2362..bdac24d61 100644 --- a/qutebrowser/mainwindow/statusbar/command.py +++ b/qutebrowser/mainwindow/statusbar/command.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/keystring.py b/qutebrowser/mainwindow/statusbar/keystring.py index 73b23a65d..6e4bf6520 100644 --- a/qutebrowser/mainwindow/statusbar/keystring.py +++ b/qutebrowser/mainwindow/statusbar/keystring.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/percentage.py b/qutebrowser/mainwindow/statusbar/percentage.py index a362fd9d6..90aea7910 100644 --- a/qutebrowser/mainwindow/statusbar/percentage.py +++ b/qutebrowser/mainwindow/statusbar/percentage.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/progress.py b/qutebrowser/mainwindow/statusbar/progress.py index 6c467150b..37d4bd41b 100644 --- a/qutebrowser/mainwindow/statusbar/progress.py +++ b/qutebrowser/mainwindow/statusbar/progress.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/tabindex.py b/qutebrowser/mainwindow/statusbar/tabindex.py index 47a775f34..fca2a28a4 100644 --- a/qutebrowser/mainwindow/statusbar/tabindex.py +++ b/qutebrowser/mainwindow/statusbar/tabindex.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/text.py b/qutebrowser/mainwindow/statusbar/text.py index 0a57446f1..f083889c5 100644 --- a/qutebrowser/mainwindow/statusbar/text.py +++ b/qutebrowser/mainwindow/statusbar/text.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/textbase.py b/qutebrowser/mainwindow/statusbar/textbase.py index 399fafee7..f58c63402 100644 --- a/qutebrowser/mainwindow/statusbar/textbase.py +++ b/qutebrowser/mainwindow/statusbar/textbase.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index c6f436617..a99c23529 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 9c14df3ae..11fe0b600 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -586,10 +586,20 @@ class TabbedBrowser(QWidget): @pyqtSlot() def on_cur_load_started(self): """Leave insert/hint mode when loading started.""" - modeman.leave(self._win_id, usertypes.KeyMode.insert, 'load started', - maybe=True) - modeman.leave(self._win_id, usertypes.KeyMode.hint, 'load started', - maybe=True) + try: + url = self.current_url() + if not url.isValid(): + url = None + except qtutils.QtValueError: + url = None + if config.instance.get('input.insert_mode.leave_on_load', + url=url): + modeman.leave(self._win_id, usertypes.KeyMode.insert, + 'load started', maybe=True) + else: + log.modes.debug("Ignoring leave_on_load request due to setting.") + modeman.leave(self._win_id, usertypes.KeyMode.hint, + 'load started', maybe=True) @pyqtSlot(browsertab.AbstractTab, str) def on_title_changed(self, tab, text): diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index ca4be6d50..0df47bf76 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -355,6 +355,17 @@ class TabWidget(QTabWidget): if config.val.tabs.tabs_are_windows: self.window().setWindowIcon(self.window().windowIcon()) + def setTabIcon(self, idx: int, icon: QIcon): + """Always show tab icons for pinned tabs in some circumstances.""" + tab = self.widget(idx) + if (icon.isNull() and + config.cache['tabs.favicons.show'] != 'never' and + config.cache['tabs.pinned.shrink'] and + not self.tabBar().vertical and + tab is not None and tab.data.pinned): + icon = self.style().standardIcon(QStyle.SP_FileIcon) + super().setTabIcon(idx, icon) + class TabBar(QTabBar): diff --git a/qutebrowser/misc/__init__.py b/qutebrowser/misc/__init__.py index 2be43490a..5164c0fde 100644 --- a/qutebrowser/misc/__init__.py +++ b/qutebrowser/misc/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/autoupdate.py b/qutebrowser/misc/autoupdate.py index d223bd366..51aa84112 100644 --- a/qutebrowser/misc/autoupdate.py +++ b/qutebrowser/misc/autoupdate.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index 74a2ad372..da9392f3d 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -178,6 +178,10 @@ def _nvidia_shader_workaround(): See https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826 """ assert objects.backend == usertypes.Backend.QtWebEngine, objects.backend + + if os.environ.get('QUTE_SKIP_LIBGL_WORKAROUND'): + return + libgl = ctypes.util.find_library("GL") if libgl is not None: ctypes.CDLL(libgl, mode=ctypes.RTLD_GLOBAL) diff --git a/qutebrowser/misc/checkpyver.py b/qutebrowser/misc/checkpyver.py index cf8e13810..a25098e4d 100644 --- a/qutebrowser/misc/checkpyver.py +++ b/qutebrowser/misc/checkpyver.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -31,7 +31,7 @@ except ImportError: # pragma: no cover try: # Python2 from Tkinter import Tk # type: ignore - import tkMessageBox as messagebox # type: ignore + import tkMessageBox as messagebox # type: ignore # noqa: N813 except ImportError: # Some Python without Tk Tk = None # type: ignore diff --git a/qutebrowser/misc/cmdhistory.py b/qutebrowser/misc/cmdhistory.py index 0a3ac9fa9..ef51b60e1 100644 --- a/qutebrowser/misc/cmdhistory.py +++ b/qutebrowser/misc/cmdhistory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/consolewidget.py b/qutebrowser/misc/consolewidget.py index 661c7b805..138ce76c8 100644 --- a/qutebrowser/misc/consolewidget.py +++ b/qutebrowser/misc/consolewidget.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -162,7 +162,7 @@ class ConsoleWidget(QWidget): namespace = { '__name__': '__console__', '__doc__': None, - 'qApp': QApplication.instance(), + 'q_app': QApplication.instance(), # We use parent as self here because the user "feels" the whole # console, not just the line edit. 'self': parent, diff --git a/qutebrowser/misc/crashdialog.py b/qutebrowser/misc/crashdialog.py index 06a5aabc5..eec9ec955 100644 --- a/qutebrowser/misc/crashdialog.py +++ b/qutebrowser/misc/crashdialog.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/crashsignal.py b/qutebrowser/misc/crashsignal.py index 7890380e8..35f554c4a 100644 --- a/qutebrowser/misc/crashsignal.py +++ b/qutebrowser/misc/crashsignal.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 690ede60f..e8040c670 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -173,8 +173,10 @@ def check_qt_version(): PYQT_VERSION_STR) from pkg_resources import parse_version from qutebrowser.utils import log + parsed_qversion = parse_version(qVersion()) + if (QT_VERSION < 0x050701 or PYQT_VERSION < 0x050700 or - parse_version(qVersion()) < parse_version('5.7.1')): + parsed_qversion < parse_version('5.7.1')): text = ("Fatal error: Qt >= 5.7.1 and PyQt >= 5.7 are required, " "but Qt {} / PyQt {} is installed.".format(qt_version(), PYQT_VERSION_STR)) @@ -184,6 +186,12 @@ def check_qt_version(): log.init.warning("Running qutebrowser with Qt 5.8 is untested and " "unsupported!") + if (parsed_qversion >= parse_version('5.12') and + (PYQT_VERSION < 0x050c00 or QT_VERSION < 0x050c00)): + log.init.warning("Combining PyQt {} with Qt {} is unsupported! Ensure " + "all versions are newer than 5.12 to avoid potential " + "issues.".format(PYQT_VERSION_STR, qt_version())) + def check_ssl_support(): """Check if SSL support is available.""" @@ -199,19 +207,11 @@ def _check_modules(modules): for name, text in modules.items(): try: - # https://github.com/pallets/jinja/pull/628 - # https://bitbucket.org/birkenfeld/pygments-main/issues/1314/ - # https://github.com/pallets/jinja/issues/646 # https://bitbucket.org/fdik/pypeg/commits/dd15ca462b532019c0a3be1d39b8ee2f3fa32f4e - messages = ['invalid escape sequence', - 'Flags not at the start of the expression'] # pylint: disable=bad-continuation with log.ignore_py_warnings( category=DeprecationWarning, - message=r'({})'.format('|'.join(messages)) - ), log.ignore_py_warnings( - category=PendingDeprecationWarning, - module='imp' + message=r'invalid escape sequence' ), log.ignore_py_warnings( category=ImportWarning, message=r'Not importing directory .*: missing __init__' diff --git a/qutebrowser/misc/editor.py b/qutebrowser/misc/editor.py index 3c5b7471e..c5b423708 100644 --- a/qutebrowser/misc/editor.py +++ b/qutebrowser/misc/editor.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/guiprocess.py b/qutebrowser/misc/guiprocess.py index 52dc352a7..ae5e26f1e 100644 --- a/qutebrowser/misc/guiprocess.py +++ b/qutebrowser/misc/guiprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/httpclient.py b/qutebrowser/misc/httpclient.py index 0b162befd..3478884da 100644 --- a/qutebrowser/misc/httpclient.py +++ b/qutebrowser/misc/httpclient.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/ipc.py b/qutebrowser/misc/ipc.py index 3c718de7b..1cf4b9ff0 100644 --- a/qutebrowser/misc/ipc.py +++ b/qutebrowser/misc/ipc.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -65,11 +65,9 @@ def _get_socketname(basedir): data_to_hash = '-'.join(parts_to_hash).encode('utf-8') md5 = hashlib.md5(data_to_hash).hexdigest() - target_dir = standarddir.runtime() - - parts = ['ipc'] - parts.append(md5) - return os.path.join(target_dir, '-'.join(parts)) + prefix = 'i-' if utils.is_mac else 'ipc-' + filename = '{}{}'.format(prefix, md5) + return os.path.join(standarddir.runtime(), filename) class Error(Exception): @@ -209,8 +207,7 @@ class IPCServer(QObject): if not ok: if self._server.serverError() == QAbstractSocket.AddressInUseError: raise AddressInUseError(self._server) - else: - raise ListenError(self._server) + raise ListenError(self._server) if not utils.is_windows: # pragma: no cover # If we use setSocketOptions on Unix with Qt < 5.4, we get a # NameError while listening. @@ -454,19 +451,17 @@ def send_to_running_instance(socketname, command, target_arg, *, socket=None): socket.waitForBytesWritten(WRITE_TIMEOUT) if socket.error() != QLocalSocket.UnknownSocketError: raise SocketError("writing to running instance", socket) - else: - socket.disconnectFromServer() - if socket.state() != QLocalSocket.UnconnectedState: - socket.waitForDisconnected(CONNECT_TIMEOUT) - return True + socket.disconnectFromServer() + if socket.state() != QLocalSocket.UnconnectedState: + socket.waitForDisconnected(CONNECT_TIMEOUT) + return True else: if socket.error() not in [QLocalSocket.ConnectionRefusedError, QLocalSocket.ServerNotFoundError]: raise SocketError("connecting to running instance", socket) - else: - log.ipc.debug("No existing instance present (error {})".format( - socket.error())) - return False + log.ipc.debug("No existing instance present (error {})".format( + socket.error())) + return False def display_error(exc, args): diff --git a/qutebrowser/misc/keyhintwidget.py b/qutebrowser/misc/keyhintwidget.py index 9d3f4c594..7c23b230c 100644 --- a/qutebrowser/misc/keyhintwidget.py +++ b/qutebrowser/misc/keyhintwidget.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/lineparser.py b/qutebrowser/misc/lineparser.py index e9fc67e18..b40532eb2 100644 --- a/qutebrowser/misc/lineparser.py +++ b/qutebrowser/misc/lineparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/miscwidgets.py b/qutebrowser/misc/miscwidgets.py index 085b2fdd1..dd22c220f 100644 --- a/qutebrowser/misc/miscwidgets.py +++ b/qutebrowser/misc/miscwidgets.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/msgbox.py b/qutebrowser/misc/msgbox.py index 053534158..241951b84 100644 --- a/qutebrowser/misc/msgbox.py +++ b/qutebrowser/misc/msgbox.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/objects.py b/qutebrowser/misc/objects.py index 0bb26954c..a400e6cc0 100644 --- a/qutebrowser/misc/objects.py +++ b/qutebrowser/misc/objects.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/pastebin.py b/qutebrowser/misc/pastebin.py index f317670ec..7fc0534c1 100644 --- a/qutebrowser/misc/pastebin.py +++ b/qutebrowser/misc/pastebin.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/readline.py b/qutebrowser/misc/readline.py index 14c25cd6d..9c42d5b02 100644 --- a/qutebrowser/misc/readline.py +++ b/qutebrowser/misc/readline.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/savemanager.py b/qutebrowser/misc/savemanager.py index 9985c5191..384522bf0 100644 --- a/qutebrowser/misc/savemanager.py +++ b/qutebrowser/misc/savemanager.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index 2a557ef50..3901efd4c 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -136,8 +136,7 @@ class SessionManager(QObject): path = os.path.join(self._base_path, name + '.yml') if check_exists and not os.path.exists(path): raise SessionNotFoundError(path) - else: - return path + return path def exists(self, name): """Check if a named session exists.""" diff --git a/qutebrowser/misc/split.py b/qutebrowser/misc/split.py index 31738fbcc..cf3fe4829 100644 --- a/qutebrowser/misc/split.py +++ b/qutebrowser/misc/split.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py index eda778194..03895d31f 100644 --- a/qutebrowser/misc/sql.py +++ b/qutebrowser/misc/sql.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # @@ -112,8 +112,7 @@ def raise_sqlite_error(msg, error): if error_code in environmental_errors or qtbug_70506: raise SqlEnvironmentError(msg, error) - else: - raise SqlBugError(msg, error) + raise SqlBugError(msg, error) def init(db_path): diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index c2b2e6168..1936395c3 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -243,9 +243,8 @@ def log_capacity(capacity: int) -> None: """ if capacity < 0: raise cmdutils.CommandError("Can't set a negative log capacity!") - else: - assert log.ram_handler is not None - log.ram_handler.change_log_capacity(capacity) + assert log.ram_handler is not None + log.ram_handler.change_log_capacity(capacity) @cmdutils.register(debug=True) @@ -311,7 +310,7 @@ def version(win_id, paste=False): """ tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) - tabbed_browser.load_url(QUrl('qute://version'), newtab=True) + tabbed_browser.load_url(QUrl('qute://version/'), newtab=True) if paste: pastebin_version() diff --git a/qutebrowser/qt.py b/qutebrowser/qt.py index d9f1dc58d..823170b29 100644 --- a/qutebrowser/qt.py +++ b/qutebrowser/qt.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/qutebrowser.py b/qutebrowser/qutebrowser.py index f01bf5f18..65b150b3f 100644 --- a/qutebrowser/qutebrowser.py +++ b/qutebrowser/qutebrowser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/__init__.py b/qutebrowser/utils/__init__.py index 16069f3ae..7a062ad2c 100644 --- a/qutebrowser/utils/__init__.py +++ b/qutebrowser/utils/__init__.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/debug.py b/qutebrowser/utils/debug.py index 2868d8390..7bb2d6992 100644 --- a/qutebrowser/utils/debug.py +++ b/qutebrowser/utils/debug.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/docutils.py b/qutebrowser/utils/docutils.py index 9ae2039ac..cf346fb81 100644 --- a/qutebrowser/utils/docutils.py +++ b/qutebrowser/utils/docutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/error.py b/qutebrowser/utils/error.py index b9abcdfe1..fe8077526 100644 --- a/qutebrowser/utils/error.py +++ b/qutebrowser/utils/error.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/javascript.py b/qutebrowser/utils/javascript.py index 6127804a5..42da9759d 100644 --- a/qutebrowser/utils/javascript.py +++ b/qutebrowser/utils/javascript.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py index d2ddfaeb7..24b31a784 100644 --- a/qutebrowser/utils/jinja.py +++ b/qutebrowser/utils/jinja.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 115c53352..4ad995b4e 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/message.py b/qutebrowser/utils/message.py index 6731721aa..b663cbfa4 100644 --- a/qutebrowser/utils/message.py +++ b/qutebrowser/utils/message.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/objreg.py b/qutebrowser/utils/objreg.py index b68ca133c..a00460a34 100644 --- a/qutebrowser/utils/objreg.py +++ b/qutebrowser/utils/objreg.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -304,6 +304,5 @@ def window_by_index(idx): """Get the Nth opened window object.""" if not window_registry: raise NoWindow() - else: - key = sorted(window_registry)[idx] - return window_registry[key] + key = sorted(window_registry)[idx] + return window_registry[key] diff --git a/qutebrowser/utils/qtutils.py b/qutebrowser/utils/qtutils.py index 5373e76aa..f3e513369 100644 --- a/qutebrowser/utils/qtutils.py +++ b/qutebrowser/utils/qtutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -40,7 +40,7 @@ from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray, try: from PyQt5.QtWebKit import qWebKitVersion except ImportError: # pragma: no cover - qWebKitVersion = None # type: ignore + qWebKitVersion = None # type: ignore # noqa: N816 MAXVALS = { @@ -131,13 +131,11 @@ def check_overflow(arg: int, ctype: str, fatal: bool = True) -> int: if arg > maxval: if fatal: raise OverflowError(arg) - else: - return maxval + return maxval elif arg < minval: if fatal: raise OverflowError(arg) - else: - return minval + return minval else: return arg diff --git a/qutebrowser/utils/standarddir.py b/qutebrowser/utils/standarddir.py index 7abb4429d..92d7ef54e 100644 --- a/qutebrowser/utils/standarddir.py +++ b/qutebrowser/utils/standarddir.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/urlmatch.py b/qutebrowser/utils/urlmatch.py index 79e02c37f..6096b3f2b 100644 --- a/qutebrowser/utils/urlmatch.py +++ b/qutebrowser/utils/urlmatch.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -205,7 +205,7 @@ class UrlPattern: if self._host.endswith('.*'): # Special case to have a nicer error raise ParseError("TLD wildcards are not implemented yet") - elif '*' in self._host: + if '*' in self._host: # Only * or *.foo is allowed as host. raise ParseError("Invalid host wildcard") diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index 1acd9cd4e..59cf31348 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 84b7e7f9b..209eb6439 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -200,9 +200,8 @@ class NeighborList(collections.abc.Sequence): """Reset the position to the default.""" if self._default is _UNSET: raise ValueError("No default set!") - else: - self._idx = self._items.index(self._default) - return self.curitem() + self._idx = self._items.index(self._default) + return self.curitem() # The mode of a Question. diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 2d517043a..0629be36e 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -30,6 +30,7 @@ import datetime import traceback import functools import contextlib +import posixpath import socket import shlex import glob @@ -165,6 +166,9 @@ def read_file(filename, binary=False): Return: The file contents as string. """ + assert not posixpath.isabs(filename), filename + assert os.path.pardir not in filename.split(posixpath.sep), filename + if not binary and filename in _resource_cache: return _resource_cache[filename] @@ -655,7 +659,15 @@ def expand_windows_drive(path): def yaml_load(f): """Wrapper over yaml.load using the C loader if possible.""" start = datetime.datetime.now() - data = yaml.load(f, Loader=YamlLoader) + + # WORKAROUND for https://github.com/yaml/pyyaml/pull/181 + with log.ignore_py_warnings( + category=DeprecationWarning, + message=r"Using or importing the ABCs from 'collections' instead " + r"of from 'collections\.abc' is deprecated, and in 3\.8 it will " + r"stop working"): + data = yaml.load(f, Loader=YamlLoader) + end = datetime.datetime.now() delta = (end - start).total_seconds() diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index a52e31ed8..dfe113edc 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -42,7 +42,7 @@ from PyQt5.QtWidgets import QApplication try: from PyQt5.QtWebKit import qWebKitVersion except ImportError: # pragma: no cover - qWebKitVersion = None # type: ignore + qWebKitVersion = None # type: ignore # noqa: N816 try: from PyQt5.QtWebEngineWidgets import QWebEngineProfile @@ -324,7 +324,7 @@ def _chromium_version(): Qt 5.9: Chromium 56 (LTS) 56.0.2924.122 (2017-01-25) - 5.9.6: Security fixes up to 66.0.3359.170 (2018-05-10) + 5.9.7: Security fixes up to 69.0.3497.113 (2018-09-27) Qt 5.10: Chromium 61 61.0.3163.140 (2017-09-05) @@ -332,11 +332,14 @@ def _chromium_version(): Qt 5.11: Chromium 65 65.0.3325.151 (.1: .230) (2018-03-06) - 5.11.2: Security fixes up to 68.0.3440.75 (2018-07-24) + 5.11.3: Security fixes up to 70.0.3538.102 (2018-11-09) Qt 5.12: Chromium 69 - 69.0.3497.128 (~2018-09-17) - 5.12.0: Security fixes up to 70.0.3538.67 (2018-10-16) + (LTS) 69.0.3497.113 (2018-09-27) + 5.12.1: Security fixes up to 71.0.3578.94 (2018-12-14) + 5.12.2: Security fixes up to 72.0.3626.96 (2019-02-06) + + Qt 5.13: (in development) Chromium 71 merged, 73 in review. Also see https://www.chromium.org/developers/calendar and https://chromereleases.googleblog.com/ diff --git a/requirements.txt b/requirements.txt index 68bd341bb..b28d4902d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,10 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -attrs==18.2.0 +attrs==19.1.0 colorama==0.4.1 cssutils==1.0.2 Jinja2==2.10 -MarkupSafe==1.1.0 +MarkupSafe==1.1.1 Pygments==2.3.1 pyPEG2==2.15.2 PyYAML==3.13 diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index c4af174b2..2825c2ac4 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 8591f1c31..8e9346efa 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -218,7 +218,17 @@ def build_windows(): except FileNotFoundError: python_x64 = r'C:\Python{}\python.exe'.format(ver) + try: + reg32_key = winreg.OpenKeyEx(winreg.HKEY_LOCAL_MACHINE, + r'SOFTWARE\WOW6432Node\Python\PythonCore' + r'\{}-32\InstallPath'.format(dot_ver)) + python_x86 = winreg.QueryValueEx(reg32_key, 'ExecutablePath')[0] + except FileNotFoundError: + python_x86 = r'C:\Python{}-32\python.exe'.format(ver) + out_pyinstaller = os.path.join('dist', 'qutebrowser') + out_32 = os.path.join('dist', + 'qutebrowser-{}-x86'.format(qutebrowser.__version__)) out_64 = os.path.join('dist', 'qutebrowser-{}-x64'.format(qutebrowser.__version__)) @@ -228,28 +238,50 @@ def build_windows(): utils.print_title("Updating VersionInfo file") gen_versioninfo.main() + utils.print_title("Running pyinstaller 32bit") + _maybe_remove(out_32) + call_tox('pyinstaller', '-r', python=python_x86) + shutil.move(out_pyinstaller, out_32) + utils.print_title("Running pyinstaller 64bit") _maybe_remove(out_64) call_tox('pyinstaller', '-r', python=python_x64) shutil.move(out_pyinstaller, out_64) + utils.print_title("Running 32bit smoke test") + smoke_test(os.path.join(out_32, 'qutebrowser.exe')) utils.print_title("Running 64bit smoke test") smoke_test(os.path.join(out_64, 'qutebrowser.exe')) utils.print_title("Building installers") subprocess.run(['makensis.exe', + '/DVERSION={}'.format(qutebrowser.__version__), + 'misc/qutebrowser.nsi'], check=True) + subprocess.run(['makensis.exe', '/DX64', '/DVERSION={}'.format(qutebrowser.__version__), 'misc/qutebrowser.nsi'], check=True) + name_32 = 'qutebrowser-{}-win32.exe'.format(qutebrowser.__version__) name_64 = 'qutebrowser-{}-amd64.exe'.format(qutebrowser.__version__) artifacts += [ + (os.path.join('dist', name_32), + 'application/vnd.microsoft.portable-executable', + 'Windows 32bit installer'), (os.path.join('dist', name_64), 'application/vnd.microsoft.portable-executable', 'Windows 64bit installer'), ] + utils.print_title("Zipping 32bit standalone...") + name = 'qutebrowser-{}-windows-standalone-win32'.format( + qutebrowser.__version__) + shutil.make_archive(name, 'zip', 'dist', os.path.basename(out_32)) + artifacts.append(('{}.zip'.format(name), + 'application/zip', + 'Windows 32bit standalone')) + utils.print_title("Zipping 64bit standalone...") name = 'qutebrowser-{}-windows-standalone-amd64'.format( qutebrowser.__version__) diff --git a/scripts/dev/check_coverage.py b/scripts/dev/check_coverage.py index d42ce1d71..fdbbce71a 100644 --- a/scripts/dev/check_coverage.py +++ b/scripts/dev/check_coverage.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -235,11 +235,11 @@ def check(fileobj, perfect_files): """Main entry point which parses/checks coverage.xml if applicable.""" if not utils.is_linux: raise Skipped("on non-Linux system.") - elif '-k' in sys.argv[1:]: + if '-k' in sys.argv[1:]: raise Skipped("because -k is given.") - elif '-m' in sys.argv[1:]: + if '-m' in sys.argv[1:]: raise Skipped("because -m is given.") - elif '--lf' in sys.argv[1:]: + if '--lf' in sys.argv[1:]: raise Skipped("because --lf is given.") perfect_src_files = [e[1] for e in perfect_files] diff --git a/scripts/dev/check_doc_changes.py b/scripts/dev/check_doc_changes.py index 3d90bea5e..37a061da6 100755 --- a/scripts/dev/check_doc_changes.py +++ b/scripts/dev/check_doc_changes.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index c736a01d3..064f4098a 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -53,43 +53,13 @@ npm_install() { travis_retry npm install -g "$@" } -check_pyqt() { - python3 <<EOF -import sys -from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, qVersion -try: - from PyQt.sip import SIP_VERSION_STR -except ModuleNotFoundError: - from sip import SIP_VERSION_STR - -print("Python {}".format(sys.version)) -print("PyQt5 {}".format(PYQT_VERSION_STR)) -print("Qt5 {} (runtime {})".format(QT_VERSION_STR, qVersion())) -print("sip {}".format(SIP_VERSION_STR)) -EOF -} - set -e if [[ -n $DOCKER ]]; then exit 0 elif [[ $TRAVIS_OS_NAME == osx ]]; then - # Disable App Nap - defaults write NSGlobalDomain NSAppSleepDisabled -bool YES - - curl -LO https://bootstrap.pypa.io/get-pip.py - sudo -H python get-pip.py - - brew --version brew update - brew upgrade python libyaml - brew install qt5 pyqt5 - - pip_install -r misc/requirements/requirements-tox.txt - python3 -m pip --version - tox --version - check_pyqt - exit 0 + brew upgrade python fi case $TESTENV in diff --git a/scripts/dev/ci/travis_run.sh b/scripts/dev/ci/travis_run.sh index 4e338221f..eb1248d96 100644 --- a/scripts/dev/ci/travis_run.sh +++ b/scripts/dev/ci/travis_run.sh @@ -26,7 +26,8 @@ elif [[ $TESTENV == shellcheck ]]; then koalaman/shellcheck:latest "${scripts[@]}" else args=() - [[ $TRAVIS_OS_NAME == osx ]] && args=('--qute-bdd-webengine' '--no-xvfb' 'tests/unit') + # We only run unit tests on macOS because it's quite slow. + [[ $TRAVIS_OS_NAME == osx ]] && args+=('--qute-bdd-webengine' '--no-xvfb' 'tests/unit') # WORKAROUND for unknown crash inside swrast_dri.so # See https://github.com/qutebrowser/qutebrowser/pull/4218#issuecomment-421931770 diff --git a/scripts/dev/cleanup.py b/scripts/dev/cleanup.py index d1bb84a2f..7f4f7a36e 100755 --- a/scripts/dev/cleanup.py +++ b/scripts/dev/cleanup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/gen_resources.py b/scripts/dev/gen_resources.py index cbfc69b6f..42ed163c5 100644 --- a/scripts/dev/gen_resources.py +++ b/scripts/dev/gen_resources.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# copyright 2014 florian bruhin (the compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The-Compiler) <me@the-compiler.org> # this file is part of qutebrowser. # diff --git a/scripts/dev/gen_versioninfo.py b/scripts/dev/gen_versioninfo.py index 1aa4b6429..08b28e625 100644 --- a/scripts/dev/gen_versioninfo.py +++ b/scripts/dev/gen_versioninfo.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/get_coredumpctl_traces.py b/scripts/dev/get_coredumpctl_traces.py index d286d381e..8c9fd7ef1 100644 --- a/scripts/dev/get_coredumpctl_traces.py +++ b/scripts/dev/get_coredumpctl_traces.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index 27ff0105b..c1619439b 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/pylint_checkers/qute_pylint/config.py b/scripts/dev/pylint_checkers/qute_pylint/config.py index 5aa52502f..0781ef48c 100644 --- a/scripts/dev/pylint_checkers/qute_pylint/config.py +++ b/scripts/dev/pylint_checkers/qute_pylint/config.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/pylint_checkers/qute_pylint/modeline.py b/scripts/dev/pylint_checkers/qute_pylint/modeline.py index 429974cb9..04bd26fcf 100644 --- a/scripts/dev/pylint_checkers/qute_pylint/modeline.py +++ b/scripts/dev/pylint_checkers/qute_pylint/modeline.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # This file is part of qutebrowser. diff --git a/scripts/dev/pylint_checkers/qute_pylint/openencoding.py b/scripts/dev/pylint_checkers/qute_pylint/openencoding.py index f577011ca..f217f8a70 100644 --- a/scripts/dev/pylint_checkers/qute_pylint/openencoding.py +++ b/scripts/dev/pylint_checkers/qute_pylint/openencoding.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/pylint_checkers/qute_pylint/settrace.py b/scripts/dev/pylint_checkers/qute_pylint/settrace.py index c82d646aa..ba060c8e9 100644 --- a/scripts/dev/pylint_checkers/qute_pylint/settrace.py +++ b/scripts/dev/pylint_checkers/qute_pylint/settrace.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/pylint_checkers/setup.py b/scripts/dev/pylint_checkers/setup.py index 7833c7dbd..331db7d6b 100644 --- a/scripts/dev/pylint_checkers/setup.py +++ b/scripts/dev/pylint_checkers/setup.py @@ -2,7 +2,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py index 6e26145e9..e4aa6229b 100644 --- a/scripts/dev/recompile_requirements.py +++ b/scripts/dev/recompile_requirements.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/run_profile.py b/scripts/dev/run_profile.py index 6f34e819f..ff13da7a3 100755 --- a/scripts/dev/run_profile.py +++ b/scripts/dev/run_profile.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/run_pylint_on_tests.py b/scripts/dev/run_pylint_on_tests.py index d8523a4b4..53528734c 100644 --- a/scripts/dev/run_pylint_on_tests.py +++ b/scripts/dev/run_pylint_on_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index f9262c946..c320d4325 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/dev/segfault_test.py b/scripts/dev/segfault_test.py index aaf495fc1..07c328f0f 100755 --- a/scripts/dev/segfault_test.py +++ b/scripts/dev/segfault_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index 1ba272fba..935b320d0 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -499,7 +499,7 @@ def _format_block(filename, what, data): if not found_start: raise Exception("Marker '// QUTE_{}_START' not found in " "'{}'!".format(what, filename)) - elif not found_end: + if not found_end: raise Exception("Marker '// QUTE_{}_END' not found in " "'{}'!".format(what, filename)) except: diff --git a/scripts/dev/standardpaths_tester.py b/scripts/dev/standardpaths_tester.py index 27b8382e6..f1b90346e 100644 --- a/scripts/dev/standardpaths_tester.py +++ b/scripts/dev/standardpaths_tester.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dev/ua_fetch.py b/scripts/dev/ua_fetch.py index 75ce4c2f7..4bf7b4b6c 100755 --- a/scripts/dev/ua_fetch.py +++ b/scripts/dev/ua_fetch.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 lamarpavel # Copyright 2015-2018 Alexey Nabrodov (Averrin) -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -75,42 +75,17 @@ def filter_list(complete_list, browsers): return table -def add_diversity(table): - """Insert a few additional entries for diversity into the dict. - - (as returned by filter_list()) - """ - table["Obscure"] = [ - ('Mozilla/5.0 (compatible; Googlebot/2.1; ' - '+http://www.google.com/bot.html', - "Google Bot"), - ('Wget/1.16.1 (linux-gnu)', - "wget 1.16.1"), - ('curl/7.40.0', - "curl 7.40.0"), - ('Mozilla/5.0 (Linux; U; Android 7.1.2) AppleWebKit/534.30 ' - '(KHTML, like Gecko) Version/4.0 Mobile Safari/534.30', - "Mobile Generic Android"), - ('Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like ' - 'Gecko', - "IE 11.0 for Desktop Win7 64-bit"), - ] - return table - - def main(): """Generate user agent code.""" fetched = fetch() lut = { - "Firefox": {"Win", "MacOSX", "Linux", "Android"}, - "Chrome": {"Win", "MacOSX", "Linux"}, - "Safari": {"MacOSX", "iOS"} + "Chrome": {"Win10", "Linux"}, } filtered = filter_list(fetched, lut) - filtered = add_diversity(filtered) + filtered["empty"] = [('', "Use default QtWebKit/QtWebEngine User-Agent")] tab = " " - for browser in ["Firefox", "Safari", "Chrome", "Obscure"]: + for browser in ["Chrome", "empty"]: for it in filtered[browser]: print('{}- - "{}"'.format(3 * tab, it[0])) desc = it[1].replace('\xa0', ' ').replace(' ', ' ') diff --git a/scripts/dev/update_3rdparty.py b/scripts/dev/update_3rdparty.py index 277d4eefc..3a777765e 100755 --- a/scripts/dev/update_3rdparty.py +++ b/scripts/dev/update_3rdparty.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015 Daniel Schadt -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/dictcli.py b/scripts/dictcli.py index 4017159b6..6d10b2f3e 100755 --- a/scripts/dictcli.py +++ b/scripts/dictcli.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2017-2018 Michal Siedlaczek <michal.siedlaczek@gmail.com> # This file is part of qutebrowser. diff --git a/scripts/hist_importer.py b/scripts/hist_importer.py index 31936b4c1..680532762 100755 --- a/scripts/hist_importer.py +++ b/scripts/hist_importer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2017-2018 Josefson Souza <josefson.br@gmail.com> # This file is part of qutebrowser. @@ -155,10 +155,10 @@ def run(): if browser not in query: raise Error('Sorry, the selected browser: "{}" is not ' 'supported.'.format(browser)) - else: - history = extract(source, query[browser]) - history = clean(history) - insert_qb(history, dest) + + history = extract(source, query[browser]) + history = clean(history) + insert_qb(history, dest) def main(): diff --git a/scripts/hostblock_blame.py b/scripts/hostblock_blame.py index e5508f515..560c21edb 100644 --- a/scripts/hostblock_blame.py +++ b/scripts/hostblock_blame.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/importer.py b/scripts/importer.py index fd3e4ca0b..592b84d19 100755 --- a/scripts/importer.py +++ b/scripts/importer.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2014-2018 Claude (longneck) <longneck@scratchbook.ch> -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/keytester.py b/scripts/keytester.py index ee5eb347c..b4427fc5c 100644 --- a/scripts/keytester.py +++ b/scripts/keytester.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/link_pyqt.py b/scripts/link_pyqt.py index e16056fa8..b8aa42c43 100644 --- a/scripts/link_pyqt.py +++ b/scripts/link_pyqt.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -121,8 +121,7 @@ def get_lib_path(executable, name, required=True): if required: raise Error("Could not import {} with {}: {}!".format( name, executable, data)) - else: - return None + return None else: raise ValueError("Unexpected output: {!r}".format(output)) diff --git a/scripts/setupcommon.py b/scripts/setupcommon.py index 50eabacd0..1c9b22dcd 100644 --- a/scripts/setupcommon.py +++ b/scripts/setupcommon.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/scripts/testbrowser/testbrowser_webengine.py b/scripts/testbrowser/testbrowser_webengine.py index fdf67286c..8625d482c 100755 --- a/scripts/testbrowser/testbrowser_webengine.py +++ b/scripts/testbrowser/testbrowser_webengine.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/testbrowser/testbrowser_webkit.py b/scripts/testbrowser/testbrowser_webkit.py index 73cae08b1..69c021f89 100755 --- a/scripts/testbrowser/testbrowser_webkit.py +++ b/scripts/testbrowser/testbrowser_webkit.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/scripts/utils.py b/scripts/utils.py index 9a1a751b2..039e46457 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -2,7 +2,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2017 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/conftest.py b/tests/conftest.py index d06dfcfa6..0f84b0ab7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index 3240cc7b8..ff4e7941b 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/data/misc/pyeval_file.py b/tests/end2end/data/misc/pyeval_file.py index 1dadc6853..3800c38e7 100644 --- a/tests/end2end/data/misc/pyeval_file.py +++ b/tests/end2end/data/misc/pyeval_file.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/data/userscripts/stdinclose.py b/tests/end2end/data/userscripts/stdinclose.py index 21a7e6ca1..ab680ed9c 100755 --- a/tests/end2end/data/userscripts/stdinclose.py +++ b/tests/end2end/data/userscripts/stdinclose.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index ca14768ef..95e9f8022 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -20,6 +20,7 @@ """Steps for bdd-like tests.""" import os +import os.path import re import sys import time @@ -27,11 +28,13 @@ import json import logging import collections import textwrap +import subprocess import pytest import pytest_bdd as bdd -from qutebrowser.utils import log, utils +import qutebrowser +from qutebrowser.utils import log, utils, docutils from qutebrowser.browser import pdfjs from helpers import utils as testutils @@ -382,6 +385,32 @@ def clear_ssl_errors(request, quteproc): quteproc.send_cmd(':debug-clear-ssl-errors') +@bdd.when("the documentation is up to date") +def update_documentation(): + """Update the docs before testing :help.""" + base_path = os.path.dirname(os.path.abspath(qutebrowser.__file__)) + doc_path = os.path.join(base_path, 'html', 'doc') + script_path = os.path.join(base_path, '..', 'scripts') + + try: + os.mkdir(doc_path) + except FileExistsError: + pass + + files = os.listdir(doc_path) + if files and all(docutils.docs_up_to_date(p) for p in files): + return + + try: + subprocess.run(['asciidoc'], stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL) + except OSError: + pytest.skip("Docs outdated and asciidoc unavailable!") + + update_script = os.path.join(script_path, 'asciidoc2html.py') + subprocess.run([sys.executable, update_script]) + + ## Then diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index b9677a158..48273bdf8 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -331,19 +331,16 @@ Feature: Various utility commands. When I set content.headers.do_not_track to true And I open headers Then the header Dnt should be set to 1 - And the header X-Do-Not-Track should be set to 1 Scenario: DNT header (off) When I set content.headers.do_not_track to false And I open headers Then the header Dnt should be set to 0 - And the header X-Do-Not-Track should be set to 0 Scenario: DNT header (unset) When I set content.headers.do_not_track to <empty> And I open headers Then the header Dnt should be set to <unset> - And the header X-Do-Not-Track should be set to <unset> Scenario: Accept-Language header When I set content.headers.accept_language to en,de diff --git a/tests/end2end/features/navigate.feature b/tests/end2end/features/navigate.feature index 07bd56c69..2596f3ef1 100644 --- a/tests/end2end/features/navigate.feature +++ b/tests/end2end/features/navigate.feature @@ -24,7 +24,8 @@ Feature: Using :navigate Then data/navigate should be loaded Scenario: Navigating up in qute://help/ - When I open qute://help/commands.html + When the documentation is up to date + And I open qute://help/commands.html And I run :navigate up Then qute://help/ should be loaded diff --git a/tests/end2end/features/qutescheme.feature b/tests/end2end/features/qutescheme.feature index 0f5954e19..35c110dc5 100644 --- a/tests/end2end/features/qutescheme.feature +++ b/tests/end2end/features/qutescheme.feature @@ -8,7 +8,8 @@ Feature: Special qute:// pages # :help Scenario: :help without topic - When I run :tab-only + When the documentation is up to date + And I run :tab-only And I run :help And I wait until qute://help/index.html is loaded Then the following tabs should be open: @@ -39,7 +40,8 @@ Feature: Special qute:// pages - qute://help/settings.html#editor.command (active) Scenario: :help with -t - When I run :tab-only + When the documentation is up to date + And I run :tab-only And I run :help -t And I wait until qute://help/index.html is loaded Then the following tabs should be open: @@ -140,29 +142,25 @@ Feature: Special qute:// pages And I press the key "<Tab>" Then "Invalid value 'foo' *" should be logged - @qtwebkit_skip - Scenario: qute://settings CSRF via img (webengine) + Scenario: qute://settings CSRF via img When I open data/misc/qutescheme_csrf.html And I run :click-element id via-img - Then "Blocking malicious request from http://localhost:*/data/misc/qutescheme_csrf.html to qute://settings/set?*" should be logged + Then the img request should be blocked - @qtwebkit_skip - Scenario: qute://settings CSRF via link (webengine) + Scenario: qute://settings CSRF via link When I open data/misc/qutescheme_csrf.html And I run :click-element id via-link - Then "Blocking malicious request from qute://settings/set?* to qute://settings/set?*" should be logged + Then the link request should be blocked - @qtwebkit_skip - Scenario: qute://settings CSRF via redirect (webengine) + Scenario: qute://settings CSRF via redirect When I open data/misc/qutescheme_csrf.html And I run :click-element id via-redirect - Then "Blocking malicious request from qute://settings/set?* to qute://settings/set?*" should be logged + Then the redirect request should be blocked - @qtwebkit_skip - Scenario: qute://settings CSRF via form (webengine) + Scenario: qute://settings CSRF via form When I open data/misc/qutescheme_csrf.html And I run :click-element id via-form - Then "Blocking malicious request from qute://settings/set?* to qute://settings/set?*" should be logged + Then the form request should be blocked @qtwebkit_skip Scenario: qute://settings CSRF token (webengine) @@ -171,32 +169,6 @@ Feature: Special qute:// pages Then "RequestDeniedError while handling qute://* URL" should be logged And the error "Invalid CSRF token for qute://settings!" should be shown - @qtwebengine_skip - Scenario: qute://settings CSRF via img (webkit) - When I open data/misc/qutescheme_csrf.html - And I run :click-element id via-img - Then "Blocking malicious request from http://localhost:*/data/misc/qutescheme_csrf.html to qute://settings/set?*" should be logged - - @qtwebengine_skip - Scenario: qute://settings CSRF via link (webkit) - When I open data/misc/qutescheme_csrf.html - And I run :click-element id via-link - Then "Blocking malicious request from http://localhost:*/data/misc/qutescheme_csrf.html to qute://settings/set?*" should be logged - And "Error while loading qute://settings/set?*: Invalid qute://settings request" should be logged - - @qtwebengine_skip - Scenario: qute://settings CSRF via redirect (webkit) - When I open data/misc/qutescheme_csrf.html - And I run :click-element id via-redirect - Then "Blocking malicious request from http://localhost:*/data/misc/qutescheme_csrf.html to qute://settings/set?*" should be logged - And "Error while loading qute://settings/set?*: Invalid qute://settings request" should be logged - - @qtwebengine_skip - Scenario: qute://settings CSRF via form (webkit) - When I open data/misc/qutescheme_csrf.html - And I run :click-element id via-form - Then "Error while loading qute://settings/set?*: Unsupported request type" should be logged - # pdfjs support Scenario: pdfjs is used for pdf files diff --git a/tests/end2end/features/sessions.feature b/tests/end2end/features/sessions.feature index 626a88ba8..494feb0ba 100644 --- a/tests/end2end/features/sessions.feature +++ b/tests/end2end/features/sessions.feature @@ -228,7 +228,7 @@ Feature: Saving and loading sessions url: http://localhost:*/data/hello.txt # Seems like that bug is fixed upstream in QtWebEngine - @qtwebkit_skip @flaky + @skip # Too flaky Scenario: Saving a session with a page using history.replaceState() and navigating away When I open data/sessions/history_replace_state.html without waiting And I wait for "* Called history.replaceState" in the log diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 804f72bbf..e029a8eff 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -1357,6 +1357,7 @@ Feature: Tab management And I run :fake-key -g new Then the javascript message "contents: existingnew" should be logged + @flaky Scenario: Focused prompt after opening link in bg When I open data/hints/link_input.html When I run :set-cmd-text -s :message-info @@ -1365,6 +1366,7 @@ Feature: Tab management And I run :command-accept Then the message "hello-world" should be shown + @flaky Scenario: Focused prompt after opening link in fg When I open data/hints/link_input.html When I run :set-cmd-text -s :message-info diff --git a/tests/end2end/features/test_backforward_bdd.py b/tests/end2end/features/test_backforward_bdd.py index 6d9ab626e..d51ddd494 100644 --- a/tests/end2end/features/test_backforward_bdd.py +++ b/tests/end2end/features/test_backforward_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_caret_bdd.py b/tests/end2end/features/test_caret_bdd.py index d444f72b1..b95447baf 100644 --- a/tests/end2end/features/test_caret_bdd.py +++ b/tests/end2end/features/test_caret_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_completion_bdd.py b/tests/end2end/features/test_completion_bdd.py index cd0254a83..ecb7b026e 100644 --- a/tests/end2end/features/test_completion_bdd.py +++ b/tests/end2end/features/test_completion_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py index 4aa58d053..4c4ae3202 100644 --- a/tests/end2end/features/test_downloads_bdd.py +++ b/tests/end2end/features/test_downloads_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_editor_bdd.py b/tests/end2end/features/test_editor_bdd.py index bc1397bf7..b4ed470df 100644 --- a/tests/end2end/features/test_editor_bdd.py +++ b/tests/end2end/features/test_editor_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_hints_bdd.py b/tests/end2end/features/test_hints_bdd.py index d0f25b16f..00fae5d3d 100644 --- a/tests/end2end/features/test_hints_bdd.py +++ b/tests/end2end/features/test_hints_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_history_bdd.py b/tests/end2end/features/test_history_bdd.py index 4d477d832..6b0265cd6 100644 --- a/tests/end2end/features/test_history_bdd.py +++ b/tests/end2end/features/test_history_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_invoke_bdd.py b/tests/end2end/features/test_invoke_bdd.py index 801de132f..5c4992d60 100644 --- a/tests/end2end/features/test_invoke_bdd.py +++ b/tests/end2end/features/test_invoke_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_javascript_bdd.py b/tests/end2end/features/test_javascript_bdd.py index 3753d12ad..69f648eff 100644 --- a/tests/end2end/features/test_javascript_bdd.py +++ b/tests/end2end/features/test_javascript_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_keyinput_bdd.py b/tests/end2end/features/test_keyinput_bdd.py index 67795d437..69586727c 100644 --- a/tests/end2end/features/test_keyinput_bdd.py +++ b/tests/end2end/features/test_keyinput_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_marks_bdd.py b/tests/end2end/features/test_marks_bdd.py index 4734147af..7dd3c3d2b 100644 --- a/tests/end2end/features/test_marks_bdd.py +++ b/tests/end2end/features/test_marks_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_misc_bdd.py b/tests/end2end/features/test_misc_bdd.py index 7d3da36eb..ff686a2e2 100644 --- a/tests/end2end/features/test_misc_bdd.py +++ b/tests/end2end/features/test_misc_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_navigate_bdd.py b/tests/end2end/features/test_navigate_bdd.py index a78042f67..62b6a2f76 100644 --- a/tests/end2end/features/test_navigate_bdd.py +++ b/tests/end2end/features/test_navigate_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_open_bdd.py b/tests/end2end/features/test_open_bdd.py index 8081e1fb0..377c8792f 100644 --- a/tests/end2end/features/test_open_bdd.py +++ b/tests/end2end/features/test_open_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_private_bdd.py b/tests/end2end/features/test_private_bdd.py index f02602d0f..99943ede4 100644 --- a/tests/end2end/features/test_private_bdd.py +++ b/tests/end2end/features/test_private_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_prompts_bdd.py b/tests/end2end/features/test_prompts_bdd.py index 0d74700b4..a13b9644d 100644 --- a/tests/end2end/features/test_prompts_bdd.py +++ b/tests/end2end/features/test_prompts_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_qutescheme_bdd.py b/tests/end2end/features/test_qutescheme_bdd.py index 8706a1a9c..fcdd2cdb5 100644 --- a/tests/end2end/features/test_qutescheme_bdd.py +++ b/tests/end2end/features/test_qutescheme_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -17,40 +17,58 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. -import sys -import os.path -import subprocess - -import pytest import pytest_bdd as bdd -import qutebrowser -from qutebrowser.utils import docutils +from qutebrowser.utils import qtutils -bdd.scenarios('qutescheme.feature') +bdd.scenarios('qutescheme.feature') -@bdd.when("the documentation is up to date") -def update_documentation(): - """Update the docs before testing :help.""" - base_path = os.path.dirname(os.path.abspath(qutebrowser.__file__)) - doc_path = os.path.join(base_path, 'html', 'doc') - script_path = os.path.join(base_path, '..', 'scripts') - try: - os.mkdir(doc_path) - except FileExistsError: - pass +@bdd.then(bdd.parsers.parse("the {kind} request should be blocked")) +def request_blocked(request, quteproc, kind): + blocking_set_msg = ( + "Blocking malicious request from qute://settings/set?* to " + "qute://settings/set?*") + blocking_csrf_msg = ( + "Blocking malicious request from " + "http://localhost:*/data/misc/qutescheme_csrf.html to " + "qute://settings/set?*") + blocking_js_msg = ( + "[http://localhost:*/data/misc/qutescheme_csrf.html:0] Not allowed to " + "load local resource: qute://settings/set?*" + ) - files = os.listdir(doc_path) - if files and all(docutils.docs_up_to_date(p) for p in files): - return + webkit_error_invalid = ( + "Error while loading qute://settings/set?*: Invalid qute://settings " + "request") + webkit_error_unsupported = ( + "Error while loading qute://settings/set?*: Unsupported request type") - try: - subprocess.run(['asciidoc'], stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) - except OSError: - pytest.skip("Docs outdated and asciidoc unavailable!") + if request.config.webengine and qtutils.version_check('5.12'): + # On Qt 5.12, we mark qute:// as a local scheme, causing most requests + # being blocked by Chromium internally (logging to the JS console). + expected_messages = { + 'img': [blocking_js_msg], + 'link': [blocking_js_msg], + 'redirect': [blocking_set_msg], + 'form': [blocking_js_msg], + } + elif request.config.webengine: + expected_messages = { + 'img': [blocking_csrf_msg], + 'link': [blocking_set_msg], + 'redirect': [blocking_set_msg], + 'form': [blocking_set_msg], + } + else: # QtWebKit + expected_messages = { + 'img': [blocking_csrf_msg], + 'link': [blocking_csrf_msg, webkit_error_invalid], + 'redirect': [blocking_csrf_msg, webkit_error_invalid], + 'form': [webkit_error_unsupported], + } - update_script = os.path.join(script_path, 'asciidoc2html.py') - subprocess.run([sys.executable, update_script]) + for pattern in expected_messages[kind]: + msg = quteproc.wait_for(message=pattern) + msg.expected = True diff --git a/tests/end2end/features/test_scroll_bdd.py b/tests/end2end/features/test_scroll_bdd.py index 99de7e8e6..2358aa8a6 100644 --- a/tests/end2end/features/test_scroll_bdd.py +++ b/tests/end2end/features/test_scroll_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_search_bdd.py b/tests/end2end/features/test_search_bdd.py index 9a4e33208..3822f2f1a 100644 --- a/tests/end2end/features/test_search_bdd.py +++ b/tests/end2end/features/test_search_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_sessions_bdd.py b/tests/end2end/features/test_sessions_bdd.py index 942a16425..0b5a32359 100644 --- a/tests/end2end/features/test_sessions_bdd.py +++ b/tests/end2end/features/test_sessions_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_spawn_bdd.py b/tests/end2end/features/test_spawn_bdd.py index d7f72acde..5f45e31eb 100644 --- a/tests/end2end/features/test_spawn_bdd.py +++ b/tests/end2end/features/test_spawn_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_tabs_bdd.py b/tests/end2end/features/test_tabs_bdd.py index 962a41b5b..313ccf57a 100644 --- a/tests/end2end/features/test_tabs_bdd.py +++ b/tests/end2end/features/test_tabs_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_urlmarks_bdd.py b/tests/end2end/features/test_urlmarks_bdd.py index 20364cebd..2980b866e 100644 --- a/tests/end2end/features/test_urlmarks_bdd.py +++ b/tests/end2end/features/test_urlmarks_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_utilcmds_bdd.py b/tests/end2end/features/test_utilcmds_bdd.py index 338c500ca..16be24d1b 100644 --- a/tests/end2end/features/test_utilcmds_bdd.py +++ b/tests/end2end/features/test_utilcmds_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_yankpaste_bdd.py b/tests/end2end/features/test_yankpaste_bdd.py index 364044085..c29ee826e 100644 --- a/tests/end2end/features/test_yankpaste_bdd.py +++ b/tests/end2end/features/test_yankpaste_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/features/test_zoom_bdd.py b/tests/end2end/features/test_zoom_bdd.py index c397fd715..35a7156ee 100644 --- a/tests/end2end/features/test_zoom_bdd.py +++ b/tests/end2end/features/test_zoom_bdd.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index 146817c12..f078c6a55 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -230,6 +230,11 @@ def is_ignored_chromium_message(line): # content.mojom.RendererAudioOutputStreamFactory 'InterfaceRequest was dropped, the document is no longer active: ' 'content.mojom.RendererAudioOutputStreamFactory', + # [1920:2168:0225/112442.664:ERROR:in_progress_cache_impl.cc(124)] + # Could not write download entries to file: C:\Users\appveyor\AppData\ + # Local\Temp\1\qutebrowser-basedir-1l3jmxq4\data\webengine\ + # in_progress_download_metadata_store + 'Could not write download entries to file: *', ] return any(testutils.pattern_match(pattern=pattern, value=message) for pattern in ignored_messages) @@ -819,9 +824,9 @@ class QuteProc(testprocess.Process): message = self.wait_for_js('qute:*').message if message.endswith('qute:no elems'): raise ValueError('No element with {!r} found'.format(text)) - elif message.endswith('qute:ambiguous elems'): + if message.endswith('qute:ambiguous elems'): raise ValueError('Element with {!r} is not unique'.format(text)) - elif not message.endswith('qute:okay'): + if not message.endswith('qute:okay'): raise ValueError('Invalid response from qutebrowser: {}' .format(message)) diff --git a/tests/end2end/fixtures/test_quteprocess.py b/tests/end2end/fixtures/test_quteprocess.py index a0dcaf5ce..20cae3855 100644 --- a/tests/end2end/fixtures/test_quteprocess.py +++ b/tests/end2end/fixtures/test_quteprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/test_testprocess.py b/tests/end2end/fixtures/test_testprocess.py index 5b9979f85..2e9c8ec93 100644 --- a/tests/end2end/fixtures/test_testprocess.py +++ b/tests/end2end/fixtures/test_testprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/test_webserver.py b/tests/end2end/fixtures/test_webserver.py index 8187e32cd..7033135de 100644 --- a/tests/end2end/fixtures/test_webserver.py +++ b/tests/end2end/fixtures/test_webserver.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/testprocess.py b/tests/end2end/fixtures/testprocess.py index eab914a1a..4c2d8d38e 100644 --- a/tests/end2end/fixtures/testprocess.py +++ b/tests/end2end/fixtures/testprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index d1e45409e..12bb789bd 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/webserver_sub.py b/tests/end2end/fixtures/webserver_sub.py index 15cd0becc..92d037cb7 100644 --- a/tests/end2end/fixtures/webserver_sub.py +++ b/tests/end2end/fixtures/webserver_sub.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/fixtures/webserver_sub_ssl.py b/tests/end2end/fixtures/webserver_sub_ssl.py index 41a9c5ace..5aaa44c1b 100644 --- a/tests/end2end/fixtures/webserver_sub_ssl.py +++ b/tests/end2end/fixtures/webserver_sub_ssl.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/test_dirbrowser.py b/tests/end2end/test_dirbrowser.py index 3702c4ee7..1d68e26dc 100644 --- a/tests/end2end/test_dirbrowser.py +++ b/tests/end2end/test_dirbrowser.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Daniel Schadt # # This file is part of qutebrowser. diff --git a/tests/end2end/test_hints_html.py b/tests/end2end/test_hints_html.py index 65502c7b7..230812d1a 100644 --- a/tests/end2end/test_hints_html.py +++ b/tests/end2end/test_hints_html.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/test_insert_mode.py b/tests/end2end/test_insert_mode.py index 690b5d38b..54e011df6 100644 --- a/tests/end2end/test_insert_mode.py +++ b/tests/end2end/test_insert_mode.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -85,3 +85,20 @@ def test_auto_leave_insert_mode(quteproc): # Select the disabled input box to leave insert mode quteproc.send_cmd(':follow-hint s') quteproc.wait_for(message='Clicked non-editable element!') + + +@pytest.mark.parametrize('leave_on_load', [True, False]) +def test_auto_leave_insert_mode_reload(quteproc, leave_on_load): + url_path = 'data/hello.txt' + quteproc.open_path(url_path) + + quteproc.set_setting('input.insert_mode.leave_on_load', + str(leave_on_load).lower()) + quteproc.send_cmd(':enter-mode insert') + quteproc.wait_for(message='Entering mode KeyMode.insert (reason: *)') + quteproc.send_cmd(':reload') + if leave_on_load: + quteproc.wait_for(message='Leaving mode KeyMode.insert (reason: *)') + else: + quteproc.wait_for( + message='Ignoring leave_on_load request due to setting.') diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 0375554b8..5f4056356 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/end2end/test_mhtml_e2e.py b/tests/end2end/test_mhtml_e2e.py index 27fdd2abf..0fe419e00 100644 --- a/tests/end2end/test_mhtml_e2e.py +++ b/tests/end2end/test_mhtml_e2e.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index f993cbf19..f51f221a3 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -171,6 +171,7 @@ def testdata_scheme(qapp): global _qute_scheme_handler from qutebrowser.browser.webengine import webenginequtescheme from PyQt5.QtWebEngineWidgets import QWebEngineProfile + webenginequtescheme.init() _qute_scheme_handler = webenginequtescheme.QuteSchemeHandler( parent=qapp) _qute_scheme_handler.install(QWebEngineProfile.defaultProfile()) diff --git a/tests/helpers/logfail.py b/tests/helpers/logfail.py index 740dd4333..dfe0a5995 100644 --- a/tests/helpers/logfail.py +++ b/tests/helpers/logfail.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/messagemock.py b/tests/helpers/messagemock.py index ee32819dd..421abee32 100644 --- a/tests/helpers/messagemock.py +++ b/tests/helpers/messagemock.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/stubs.py b/tests/helpers/stubs.py index 38d82c004..8a8339977 100644 --- a/tests/helpers/stubs.py +++ b/tests/helpers/stubs.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -301,8 +301,7 @@ class FakeSignal: def __call__(self): if self._func is None: raise TypeError("'FakeSignal' object is not callable") - else: - return self._func() + return self._func() def connect(self, slot): """Connect the signal to a slot. @@ -530,10 +529,9 @@ class TabWidgetStub(QObject): def indexOf(self, _tab): if self.index_of is None: raise ValueError("indexOf got called with index_of None!") - elif self.index_of is RuntimeError: + if self.index_of is RuntimeError: raise RuntimeError - else: - return self.index_of + return self.index_of def currentIndex(self): if self.current_index is None: diff --git a/tests/helpers/test_helper_utils.py b/tests/helpers/test_helper_utils.py index a0f3a0885..3398a7624 100644 --- a/tests/helpers/test_helper_utils.py +++ b/tests/helpers/test_helper_utils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/test_logfail.py b/tests/helpers/test_logfail.py index d84ee4a14..3729cdeed 100644 --- a/tests/helpers/test_logfail.py +++ b/tests/helpers/test_logfail.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/test_stubs.py b/tests/helpers/test_stubs.py index 197148b0c..5afd8603f 100644 --- a/tests/helpers/test_stubs.py +++ b/tests/helpers/test_stubs.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/helpers/utils.py b/tests/helpers/utils.py index 731103b68..2157eaeb1 100644 --- a/tests/helpers/utils.py +++ b/tests/helpers/utils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/test_conftest.py b/tests/test_conftest.py index 2d94add22..daae65de1 100644 --- a/tests/test_conftest.py +++ b/tests/test_conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/api/test_cmdutils.py b/tests/unit/api/test_cmdutils.py index 4116045ae..fb8aba06e 100644 --- a/tests/unit/api/test_cmdutils.py +++ b/tests/unit/api/test_cmdutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/test_caret.py b/tests/unit/browser/test_caret.py index b3706ffca..9b0762e52 100644 --- a/tests/unit/browser/test_caret.py +++ b/tests/unit/browser/test_caret.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/test_hints.py b/tests/unit/browser/test_hints.py index 609fb3dc6..925a3a28a 100644 --- a/tests/unit/browser/test_hints.py +++ b/tests/unit/browser/test_hints.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py index 715b597b0..95edb5d41 100644 --- a/tests/unit/browser/test_history.py +++ b/tests/unit/browser/test_history.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -190,8 +190,7 @@ class TestAdd: def raise_error(url, replace=False): if environmental: raise sql.SqlEnvironmentError("Error message") - else: - raise sql.SqlBugError("Error message") + raise sql.SqlBugError("Error message") if completion: monkeypatch.setattr(web_history.completion, 'insert', raise_error) diff --git a/tests/unit/browser/test_qutescheme.py b/tests/unit/browser/test_qutescheme.py index 0741f38db..0be63fa62 100644 --- a/tests/unit/browser/test_qutescheme.py +++ b/tests/unit/browser/test_qutescheme.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2017-2018 Imran Sobir # # This file is part of qutebrowser. diff --git a/tests/unit/browser/test_shared.py b/tests/unit/browser/test_shared.py index 78302d8c1..541782bc2 100644 --- a/tests/unit/browser/test_shared.py +++ b/tests/unit/browser/test_shared.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -26,18 +26,15 @@ from qutebrowser.browser import shared @pytest.mark.parametrize('dnt, accept_language, custom_headers, expected', [ # DNT - (True, None, {}, {b'DNT': b'1', b'X-Do-Not-Track': b'1'}), - (False, None, {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0'}), + (True, None, {}, {b'DNT': b'1'}), + (False, None, {}, {b'DNT': b'0'}), (None, None, {}, {}), # Accept-Language - (False, 'de, en', {}, {b'DNT': b'0', b'X-Do-Not-Track': b'0', - b'Accept-Language': b'de, en'}), + (False, 'de, en', {}, {b'DNT': b'0', b'Accept-Language': b'de, en'}), # Custom headers - (False, None, {'X-Qute': 'yes'}, {b'DNT': b'0', b'X-Do-Not-Track': b'0', - b'X-Qute': b'yes'}), + (False, None, {'X-Qute': 'yes'}, {b'DNT': b'0', b'X-Qute': b'yes'}), # Mixed (False, 'de, en', {'X-Qute': 'yes'}, {b'DNT': b'0', - b'X-Do-Not-Track': b'0', b'Accept-Language': b'de, en', b'X-Qute': b'yes'}), ]) diff --git a/tests/unit/browser/test_signalfilter.py b/tests/unit/browser/test_signalfilter.py index 8ea800e23..f292ff354 100644 --- a/tests/unit/browser/test_signalfilter.py +++ b/tests/unit/browser/test_signalfilter.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/urlmarks.py b/tests/unit/browser/urlmarks.py index df7b3286d..f216d3491 100644 --- a/tests/unit/browser/urlmarks.py +++ b/tests/unit/browser/urlmarks.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2018-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webengine/test_spell.py b/tests/unit/browser/webengine/test_spell.py index 2fe6ad8ac..80fba1c84 100644 --- a/tests/unit/browser/webengine/test_spell.py +++ b/tests/unit/browser/webengine/test_spell.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2017-2018 Michal Siedlaczek <michal.siedlaczek@gmail.com> # This file is part of qutebrowser. diff --git a/tests/unit/browser/webengine/test_webenginedownloads.py b/tests/unit/browser/webengine/test_webenginedownloads.py index a34962522..aaa869616 100644 --- a/tests/unit/browser/webengine/test_webenginedownloads.py +++ b/tests/unit/browser/webengine/test_webenginedownloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -30,6 +30,8 @@ from helpers import utils @pytest.mark.parametrize('path, expected', [ (os.path.join('subfolder', 'foo'), 'foo'), ('foo(1)', 'foo'), + ('foo (1)', 'foo'), + ('foo - 1970-01-01T00:00:00.000Z', 'foo'), ('foo(a)', 'foo(a)'), ('foo1', 'foo1'), pytest.param('foo%20bar', 'foo bar', marks=utils.qt58), diff --git a/tests/unit/browser/webengine/test_webengineinterceptor.py b/tests/unit/browser/webengine/test_webengineinterceptor.py new file mode 100644 index 000000000..9ea8ddcf5 --- /dev/null +++ b/tests/unit/browser/webengine/test_webengineinterceptor.py @@ -0,0 +1,39 @@ +# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: + +# Copyright 2018-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/>. + +"""Test interceptor.py for webengine.""" + + +import pytest + +pytest.importorskip('PyQt5.QtWebEngineWidgets') + +from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo + +from qutebrowser.browser.webengine import interceptor + + +class TestWebengineInterceptor: + + def test_requestinfo_dict_valid(self): + """Test that the RESOURCE_TYPES dict is not missing any values.""" + qb_keys = interceptor.RequestInterceptor.RESOURCE_TYPES.keys() + qt_keys = {i for i in vars(QWebEngineUrlRequestInfo).values() + if isinstance(i, QWebEngineUrlRequestInfo.ResourceType)} + assert qt_keys == qb_keys diff --git a/tests/unit/browser/webengine/test_webenginesettings.py b/tests/unit/browser/webengine/test_webenginesettings.py index d40002a77..7eea8ffa7 100644 --- a/tests/unit/browser/webengine/test_webenginesettings.py +++ b/tests/unit/browser/webengine/test_webenginesettings.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webengine/test_webenginetab.py b/tests/unit/browser/webengine/test_webenginetab.py index 50bbdf716..380bb8641 100644 --- a/tests/unit/browser/webengine/test_webenginetab.py +++ b/tests/unit/browser/webengine/test_webenginetab.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -25,8 +25,10 @@ import pytest QtWebEngineWidgets = pytest.importorskip("PyQt5.QtWebEngineWidgets") QWebEnginePage = QtWebEngineWidgets.QWebEnginePage QWebEngineScriptCollection = QtWebEngineWidgets.QWebEngineScriptCollection +QWebEngineScript = QtWebEngineWidgets.QWebEngineScript from qutebrowser.browser import greasemonkey +from qutebrowser.utils import usertypes pytestmark = pytest.mark.usefixtures('greasemonkey_manager') @@ -91,3 +93,26 @@ class TestWebengineScripts: collection = webengine_scripts._widget.page().scripts() assert collection.toList()[-1].worldId() == worldid + + def test_greasemonkey_document_end_workaround(self, monkeypatch, + webengine_scripts): + """Make sure document-end is forced when needed.""" + monkeypatch.setattr(greasemonkey.objects, 'backend', + usertypes.Backend.QtWebEngine) + monkeypatch.setattr(greasemonkey.qtutils, 'version_check', + lambda version, exact=False, compiled=True: + True) + + scripts = [ + greasemonkey.GreasemonkeyScript([ + ('name', 'Iridium'), + ('namespace', 'https://github.com/ParticleCore'), + ('run-at', 'document-start'), + ], None) + ] + + webengine_scripts._inject_greasemonkey_scripts(scripts) + + collection = webengine_scripts._widget.page().scripts() + script = collection.toList()[-1] + assert script.injectionPoint() == QWebEngineScript.DocumentReady diff --git a/tests/unit/browser/webkit/http/test_content_disposition.py b/tests/unit/browser/webkit/http/test_content_disposition.py index c85174b6a..92ad037bb 100644 --- a/tests/unit/browser/webkit/http/test_content_disposition.py +++ b/tests/unit/browser/webkit/http/test_content_disposition.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/http/test_http.py b/tests/unit/browser/webkit/http/test_http.py index 161efd482..5cc71c18a 100644 --- a/tests/unit/browser/webkit/http/test_http.py +++ b/tests/unit/browser/webkit/http/test_http.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/http/test_http_hypothesis.py b/tests/unit/browser/webkit/http/test_http_hypothesis.py index 5727bf1bc..85ee1fa3d 100644 --- a/tests/unit/browser/webkit/http/test_http_hypothesis.py +++ b/tests/unit/browser/webkit/http/test_http_hypothesis.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/network/test_filescheme.py b/tests/unit/browser/webkit/network/test_filescheme.py index 2654097ea..c477ead23 100644 --- a/tests/unit/browser/webkit/network/test_filescheme.py +++ b/tests/unit/browser/webkit/network/test_filescheme.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Antoni Boucher (antoyo) <bouanto@zoho.com> # # This file is part of qutebrowser. diff --git a/tests/unit/browser/webkit/network/test_networkmanager.py b/tests/unit/browser/webkit/network/test_networkmanager.py index f6701b419..5a6a19ac6 100644 --- a/tests/unit/browser/webkit/network/test_networkmanager.py +++ b/tests/unit/browser/webkit/network/test_networkmanager.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/network/test_networkreply.py b/tests/unit/browser/webkit/network/test_networkreply.py index 6dffa87cf..0dc9482ec 100644 --- a/tests/unit/browser/webkit/network/test_networkreply.py +++ b/tests/unit/browser/webkit/network/test_networkreply.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/network/test_pac.py b/tests/unit/browser/webkit/network/test_pac.py index 5aebecbf2..c06f9d8c2 100644 --- a/tests/unit/browser/webkit/network/test_pac.py +++ b/tests/unit/browser/webkit/network/test_pac.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/test_cache.py b/tests/unit/browser/webkit/test_cache.py index 3fcc833d8..e0fabda0f 100644 --- a/tests/unit/browser/webkit/test_cache.py +++ b/tests/unit/browser/webkit/test_cache.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 lamarpavel # # This file is part of qutebrowser. diff --git a/tests/unit/browser/webkit/test_cookies.py b/tests/unit/browser/webkit/test_cookies.py index 99e6d9edc..fbe4427ad 100644 --- a/tests/unit/browser/webkit/test_cookies.py +++ b/tests/unit/browser/webkit/test_cookies.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Alexander Cogneau (acogneau) <alexander.cogneau@gmail.com>: # # This file is part of qutebrowser. diff --git a/tests/unit/browser/webkit/test_downloads.py b/tests/unit/browser/webkit/test_downloads.py index 1ab80ec65..95ec826fb 100644 --- a/tests/unit/browser/webkit/test_downloads.py +++ b/tests/unit/browser/webkit/test_downloads.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/test_mhtml.py b/tests/unit/browser/webkit/test_mhtml.py index 015e90b3f..0ad88362c 100644 --- a/tests/unit/browser/webkit/test_mhtml.py +++ b/tests/unit/browser/webkit/test_mhtml.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Daniel Schadt # # This file is part of qutebrowser. diff --git a/tests/unit/browser/webkit/test_tabhistory.py b/tests/unit/browser/webkit/test_tabhistory.py index 84a535fa0..a05bc0f98 100644 --- a/tests/unit/browser/webkit/test_tabhistory.py +++ b/tests/unit/browser/webkit/test_tabhistory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/browser/webkit/test_webkitelem.py b/tests/unit/browser/webkit/test_webkitelem.py index 17eae9c09..811276876 100644 --- a/tests/unit/browser/webkit/test_webkitelem.py +++ b/tests/unit/browser/webkit/test_webkitelem.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/commands/test_argparser.py b/tests/unit/commands/test_argparser.py index 0b6afc210..6852e872a 100644 --- a/tests/unit/commands/test_argparser.py +++ b/tests/unit/commands/test_argparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/commands/test_runners.py b/tests/unit/commands/test_runners.py index cd2dea1d4..f73783352 100644 --- a/tests/unit/commands/test_runners.py +++ b/tests/unit/commands/test_runners.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/commands/test_userscripts.py b/tests/unit/commands/test_userscripts.py index ff6b9a558..280450b68 100644 --- a/tests/unit/commands/test_userscripts.py +++ b/tests/unit/commands/test_userscripts.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -65,8 +65,7 @@ def runner(request, runtime_tmpdir): request.param is userscripts._POSIXUserscriptRunner): pytest.skip("Requires a POSIX os") raise utils.Unreachable - else: - return request.param() + return request.param() def test_command(qtbot, py_proc, runner): diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index 224268c90..d22c3a81e 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/completion/test_completiondelegate.py b/tests/unit/completion/test_completiondelegate.py index 7d310380e..77fe05291 100644 --- a/tests/unit/completion/test_completiondelegate.py +++ b/tests/unit/completion/test_completiondelegate.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2018-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/completion/test_completionmodel.py b/tests/unit/completion/test_completionmodel.py index 24f5bdf0d..6feb911da 100644 --- a/tests/unit/completion/test_completionmodel.py +++ b/tests/unit/completion/test_completionmodel.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # @@ -41,7 +41,7 @@ def test_first_last_item(counts): cat = mock.Mock(spec=['layoutChanged', 'layoutAboutToBeChanged']) cat.rowCount = mock.Mock(return_value=c, spec=[]) model.add_category(cat) - data = [i for i, rowCount in enumerate(counts) if rowCount > 0] + data = [i for i, row_count in enumerate(counts) if row_count > 0] if not data: # with no items, first and last should be an invalid index assert not model.first_item().isValid() diff --git a/tests/unit/completion/test_completionwidget.py b/tests/unit/completion/test_completionwidget.py index 3d66e1145..0ac91b8a8 100644 --- a/tests/unit/completion/test_completionwidget.py +++ b/tests/unit/completion/test_completionwidget.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/completion/test_histcategory.py b/tests/unit/completion/test_histcategory.py index 02a6cfd1e..8fd48f429 100644 --- a/tests/unit/completion/test_histcategory.py +++ b/tests/unit/completion/test_histcategory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/completion/test_listcategory.py b/tests/unit/completion/test_listcategory.py index 36ea74e41..64b3611e2 100644 --- a/tests/unit/completion/test_listcategory.py +++ b/tests/unit/completion/test_listcategory.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2017-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/completion/test_models.py b/tests/unit/completion/test_models.py index 9e75daae8..24e53648e 100644 --- a/tests/unit/completion/test_models.py +++ b/tests/unit/completion/test_models.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/components/test_adblock.py b/tests/unit/components/test_adblock.py index f37b57962..d63c802c8 100644 --- a/tests/unit/components/test_adblock.py +++ b/tests/unit/components/test_adblock.py @@ -30,7 +30,7 @@ from PyQt5.QtCore import QUrl from qutebrowser.components import adblock from qutebrowser.utils import urlmatch -from tests.helpers import utils +from helpers import utils pytestmark = pytest.mark.usefixtures('qapp') diff --git a/tests/unit/components/test_misccommands.py b/tests/unit/components/test_misccommands.py index 95eb0c6e3..09d9d6703 100644 --- a/tests/unit/components/test_misccommands.py +++ b/tests/unit/components/test_misccommands.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 946770bf1..5e15903b2 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configcache.py b/tests/unit/config/test_configcache.py index 7c0f6012f..d88a71292 100644 --- a/tests/unit/config/test_configcache.py +++ b/tests/unit/config/test_configcache.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Jay Kamat <jaygkamat@gmail.com>: +# Copyright 2018-2019 Jay Kamat <jaygkamat@gmail.com> # # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py index 21c01ea5c..e7140bd11 100644 --- a/tests/unit/config/test_configcommands.py +++ b/tests/unit/config/test_configcommands.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configdata.py b/tests/unit/config/test_configdata.py index 61fc66653..1a24b7e75 100644 --- a/tests/unit/config/test_configdata.py +++ b/tests/unit/config/test_configdata.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configexc.py b/tests/unit/config/test_configexc.py index 98ab19396..f3f86a6dd 100644 --- a/tests/unit/config/test_configexc.py +++ b/tests/unit/config/test_configexc.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index 79d4b9d89..9609cdafa 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 40f143086..2d868779d 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index b0b85d997..7d7021770 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -38,7 +38,7 @@ from qutebrowser.config import configtypes, configexc, configutils from qutebrowser.utils import debug, utils, qtutils, urlmatch from qutebrowser.browser.network import pac from qutebrowser.keyinput import keyutils -from tests.helpers import utils as testutils +from helpers import utils as testutils class Font(QFont): diff --git a/tests/unit/config/test_configutils.py b/tests/unit/config/test_configutils.py index e8a7bfb38..5fad71110 100644 --- a/tests/unit/config/test_configutils.py +++ b/tests/unit/config/test_configutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/extensions/test_loader.py b/tests/unit/extensions/test_loader.py index 5265c7cdf..2b7c65238 100644 --- a/tests/unit/extensions/test_loader.py +++ b/tests/unit/extensions/test_loader.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/javascript/conftest.py b/tests/unit/javascript/conftest.py index 486839237..c9c14546f 100644 --- a/tests/unit/javascript/conftest.py +++ b/tests/unit/javascript/conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -27,7 +27,7 @@ import jinja2 from PyQt5.QtCore import QUrl -from qutebrowser.utils import utils +import qutebrowser class JSTester: @@ -90,15 +90,16 @@ class JSTester: if not force: assert blocker.args == [True] - def run_file(self, filename: str, expected=None) -> None: + def run_file(self, path: str, expected=None) -> None: """Run a javascript file. Args: - filename: The javascript filename, relative to - qutebrowser/javascript. + path: The path to the JS file, relative to the qutebrowser package. expected: The value expected return from the javascript execution """ - source = utils.read_file(os.path.join('javascript', filename)) + base_path = os.path.dirname(os.path.abspath(qutebrowser.__file__)) + with open(os.path.join(base_path, path), 'r', encoding='utf-8') as f: + source = f.read() self.run(source, expected) def run(self, source: str, expected, world=None) -> None: diff --git a/tests/unit/javascript/position_caret/test_position_caret.py b/tests/unit/javascript/position_caret/test_position_caret.py index 9aeaca345..6b50e5f62 100644 --- a/tests/unit/javascript/position_caret/test_position_caret.py +++ b/tests/unit/javascript/position_caret/test_position_caret.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -50,7 +50,7 @@ class CaretTester: def check(self): """Check whether the caret is before the MARKER text.""" - self.js.run_file('position_caret.js') + self.js.run_file('javascript/position_caret.js') self.js.tab.caret.toggle_selection() self.js.tab.caret.move_to_next_word() diff --git a/tests/unit/javascript/stylesheet/test_stylesheet.py b/tests/unit/javascript/stylesheet/test_stylesheet.py index 145e8ee5e..768ffaeb9 100644 --- a/tests/unit/javascript/stylesheet/test_stylesheet.py +++ b/tests/unit/javascript/stylesheet/test_stylesheet.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Jay Kamat +# Copyright 2017-2019 Jay Kamat <jaygkamat@gmail.com> # # This file is part of qutebrowser. # @@ -25,7 +25,7 @@ import pytest QtWebEngineWidgets = pytest.importorskip("PyQt5.QtWebEngineWidgets") QWebEngineProfile = QtWebEngineWidgets.QWebEngineProfile -from qutebrowser.utils import javascript, qtutils +from qutebrowser.utils import javascript DEFAULT_BODY_BG = "rgba(0, 0, 0, 0)" @@ -128,11 +128,9 @@ def test_set_error(stylesheet_tester, config_stub): stylesheet_tester.check_set(GREEN_BODY_BG) -@pytest.mark.skip(qtutils.version_check('5.12', compiled=False), - reason='Broken with Qt 5.12') def test_appendchild(stylesheet_tester): stylesheet_tester.js.load('stylesheet/simple.html') stylesheet_tester.init_stylesheet() - js_test_file_path = ('../../tests/unit/javascript/stylesheet/' + js_test_file_path = ('../tests/unit/javascript/stylesheet/' 'test_appendchild.js') stylesheet_tester.js.run_file(js_test_file_path, {}) diff --git a/tests/unit/javascript/test_greasemonkey.py b/tests/unit/javascript/test_greasemonkey.py index f5f3d7972..12244db4e 100644 --- a/tests/unit/javascript/test_greasemonkey.py +++ b/tests/unit/javascript/test_greasemonkey.py @@ -1,5 +1,5 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # @@ -25,6 +25,7 @@ import pytest import py.path # pylint: disable=no-name-in-module from PyQt5.QtCore import QUrl +from qutebrowser.utils import usertypes from qutebrowser.browser import greasemonkey test_gm_script = r""" @@ -165,6 +166,56 @@ def test_utf8_bom(): assert '// ==UserScript==' in script.code().splitlines() +class TestForceDocumentEnd: + + @pytest.fixture + def patch(self, monkeypatch): + def _patch(*, backend, qt_512): + monkeypatch.setattr(greasemonkey.objects, 'backend', backend) + monkeypatch.setattr(greasemonkey.qtutils, 'version_check', + lambda version, exact=False, compiled=True: + qt_512) + return _patch + + def _get_script(self, *, namespace, name): + source = textwrap.dedent(""" + // ==UserScript== + // @namespace {} + // @name {} + // ==/UserScript== + """.format(namespace, name)) + _save_script(source, 'force.user.js') + + gm_manager = greasemonkey.GreasemonkeyManager() + + scripts = gm_manager.all_scripts() + assert len(scripts) == 1 + return scripts[0] + + @pytest.mark.parametrize('backend, qt_512', [ + (usertypes.Backend.QtWebKit, True), + (usertypes.Backend.QtWebEngine, False), + ]) + def test_not_applicable(self, patch, backend, qt_512): + """Test backend/Qt version combinations which don't need a fix.""" + patch(backend=backend, qt_512=qt_512) + script = self._get_script(namespace='https://github.com/ParticleCore', + name='Iridium') + assert not script.needs_document_end_workaround() + + @pytest.mark.parametrize('namespace, name, force', [ + ('http://userstyles.org', 'foobar', True), + ('https://github.com/ParticleCore', 'Iridium', True), + ('https://github.com/ParticleCore', 'Foo', False), + ('https://example.org', 'Iridium', False), + ]) + def test_matching(self, patch, namespace, name, force): + """Test matching based on namespace/name.""" + patch(backend=usertypes.Backend.QtWebEngine, qt_512=True) + script = self._get_script(namespace=namespace, name=name) + assert script.needs_document_end_workaround() == force + + def test_required_scripts_are_included(download_stub, tmpdir): test_require_script = textwrap.dedent(""" // ==UserScript== diff --git a/tests/unit/javascript/test_js_execution.py b/tests/unit/javascript/test_js_execution.py index 1a0ac8dc5..4f37ec473 100644 --- a/tests/unit/javascript/test_js_execution.py +++ b/tests/unit/javascript/test_js_execution.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/keyinput/conftest.py b/tests/unit/keyinput/conftest.py index 045b62336..4ce6f1e8f 100644 --- a/tests/unit/keyinput/conftest.py +++ b/tests/unit/keyinput/conftest.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: # # This file is part of qutebrowser. # diff --git a/tests/unit/keyinput/key_data.py b/tests/unit/keyinput/key_data.py index 48b5c8c56..ab12f2d78 100644 --- a/tests/unit/keyinput/key_data.py +++ b/tests/unit/keyinput/key_data.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/keyinput/test_basekeyparser.py b/tests/unit/keyinput/test_basekeyparser.py index 764c83e1f..133da3090 100644 --- a/tests/unit/keyinput/test_basekeyparser.py +++ b/tests/unit/keyinput/test_basekeyparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: # # This file is part of qutebrowser. # diff --git a/tests/unit/keyinput/test_keyutils.py b/tests/unit/keyinput/test_keyutils.py index d6e7bce34..8156c89ae 100644 --- a/tests/unit/keyinput/test_keyutils.py +++ b/tests/unit/keyinput/test_keyutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -26,7 +26,7 @@ from PyQt5.QtCore import Qt, QEvent, pyqtSignal from PyQt5.QtGui import QKeyEvent, QKeySequence from PyQt5.QtWidgets import QWidget -from tests.unit.keyinput import key_data +from unit.keyinput import key_data from qutebrowser.keyinput import keyutils from qutebrowser.utils import utils diff --git a/tests/unit/keyinput/test_modeman.py b/tests/unit/keyinput/test_modeman.py index 25b3fc776..8171c0518 100644 --- a/tests/unit/keyinput/test_modeman.py +++ b/tests/unit/keyinput/test_modeman.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/keyinput/test_modeparsers.py b/tests/unit/keyinput/test_modeparsers.py index 72f32af32..436843960 100644 --- a/tests/unit/keyinput/test_modeparsers.py +++ b/tests/unit/keyinput/test_modeparsers.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org>: # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/statusbar/test_backforward.py b/tests/unit/mainwindow/statusbar/test_backforward.py index 11e3da616..3a1f43a6a 100644 --- a/tests/unit/mainwindow/statusbar/test_backforward.py +++ b/tests/unit/mainwindow/statusbar/test_backforward.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/statusbar/test_percentage.py b/tests/unit/mainwindow/statusbar/test_percentage.py index c7b5b9fe2..1488ab827 100644 --- a/tests/unit/mainwindow/statusbar/test_percentage.py +++ b/tests/unit/mainwindow/statusbar/test_percentage.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/statusbar/test_progress.py b/tests/unit/mainwindow/statusbar/test_progress.py index 5b01aebbf..151ec99ca 100644 --- a/tests/unit/mainwindow/statusbar/test_progress.py +++ b/tests/unit/mainwindow/statusbar/test_progress.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/statusbar/test_tabindex.py b/tests/unit/mainwindow/statusbar/test_tabindex.py index 352089099..4f9003885 100644 --- a/tests/unit/mainwindow/statusbar/test_tabindex.py +++ b/tests/unit/mainwindow/statusbar/test_tabindex.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/statusbar/test_textbase.py b/tests/unit/mainwindow/statusbar/test_textbase.py index 7ebc4e327..7e66c0197 100644 --- a/tests/unit/mainwindow/statusbar/test_textbase.py +++ b/tests/unit/mainwindow/statusbar/test_textbase.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -83,7 +83,7 @@ def test_text_elide_none(mocker, qtbot): 'fontMetrics') label._update_elided_text(20) - assert not label.fontMetrics.called # pylint: disable=no-member + assert not label.fontMetrics.called def test_unset_text(qtbot): diff --git a/tests/unit/mainwindow/statusbar/test_url.py b/tests/unit/mainwindow/statusbar/test_url.py index 7d06cb774..5c3a65437 100644 --- a/tests/unit/mainwindow/statusbar/test_url.py +++ b/tests/unit/mainwindow/statusbar/test_url.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Clayton Craft (craftyguy) <craftyguy@gmail.com> +# Copyright 2016-2019 Clayton Craft (craftyguy) <craftyguy@gmail.com> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/test_messageview.py b/tests/unit/mainwindow/test_messageview.py index cd7c40bc3..fabbdf22a 100644 --- a/tests/unit/mainwindow/test_messageview.py +++ b/tests/unit/mainwindow/test_messageview.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/test_prompt.py b/tests/unit/mainwindow/test_prompt.py index 7c8d2b0ad..f20668ed4 100644 --- a/tests/unit/mainwindow/test_prompt.py +++ b/tests/unit/mainwindow/test_prompt.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index e2bcf9b29..a16bda246 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Daniel Schadt # # This file is part of qutebrowser. @@ -84,7 +85,7 @@ class TestTabWidget: widget.addTab(fake_web_tab(), 'foobar' + str(i)) # Set pinned title format longer than unpinned - config_stub.val.tabs.title.format_pinned = "_" * 20 + config_stub.val.tabs.title.format_pinned = "_" * 10 config_stub.val.tabs.title.format = "_" * 2 config_stub.val.tabs.pinned.shrink = shrink_pinned if vertical: diff --git a/tests/unit/misc/test_autoupdate.py b/tests/unit/misc/test_autoupdate.py index d4a69a115..2c56e23ce 100644 --- a/tests/unit/misc/test_autoupdate.py +++ b/tests/unit/misc/test_autoupdate.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2015-2018 Alexander Cogneau (acogneau) <alexander.cogneau@gmail.com>: # # This file is part of qutebrowser. diff --git a/tests/unit/misc/test_checkpyver.py b/tests/unit/misc/test_checkpyver.py index a02e2f8e0..0b1b7ef94 100644 --- a/tests/unit/misc/test_checkpyver.py +++ b/tests/unit/misc/test_checkpyver.py @@ -1,4 +1,4 @@ -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # This file is part of qutebrowser. diff --git a/tests/unit/misc/test_cmdhistory.py b/tests/unit/misc/test_cmdhistory.py index 8204feb0e..eb6ce5215 100644 --- a/tests/unit/misc/test_cmdhistory.py +++ b/tests/unit/misc/test_cmdhistory.py @@ -1,7 +1,7 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2015-2019 Florian Bruhin (The-Compiler) <me@the-compiler.org> # Copyright 2015-2018 Alexander Cogneau (acogneau) <alexander.cogneau@gmail.com> -# Copyright 2015-2018 Florian Bruhin (The-Compiler) <me@the-compiler.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_crashdialog.py b/tests/unit/misc/test_crashdialog.py index a34192b88..bea09c4e1 100644 --- a/tests/unit/misc/test_crashdialog.py +++ b/tests/unit/misc/test_crashdialog.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_earlyinit.py b/tests/unit/misc/test_earlyinit.py index 0882e610f..2cb1d1bcd 100644 --- a/tests/unit/misc/test_earlyinit.py +++ b/tests/unit/misc/test_earlyinit.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The-Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_editor.py b/tests/unit/misc/test_editor.py index 7c13691e7..84879f07e 100644 --- a/tests/unit/misc/test_editor.py +++ b/tests/unit/misc/test_editor.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_guiprocess.py b/tests/unit/misc/test_guiprocess.py index cfedab9fe..4eb7039d8 100644 --- a/tests/unit/misc/test_guiprocess.py +++ b/tests/unit/misc/test_guiprocess.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index 29ca0ff9d..78c8b9764 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -34,7 +34,7 @@ from PyQt5.QtTest import QSignalSpy import qutebrowser from qutebrowser.misc import ipc -from qutebrowser.utils import standarddir, utils, qtutils +from qutebrowser.utils import standarddir, utils from helpers import stubs @@ -98,7 +98,7 @@ class FakeSocket(QObject): _connect_successful: The value returned for waitForConnected(). """ - readyRead = pyqtSignal() + readyRead = pyqtSignal() # noqa: N815 disconnected = pyqtSignal() def __init__(self, *, error=QLocalSocket.UnknownSocketError, state=None, @@ -177,11 +177,6 @@ def md5(inp): class TestSocketName: - POSIX_TESTS = [ - (None, 'ipc-{}'.format(md5('testusername'))), - ('/x', 'ipc-{}'.format(md5('testusername-/x'))), - ] - WINDOWS_TESTS = [ (None, 'qutebrowser-testusername'), ('/x', 'qutebrowser-testusername-{}'.format(md5('/x'))), @@ -203,7 +198,10 @@ class TestSocketName: assert socketname == expected @pytest.mark.mac - @pytest.mark.parametrize('basedir, expected', POSIX_TESTS) + @pytest.mark.parametrize('basedir, expected', [ + (None, 'i-{}'.format(md5('testusername'))), + ('/x', 'i-{}'.format(md5('testusername-/x'))), + ]) def test_mac(self, basedir, expected): socketname = ipc._get_socketname(basedir) parts = socketname.split(os.sep) @@ -211,7 +209,10 @@ class TestSocketName: assert parts[-1] == expected @pytest.mark.linux - @pytest.mark.parametrize('basedir, expected', POSIX_TESTS) + @pytest.mark.parametrize('basedir, expected', [ + (None, 'ipc-{}'.format(md5('testusername'))), + ('/x', 'ipc-{}'.format(md5('testusername-/x'))), + ]) def test_linux(self, basedir, fake_runtime_dir, expected): socketname = ipc._get_socketname(basedir) expected_path = str(fake_runtime_dir / 'qutebrowser' / expected) @@ -630,8 +631,6 @@ class TestSendOrListen: assert ret_client is None @pytest.mark.posix(reason="Unneeded on Windows") - @pytest.mark.xfail(qtutils.version_check('5.12', compiled=False) and - utils.is_mac, reason="Broken, see #4471") def test_correct_socket_name(self, args): server = ipc.send_or_listen(args) expected_dir = ipc._get_socketname(args.basedir) diff --git a/tests/unit/misc/test_keyhints.py b/tests/unit/misc/test_keyhints.py index 9af30fd16..821a61fe3 100644 --- a/tests/unit/misc/test_keyhints.py +++ b/tests/unit/misc/test_keyhints.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_lineparser.py b/tests/unit/misc/test_lineparser.py index 10575e676..0af165a70 100644 --- a/tests/unit/misc/test_lineparser.py +++ b/tests/unit/misc/test_lineparser.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_miscwidgets.py b/tests/unit/misc/test_miscwidgets.py index d5c1183a5..59de8bdb3 100644 --- a/tests/unit/misc/test_miscwidgets.py +++ b/tests/unit/misc/test_miscwidgets.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_msgbox.py b/tests/unit/misc/test_msgbox.py index e2fd7bffe..c402ecf6c 100644 --- a/tests/unit/misc/test_msgbox.py +++ b/tests/unit/misc/test_msgbox.py @@ -1,4 +1,4 @@ -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # This file is part of qutebrowser. diff --git a/tests/unit/misc/test_objects.py b/tests/unit/misc/test_objects.py index 8d3c934c8..0ab46ed3b 100644 --- a/tests/unit/misc/test_objects.py +++ b/tests/unit/misc/test_objects.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_pastebin.py b/tests/unit/misc/test_pastebin.py index cbd6f4c3e..ea0ebf028 100644 --- a/tests/unit/misc/test_pastebin.py +++ b/tests/unit/misc/test_pastebin.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2016-2019 Florian Bruhin (The-Compiler) <me@the-compiler.org> # Copyright 2016-2018 Anna Kobak (avk) <awerk@onet.eu>: # # This file is part of qutebrowser. diff --git a/tests/unit/misc/test_readline.py b/tests/unit/misc/test_readline.py index 6aedc0951..687b97b03 100644 --- a/tests/unit/misc/test_readline.py +++ b/tests/unit/misc/test_readline.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_sessions.py b/tests/unit/misc/test_sessions.py index e2676b4e7..8bb8155c6 100644 --- a/tests/unit/misc/test_sessions.py +++ b/tests/unit/misc/test_sessions.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_split.py b/tests/unit/misc/test_split.py index d6d388f8b..352dd085d 100644 --- a/tests/unit/misc/test_split.py +++ b/tests/unit/misc/test_split.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_split_hypothesis.py b/tests/unit/misc/test_split_hypothesis.py index c8d6d5147..e6de1b740 100644 --- a/tests/unit/misc/test_split_hypothesis.py +++ b/tests/unit/misc/test_split_hypothesis.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_sql.py b/tests/unit/misc/test_sql.py index dff6144cc..6b1ee6c9e 100644 --- a/tests/unit/misc/test_sql.py +++ b/tests/unit/misc/test_sql.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> +# Copyright 2016-2019 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net> # # This file is part of qutebrowser. # diff --git a/tests/unit/misc/test_utilcmds.py b/tests/unit/misc/test_utilcmds.py index 1b71d5ddc..f5bd2747c 100644 --- a/tests/unit/misc/test_utilcmds.py +++ b/tests/unit/misc/test_utilcmds.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -89,4 +89,4 @@ def tabbed_browser(stubs, win_registry): def test_version(tabbed_browser, qapp): utilcmds.version(win_id=0) - assert tabbed_browser.loaded_url == QUrl('qute://version') + assert tabbed_browser.loaded_url == QUrl('qute://version/') diff --git a/tests/unit/scripts/test_check_coverage.py b/tests/unit/scripts/test_check_coverage.py index 026479e38..86e4ece4e 100644 --- a/tests/unit/scripts/test_check_coverage.py +++ b/tests/unit/scripts/test_check_coverage.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/scripts/test_dictcli.py b/tests/unit/scripts/test_dictcli.py index 4df65ead6..1b6a2b4ff 100644 --- a/tests/unit/scripts/test_dictcli.py +++ b/tests/unit/scripts/test_dictcli.py @@ -1,5 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: +# Copyright 2017-2019 Florian Bruhin (The-Compiler) <me@the-compiler.org> # Copyright 2017-2018 Michal Siedlaczek <michal.siedlaczek@gmail.com> # This file is part of qutebrowser. diff --git a/tests/unit/scripts/test_importer.py b/tests/unit/scripts/test_importer.py index ada0d886c..eeeb7d084 100644 --- a/tests/unit/scripts/test_importer.py +++ b/tests/unit/scripts/test_importer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2017-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2017-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/scripts/test_run_vulture.py b/tests/unit/scripts/test_run_vulture.py index c33a7f616..111785fc9 100644 --- a/tests/unit/scripts/test_run_vulture.py +++ b/tests/unit/scripts/test_run_vulture.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # This file is part of qutebrowser. # diff --git a/tests/unit/test_app.py b/tests/unit/test_app.py index 3d7555bc4..e57fe2b97 100644 --- a/tests/unit/test_app.py +++ b/tests/unit/test_app.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -30,7 +30,7 @@ def test_on_focus_changed_issue1484(monkeypatch, qapp, caplog): For some reason, Qt sometimes calls on_focus_changed() with a QBuffer as argument. Let's make sure we handle that gracefully. """ - monkeypatch.setattr(app, 'qApp', qapp) + monkeypatch.setattr(app, 'q_app', qapp) buf = QBuffer() app.on_focus_changed(buf, buf) diff --git a/tests/unit/utils/overflow_test_cases.py b/tests/unit/utils/overflow_test_cases.py index c13f3da5c..2018c7daa 100644 --- a/tests/unit/utils/overflow_test_cases.py +++ b/tests/unit/utils/overflow_test_cases.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_debug.py b/tests/unit/utils/test_debug.py index bb93cbf10..abf250087 100644 --- a/tests/unit/utils/test_debug.py +++ b/tests/unit/utils/test_debug.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # diff --git a/tests/unit/utils/test_error.py b/tests/unit/utils/test_error.py index 42a090c75..580c344c9 100644 --- a/tests/unit/utils/test_error.py +++ b/tests/unit/utils/test_error.py @@ -1,4 +1,4 @@ -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # This file is part of qutebrowser. diff --git a/tests/unit/utils/test_javascript.py b/tests/unit/utils/test_javascript.py index f5a2e6261..ea0e564f5 100644 --- a/tests/unit/utils/test_javascript.py +++ b/tests/unit/utils/test_javascript.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_jinja.py b/tests/unit/utils/test_jinja.py index 34b821dcd..5bc96e0e9 100644 --- a/tests/unit/utils/test_jinja.py +++ b/tests/unit/utils/test_jinja.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # diff --git a/tests/unit/utils/test_log.py b/tests/unit/utils/test_log.py index a20e335ca..a8793232d 100644 --- a/tests/unit/utils/test_log.py +++ b/tests/unit/utils/test_log.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_qtutils.py b/tests/unit/utils/test_qtutils.py index 3b625b3a5..e30200bbc 100644 --- a/tests/unit/utils/test_qtutils.py +++ b/tests/unit/utils/test_qtutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -153,8 +153,7 @@ class QtObject: """Get the fake error, or raise AttributeError if set to None.""" if self._error is None: raise AttributeError - else: - return self._error + return self._error def isValid(self): return self._valid diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 5962c8f22..8f8f67baa 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_urlmatch.py b/tests/unit/utils/test_urlmatch.py index 1dd57a5e9..70f7f02f4 100644 --- a/tests/unit/utils/test_urlmatch.py +++ b/tests/unit/utils/test_urlmatch.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2018-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py index 1c1efffab..e9758531a 100644 --- a/tests/unit/utils/test_urlutils.py +++ b/tests/unit/utils/test_urlutils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py index 37bd9faaa..014725fa2 100644 --- a/tests/unit/utils/test_utils.py +++ b/tests/unit/utils/test_utils.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py index c21ea0624..f18532d13 100644 --- a/tests/unit/utils/test_version.py +++ b/tests/unit/utils/test_version.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/usertypes/test_misc.py b/tests/unit/utils/usertypes/test_misc.py index 631321278..1700b7f51 100644 --- a/tests/unit/utils/usertypes/test_misc.py +++ b/tests/unit/utils/usertypes/test_misc.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2016-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/usertypes/test_neighborlist.py b/tests/unit/utils/usertypes/test_neighborlist.py index 7ee1725c2..587dffbd2 100644 --- a/tests/unit/utils/usertypes/test_neighborlist.py +++ b/tests/unit/utils/usertypes/test_neighborlist.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2014-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/usertypes/test_question.py b/tests/unit/utils/usertypes/test_question.py index 09a55329f..13eb13e60 100644 --- a/tests/unit/utils/usertypes/test_question.py +++ b/tests/unit/utils/usertypes/test_question.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # diff --git a/tests/unit/utils/usertypes/test_timer.py b/tests/unit/utils/usertypes/test_timer.py index 928e9d6a8..1f940ed81 100644 --- a/tests/unit/utils/usertypes/test_timer.py +++ b/tests/unit/utils/usertypes/test_timer.py @@ -1,6 +1,6 @@ # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: -# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# Copyright 2015-2019 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py36-pyqt511-cov,misc,vulture,flake8,pylint,pyroma,check-manifest,eslint +envlist = py37-pyqt512-cov,misc,vulture,flake8,pylint,pyroma,check-manifest,eslint distshare = {toxworkdir} skipsdist = true @@ -13,8 +13,8 @@ skipsdist = true setenv = QT_QPA_PLATFORM_PLUGIN_PATH={envdir}/Lib/site-packages/PyQt5/plugins/platforms PYTEST_QT_API=pyqt5 - pyqt{,56,571,59,510,511}: LINK_PYQT_SKIP=true - pyqt{,56,571,59,510,511}: QUTE_BDD_WEBENGINE=true + pyqt{,56,571,59,510,511,512}: LINK_PYQT_SKIP=true + pyqt{,56,571,59,510,511,512}: QUTE_BDD_WEBENGINE=true cov: PYTEST_ADDOPTS=--cov --cov-report xml --cov-report=html --cov-report= passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER CI TRAVIS XDG_* QUTE_* DOCKER QT_QUICK_BACKEND basepython = @@ -29,6 +29,7 @@ deps = pyqt59: PyQt5==5.9.2 pyqt510: PyQt5==5.10.1 pyqt511: PyQt5==5.11.3 + pyqt512: PyQtWebEngine==5.12 commands = {envpython} scripts/link_pyqt.py --tox {envdir} {envpython} -bb -m pytest {posargs:tests} |