From 4f443c9f276c730835a572ece408b1581250cb5a Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Sat, 1 Oct 2016 12:55:55 +0200 Subject: [PATCH 01/68] Reserve space for favicon with vertical tabs --- qutebrowser/mainwindow/tabwidget.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index baeb7d620..d02d41407 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -609,8 +609,11 @@ class TabBarStyle(QCommonStyle): # any sophisticated drawing. super().drawControl(QStyle.CE_TabBarTabShape, opt, p, widget) elif element == QStyle.CE_TabBarTabLabel: + position = config.get('tabs', 'position') if not opt.icon.isNull() and layouts.icon.isValid(): self._draw_icon(layouts, opt, p) + elif position in [QTabWidget.West, QTabWidget.East]: + layouts.text.translate(opt.iconSize.width() + 4, 0) alignment = (config.get('tabs', 'title-alignment') | Qt.AlignVCenter | Qt.TextHideMnemonic) self._style.drawItemText(p, layouts.text, alignment, opt.palette, From df83862088ae870313c1d08e852d32a5d25b3134 Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Mon, 3 Oct 2016 13:14:49 +0200 Subject: [PATCH 02/68] Reserve space for empty favicon in _get_icon_rect. --- qutebrowser/mainwindow/tabwidget.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index d02d41407..276c40fdd 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -609,11 +609,8 @@ class TabBarStyle(QCommonStyle): # any sophisticated drawing. super().drawControl(QStyle.CE_TabBarTabShape, opt, p, widget) elif element == QStyle.CE_TabBarTabLabel: - position = config.get('tabs', 'position') if not opt.icon.isNull() and layouts.icon.isValid(): self._draw_icon(layouts, opt, p) - elif position in [QTabWidget.West, QTabWidget.East]: - layouts.text.translate(opt.iconSize.width() + 4, 0) alignment = (config.get('tabs', 'title-alignment') | Qt.AlignVCenter | Qt.TextHideMnemonic) self._style.drawItemText(p, layouts.text, alignment, opt.palette, @@ -706,13 +703,10 @@ class TabBarStyle(QCommonStyle): text_rect.adjust(indicator_width + indicator_padding.left + indicator_padding.right, 0, 0, 0) - if opt.icon.isNull(): - icon_rect = QRect() - else: + icon_rect = self._get_icon_rect(opt, text_rect) + if icon_rect.isValid(): icon_padding = self.pixelMetric(PixelMetrics.icon_padding, opt) - icon_rect = self._get_icon_rect(opt, text_rect) - if icon_rect.isValid(): - text_rect.adjust(icon_rect.width() + icon_padding, 0, 0, 0) + text_rect.adjust(icon_rect.width() + icon_padding, 0, 0, 0) text_rect = self._style.visualRect(opt.direction, opt.rect, text_rect) return Layouts(text=text_rect, icon=icon_rect, @@ -736,9 +730,17 @@ class TabBarStyle(QCommonStyle): else QIcon.Disabled) icon_state = (QIcon.On if opt.state & QStyle.State_Selected else QIcon.Off) - tab_icon_size = opt.icon.actualSize(icon_size, icon_mode, icon_state) - tab_icon_size = QSize(min(tab_icon_size.width(), icon_size.width()), - min(tab_icon_size.height(), icon_size.height())) + # reserve space for favicon when tab bar is vertical (issue #1968) + position = config.get('tabs', 'position') + show_favicons = config.get('tabs', 'show-favicons') + if (opt.icon.isNull() + and position in [QTabWidget.East, QTabWidget.West] + and show_favicons): + tab_icon_size = icon_size + else: + actual_size = opt.icon.actualSize(icon_size, icon_mode, icon_state) + tab_icon_size = QSize(min(actual_size.width(), icon_size.width()), + min(actual_size.height(), icon_size.height())) icon_rect = QRect(text_rect.left(), text_rect.top() + 1, tab_icon_size.width(), tab_icon_size.height()) icon_rect = self._style.visualRect(opt.direction, opt.rect, icon_rect) From b107522d8c2b76cbca476886d5a5b7a2e168c3e8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Oct 2016 08:51:10 +0200 Subject: [PATCH 03/68] Make cssutils a lazy import Importing cssutils takes more than a second on the 2009 Thinkpad with a Core2 I'm on right now, so let's only import it when actually necessary. --- qutebrowser/browser/webkit/mhtml.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/qutebrowser/browser/webkit/mhtml.py b/qutebrowser/browser/webkit/mhtml.py index cc9d75d00..2a282cb0b 100644 --- a/qutebrowser/browser/webkit/mhtml.py +++ b/qutebrowser/browser/webkit/mhtml.py @@ -37,14 +37,6 @@ from PyQt5.QtCore import QUrl from qutebrowser.browser.webkit import webkitelem, downloads from qutebrowser.utils import log, objreg, message, usertypes, utils, urlutils -try: - import cssutils -except (ImportError, re.error): - # Catching re.error because cssutils in earlier releases (<= 1.0) is broken - # on Python 3.5 - # See https://bitbucket.org/cthedot/cssutils/issues/52 - cssutils = None - _File = collections.namedtuple('_File', ['content', 'content_type', 'content_location', 'transfer_encoding']) @@ -85,6 +77,14 @@ def _get_css_imports_cssutils(data, inline=False): data: The content of the stylesheet to scan as string. inline: True if the argument is an inline HTML style attribute. """ + try: + import cssutils + except (ImportError, re.error): + # Catching re.error because cssutils in earlier releases (<= 1.0) is broken + # on Python 3.5 + # See https://bitbucket.org/cthedot/cssutils/issues/52 + return None + # We don't care about invalid CSS data, this will only litter the log # output with CSS errors parser = cssutils.CSSParser(loglevel=100, @@ -114,10 +114,10 @@ def _get_css_imports(data, inline=False): data: The content of the stylesheet to scan as string. inline: True if the argument is an inline HTML style attribute. """ - if cssutils is None: - return _get_css_imports_regex(data) - else: - return _get_css_imports_cssutils(data, inline) + imports = _get_css_imports_cssutils(data, inline) + if imports is None: + imports = _get_css_imports_regex(data) + return imports def _check_rel(element): From f34d896ff4f745d153edd26802c63be3913265d6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 4 Oct 2016 10:26:44 +0200 Subject: [PATCH 04/68] Log total initialization time --- qutebrowser/app.py | 6 +++++- qutebrowser/misc/earlyinit.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 345d49b97..2dc9ae95f 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -50,7 +50,8 @@ from qutebrowser.browser.webkit import cookies, cache, downloads from qutebrowser.browser.webkit.network import (webkitqutescheme, proxy, networkmanager) from qutebrowser.mainwindow import mainwindow -from qutebrowser.misc import readline, ipc, savemanager, sessions, crashsignal +from qutebrowser.misc import (readline, ipc, savemanager, sessions, crashsignal, + earlyinit) from qutebrowser.misc import utilcmds # pylint: disable=unused-import from qutebrowser.utils import (log, version, message, utils, qtutils, urlutils, objreg, usertypes, standarddir, error, debug) @@ -198,6 +199,9 @@ def _process_args(args): _open_startpage() _open_quickstart(args) + delta = datetime.datetime.now() - earlyinit.START_TIME + log.init.debug("Init finished after {}s".format(delta.total_seconds())) + def _load_session(name): """Load the default session. diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index dd498edf3..08c933a6e 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -37,6 +37,7 @@ import signal import operator import importlib import pkg_resources +import datetime try: import tkinter except ImportError: @@ -45,6 +46,9 @@ except ImportError: # initialization needs to take place before that! +START_TIME = datetime.datetime.now() + + def _missing_str(name, *, windows=None, pip=None, webengine=False): """Get an error string for missing packages. From 2696f9b4273d565f064075757e5e2b9a83be39ce Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Tue, 4 Oct 2016 07:36:49 -0400 Subject: [PATCH 05/68] Handle unicode characters in Completer. Just limit the cursor position to the length of the text to avoid crashes in this case. Resolves #2007. --- qutebrowser/completion/completer.py | 1 + tests/end2end/features/completion.feature | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 21f7b99ce..0c83a4976 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -157,6 +157,7 @@ class Completer(QObject): result = runner.parse(text, fallback=True, keep=True) parts = [x for x in result.cmdline if x] pos = self._cmd.cursorPosition() - len(self._cmd.prefix()) + pos = min(pos, len(text)) log.completion.debug('partitioning {} around position {}'.format(parts, pos)) for i, part in enumerate(parts): diff --git a/tests/end2end/features/completion.feature b/tests/end2end/features/completion.feature index 18f2141d8..4fec2d81b 100644 --- a/tests/end2end/features/completion.feature +++ b/tests/end2end/features/completion.feature @@ -22,3 +22,8 @@ Feature: Command bar completion # Make sure qutebrowser doesn't hang And I run :message-info "Still alive!" Then the message "Still alive!" should be shown + + Scenario: Crash when pasting emoji into the command line (#2007) + Given I open about:blank + When I run :set-cmd-text -s :🌀 + Then no crash should happen From 0f84ea233989d48a59499d7579ab496566804e3e Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Tue, 4 Oct 2016 16:34:52 +0200 Subject: [PATCH 06/68] Fix TabWidget unit test (add show-favicons config option) --- tests/unit/mainwindow/test_tabwidget.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/unit/mainwindow/test_tabwidget.py b/tests/unit/mainwindow/test_tabwidget.py index 00f8b290d..bb84521d0 100644 --- a/tests/unit/mainwindow/test_tabwidget.py +++ b/tests/unit/mainwindow/test_tabwidget.py @@ -41,6 +41,7 @@ class TestTabWidget: 'position': 0, 'select-on-remove': 1, 'show': 'always', + 'show-favicons': True, 'padding': configtypes.PaddingValues(0, 0, 5, 5), 'indicator-width': 3, 'indicator-padding': configtypes.PaddingValues(2, 2, 0, 4), From f0cc168609da38105cf56fd0b711be08c1b5065d Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Tue, 4 Oct 2016 16:45:31 +0200 Subject: [PATCH 07/68] Style changes --- qutebrowser/mainwindow/tabwidget.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 276c40fdd..657a38dc3 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -732,15 +732,15 @@ class TabBarStyle(QCommonStyle): else QIcon.Off) # reserve space for favicon when tab bar is vertical (issue #1968) position = config.get('tabs', 'position') - show_favicons = config.get('tabs', 'show-favicons') - if (opt.icon.isNull() - and position in [QTabWidget.East, QTabWidget.West] - and show_favicons): + if (opt.icon.isNull() and + position in [QTabWidget.East, QTabWidget.West] and + config.get('tabs', 'show-favicons')): tab_icon_size = icon_size else: actual_size = opt.icon.actualSize(icon_size, icon_mode, icon_state) - tab_icon_size = QSize(min(actual_size.width(), icon_size.width()), - min(actual_size.height(), icon_size.height())) + tab_icon_size = QSize( + min(actual_size.width(), icon_size.width()), + min(actual_size.height(), icon_size.height())) icon_rect = QRect(text_rect.left(), text_rect.top() + 1, tab_icon_size.width(), tab_icon_size.height()) icon_rect = self._style.visualRect(opt.direction, opt.rect, icon_rect) From 9ca4ff896de98b836244bcef1cdd54d849c7240c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 07:11:20 +0200 Subject: [PATCH 08/68] flake8 requirements: Update pydocstyle to 1.1.1 --- misc/requirements/requirements-flake8.txt | 2 +- misc/requirements/requirements-flake8.txt-raw | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index 855a5d7ea..bd8665e47 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -19,7 +19,7 @@ pbr==1.10.0 pep8==1.7.0 pep8-naming==0.4.1 pycodestyle==2.0.0 -pydocstyle==1.0.0 # rq.filter: != 1.1.0 +pydocstyle==1.1.1 pyflakes==1.3.0 pyparsing==2.1.9 six==1.10.0 diff --git a/misc/requirements/requirements-flake8.txt-raw b/misc/requirements/requirements-flake8.txt-raw index 29e2e7c6f..442ed2d54 100644 --- a/misc/requirements/requirements-flake8.txt-raw +++ b/misc/requirements/requirements-flake8.txt-raw @@ -12,7 +12,7 @@ flake8-tidy-imports flake8-tuple hacking pep8-naming -pydocstyle!=1.1.0 +pydocstyle pyflakes # Pinned to 1.5.7 by hacking otherwise @@ -23,6 +23,3 @@ pep8==1.7.0 # https://github.com/JBKahn/flake8-debugger/issues/5 #@ filter: flake8-debugger != 2.0.0 - -# https://gitlab.com/pycqa/flake8-docstrings/issues/16 -#@ filter: pydocstyle != 1.1.0 From 2f0db878e6c377abbc682934cac3e47423add39f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 09:07:35 +0200 Subject: [PATCH 09/68] Break long lines --- qutebrowser/app.py | 4 ++-- qutebrowser/browser/webkit/mhtml.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 2dc9ae95f..68397bbd3 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -50,8 +50,8 @@ from qutebrowser.browser.webkit import cookies, cache, downloads from qutebrowser.browser.webkit.network import (webkitqutescheme, proxy, networkmanager) from qutebrowser.mainwindow import mainwindow -from qutebrowser.misc import (readline, ipc, savemanager, sessions, crashsignal, - earlyinit) +from qutebrowser.misc import (readline, ipc, savemanager, sessions, + crashsignal, earlyinit) from qutebrowser.misc import utilcmds # pylint: disable=unused-import from qutebrowser.utils import (log, version, message, utils, qtutils, urlutils, objreg, usertypes, standarddir, error, debug) diff --git a/qutebrowser/browser/webkit/mhtml.py b/qutebrowser/browser/webkit/mhtml.py index 2a282cb0b..41d4e7355 100644 --- a/qutebrowser/browser/webkit/mhtml.py +++ b/qutebrowser/browser/webkit/mhtml.py @@ -80,8 +80,8 @@ def _get_css_imports_cssutils(data, inline=False): try: import cssutils except (ImportError, re.error): - # Catching re.error because cssutils in earlier releases (<= 1.0) is broken - # on Python 3.5 + # Catching re.error because cssutils in earlier releases (<= 1.0) is + # broken on Python 3.5 # See https://bitbucket.org/cthedot/cssutils/issues/52 return None From 8dab1cf58ac26655419e6fb0a1aab655771e6fa5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 09:09:42 +0200 Subject: [PATCH 10/68] Fix test_mhtml.py --- tests/unit/browser/webkit/test_mhtml.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unit/browser/webkit/test_mhtml.py b/tests/unit/browser/webkit/test_mhtml.py index 7ea3d999e..a87b1ad56 100644 --- a/tests/unit/browser/webkit/test_mhtml.py +++ b/tests/unit/browser/webkit/test_mhtml.py @@ -26,6 +26,15 @@ import pytest mhtml = pytest.importorskip('qutebrowser.browser.webkit.mhtml') +try: + import cssutils +except (ImportError, re.error): + # Catching re.error because cssutils in earlier releases (<= 1.0) is + # broken on Python 3.5 + # See https://bitbucket.org/cthedot/cssutils/issues/52 + cssutils = None + + @pytest.fixture(autouse=True) def patch_uuid(monkeypatch): monkeypatch.setattr("uuid.uuid4", lambda: "UUID") @@ -248,8 +257,7 @@ def test_empty_content_type(checker): @pytest.mark.parametrize('has_cssutils', [ - pytest.mark.skipif(mhtml.cssutils is None, - reason="requires cssutils")(True), + pytest.mark.skipif(cssutils is None, reason="requires cssutils")(True), False, ], ids=['with_cssutils', 'no_cssutils']) @pytest.mark.parametrize('inline, style, expected_urls', [ From dd537c91190dc7e395e57287579253cbf21d278b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 10:12:38 +0200 Subject: [PATCH 11/68] Really fix test_mthml --- tests/unit/browser/webkit/test_mhtml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/browser/webkit/test_mhtml.py b/tests/unit/browser/webkit/test_mhtml.py index a87b1ad56..3b33857e9 100644 --- a/tests/unit/browser/webkit/test_mhtml.py +++ b/tests/unit/browser/webkit/test_mhtml.py @@ -275,7 +275,8 @@ def test_empty_content_type(checker): def test_css_url_scanner(monkeypatch, has_cssutils, inline, style, expected_urls): if not has_cssutils: - monkeypatch.setattr('qutebrowser.browser.webkit.mhtml.cssutils', None) + monkeypatch.setattr(mhtml, '_get_css_imports_cssutils', + lambda data, inline=False: None) expected_urls.sort() urls = mhtml._get_css_imports(style, inline=inline) urls.sort() From c36ae5ab8f99c9141aa2f0877b922b074bfb09ab Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 10:13:01 +0200 Subject: [PATCH 12/68] Fix quit confirmation text for downloads --- qutebrowser/mainwindow/mainwindow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/mainwindow.py b/qutebrowser/mainwindow/mainwindow.py index 593ed04bd..ebc4f28ad 100644 --- a/qutebrowser/mainwindow/mainwindow.py +++ b/qutebrowser/mainwindow/mainwindow.py @@ -503,8 +503,8 @@ class MainWindow(QWidget): # Ask if multiple downloads running if 'downloads' in confirm_quit and download_count > 0: quit_texts.append("{} {} running.".format( - tab_count, - "download is" if tab_count == 1 else "downloads are")) + download_count, + "download is" if download_count == 1 else "downloads are")) # Process all quit messages that user must confirm if quit_texts or 'always' in confirm_quit: text = '\n'.join(['Really quit?'] + quit_texts) From e3c92a9bae7987a3bd7d1555a5e59bdfcd19c8d5 Mon Sep 17 00:00:00 2001 From: Kevin Velghe Date: Wed, 5 Oct 2016 12:03:52 +0200 Subject: [PATCH 13/68] Set netrc location with QUTE_NETRC --- qutebrowser/browser/webkit/network/networkmanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/browser/webkit/network/networkmanager.py b/qutebrowser/browser/webkit/network/networkmanager.py index 04ce58975..151c06829 100644 --- a/qutebrowser/browser/webkit/network/networkmanager.py +++ b/qutebrowser/browser/webkit/network/networkmanager.py @@ -330,7 +330,7 @@ class NetworkManager(QNetworkAccessManager): # altogether. reply.netrc_used = True try: - net = netrc.netrc() + net = netrc.netrc(os.environ.get('QUTE_NETRC')) authenticators = net.authenticators(reply.url().host()) if authenticators is not None: (user, _account, password) = authenticators From 93f8f6ef4f2e333cee43af2a9fd76fff2bf5410c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 12:53:34 +0200 Subject: [PATCH 14/68] travis: Add El Capiton/Yosemite OS X builds --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 84f61df7f..77942e091 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,11 @@ matrix: env: DOCKER=ubuntu-xenial services: docker - os: osx - env: TESTENV=py35 + env: TESTENV=py35 OSX=elcapitan + osx_image: xcode7.3 + - os: osx + env: TESTENV=py35 OSX=yosemite + osx_image: xcode6.4 - os: linux env: TESTENV=pylint - os: linux From 04d2d6024195ffaa74b0c2748e05757451370346 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 12:53:59 +0200 Subject: [PATCH 15/68] travis: Remove custom OS X Qt builds --- scripts/dev/ci/travis_install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index 435af6389..aa6890a45 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -88,10 +88,8 @@ if [[ $DOCKER ]]; then elif [[ $TRAVIS_OS_NAME == osx ]]; then # Disable App Nap defaults write NSGlobalDomain NSAppSleepDisabled -bool YES - curl -LO https://github.com/The-Compiler/homebrew-qt5-webkit/releases/download/v5.6.0-1/pyqt5-5.6.el_capitan.bottle.1.tar.gz - curl -LO https://github.com/The-Compiler/homebrew-qt5-webkit/releases/download/v5.6.1_1-1/qt5-5.6.1-1.yosemite.bottle.1.tar.gz brew --version - brew_install python3 {qt5,pyqt5}-*.bottle.1.tar.gz + brew_install python3 qt5 pyqt5 pip_install pip pip_install tox pip --version From 197e3732d885830664820857d153f71406c94696 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 13:10:31 +0200 Subject: [PATCH 16/68] travis: Install pip on OS X It seems pip isn't preinstalled on the newest image. --- scripts/dev/ci/travis_install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index aa6890a45..9c3a47ac8 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -88,6 +88,10 @@ if [[ $DOCKER ]]; then 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_install python3 qt5 pyqt5 pip_install pip From bce5fc529b99e32ccd94aaa836e46dd765825418 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 13:20:33 +0200 Subject: [PATCH 17/68] travis: Don't try to upgrade pip on OS X We will run into (probably?) system integrity protection. --- scripts/dev/ci/travis_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dev/ci/travis_install.sh b/scripts/dev/ci/travis_install.sh index 9c3a47ac8..4edb587a4 100644 --- a/scripts/dev/ci/travis_install.sh +++ b/scripts/dev/ci/travis_install.sh @@ -94,7 +94,7 @@ elif [[ $TRAVIS_OS_NAME == osx ]]; then brew --version brew_install python3 qt5 pyqt5 - pip_install pip + pip_install tox pip --version tox --version From 8fdc609b326d4ab15849743a06c16d7a0461d12f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 13:26:44 +0200 Subject: [PATCH 18/68] Improve error for inhibited key test --- tests/end2end/features/hints.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 08e6d718a..3bdc2f600 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -185,7 +185,7 @@ Feature: Using hints Scenario: Ignoring key presses after auto-following hints When I set hints -> auto-follow-timeout to 500 And I set hints -> mode to number - And I run :bind --force , message-error "This should not happen" + And I run :bind --force , message-error "This error message was triggered via a keybinding which should have been inhibited" And I open data/hints/html/simple.html And I hint with args "all" And I press the key "f" From 08361e70344de76d6f519c960f276595d3ad329d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 13:26:57 +0200 Subject: [PATCH 19/68] Increase timeout for inhibited key test It seems this fails on the new Travis OS X image. --- tests/end2end/features/hints.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 3bdc2f600..a22efb031 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -183,7 +183,7 @@ Feature: Using hints ### hints -> auto-follow-timeout Scenario: Ignoring key presses after auto-following hints - When I set hints -> auto-follow-timeout to 500 + When I set hints -> auto-follow-timeout to 1000 And I set hints -> mode to number And I run :bind --force , message-error "This error message was triggered via a keybinding which should have been inhibited" And I open data/hints/html/simple.html From c9f3fbc8556fb3b0f706907582627f68807c2379 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 13:32:33 +0200 Subject: [PATCH 20/68] test requirements: Update hypothesis to 3.5.3 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index cf095233d..6986dcdf4 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -8,7 +8,7 @@ decorator==4.0.10 Flask==0.11.1 glob2==0.4.1 httpbin==0.5.0 -hypothesis==3.5.2 +hypothesis==3.5.3 itsdangerous==0.24 # Jinja2==2.8 Mako==1.0.4 From 40052c1030932a9f4e52cae248601e14807c1ba3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 14:27:57 +0200 Subject: [PATCH 21/68] Add @qtwebengine_skip to some @no_xvfb tests --- tests/end2end/features/keyinput.feature | 2 +- tests/end2end/features/misc.feature | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/end2end/features/keyinput.feature b/tests/end2end/features/keyinput.feature index e02b33d71..04dcdbbac 100644 --- a/tests/end2end/features/keyinput.feature +++ b/tests/end2end/features/keyinput.feature @@ -165,7 +165,7 @@ Feature: Keyboard input Then the javascript message "key press: 88" should be logged And the javascript message "key release: 88" should be logged - @no_xvfb @posix + @no_xvfb @posix @qtwebengine_skip Scenario: :fake-key sending key to the website with other window focused When I open data/keyinput/log.html And I set general -> developer-extras to true diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index c24f0ea9f..9ca0c66be 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -149,7 +149,7 @@ Feature: Various utility commands. And I run :inspector Then the error "Please enable developer-extras before using the webinspector!" should be shown - @no_xvfb @posix + @no_xvfb @posix @qtwebengine_skip Scenario: Inspector smoke test When I set general -> developer-extras to true And I run :inspector @@ -165,7 +165,7 @@ Feature: Various utility commands. Then the error "Please enable developer-extras before using the webinspector!" should be shown # Different code path as an inspector got created now - @no_xvfb @posix + @no_xvfb @posix @qtwebengine_skip Scenario: Inspector smoke test 2 When I set general -> developer-extras to true And I run :inspector From f6729d23d2f85bececf1a68a253409f8aadb6447 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 14:36:05 +0200 Subject: [PATCH 22/68] Skip auto-follow-timeout test on OS X This takes way too long on Travis... --- tests/end2end/features/hints.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index a22efb031..d0622b9c0 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -182,6 +182,7 @@ Feature: Using hints ### hints -> auto-follow-timeout + @not_osx Scenario: Ignoring key presses after auto-following hints When I set hints -> auto-follow-timeout to 1000 And I set hints -> mode to number From 6be4b74c59a8ef39a2dcfbdc49deb2c6abbd98b2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 15:36:25 +0200 Subject: [PATCH 23/68] tests: Fix redirect-later-continue with timeout --- tests/end2end/data/javascript/consolelog.html | 2 +- tests/end2end/features/hints.feature | 10 +++++++++- tests/end2end/fixtures/webserver_sub.py | 7 +++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/end2end/data/javascript/consolelog.html b/tests/end2end/data/javascript/consolelog.html index d8506862e..b25d58325 100644 --- a/tests/end2end/data/javascript/consolelog.html +++ b/tests/end2end/data/javascript/consolelog.html @@ -1,6 +1,6 @@ - +

This page logs a line via console.log

diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index d0622b9c0..aad42996a 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -70,7 +70,15 @@ Feature: Using hints Then the message "Command exited successfully." should be shown @posix - Scenario: Using :hint spawn with flags passed to the command (issue 797) + Scenario: Using :hint spawn with flags class Test + + log: (args...) -> + console.log "[Foo]", args... + + +test = new Test() +test.log("Hello World") +passed to the command (issue 797) When I open data/hints/html/simple.html And I hint with args "--rapid all spawn -v echo -e foo" and follow a Then the message "Command exited successfully." should be shown diff --git a/tests/end2end/fixtures/webserver_sub.py b/tests/end2end/fixtures/webserver_sub.py index 791faf9c3..0fa1d7139 100644 --- a/tests/end2end/fixtures/webserver_sub.py +++ b/tests/end2end/fixtures/webserver_sub.py @@ -80,8 +80,11 @@ def redirect_later(): @app.route('/custom/redirect-later-continue') def redirect_later_continue(): """Continue a redirect-later request.""" - _redirect_later_event.set() - return flask.Response(b'Continued redirect.') + if _redirect_later_event is None: + return flask.Response(b'Timed out or no redirect pending.') + else: + _redirect_later_event.set() + return flask.Response(b'Continued redirect.') @app.route('/custom/content-size') From ae5e2839aed4cd4cfe94f534a08d4be1f598031e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 15:45:30 +0200 Subject: [PATCH 24/68] Revert accidental changes --- tests/end2end/data/javascript/consolelog.html | 2 +- tests/end2end/features/hints.feature | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/end2end/data/javascript/consolelog.html b/tests/end2end/data/javascript/consolelog.html index b25d58325..d8506862e 100644 --- a/tests/end2end/data/javascript/consolelog.html +++ b/tests/end2end/data/javascript/consolelog.html @@ -1,6 +1,6 @@ - +

This page logs a line via console.log

diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index aad42996a..d0622b9c0 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -70,15 +70,7 @@ Feature: Using hints Then the message "Command exited successfully." should be shown @posix - Scenario: Using :hint spawn with flags class Test - - log: (args...) -> - console.log "[Foo]", args... - - -test = new Test() -test.log("Hello World") -passed to the command (issue 797) + Scenario: Using :hint spawn with flags passed to the command (issue 797) When I open data/hints/html/simple.html And I hint with args "--rapid all spawn -v echo -e foo" and follow a Then the message "Command exited successfully." should be shown From 6184da0224ae4fdc9649283e53c144e74257005f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 21:16:18 +0200 Subject: [PATCH 25/68] Add a comment --- qutebrowser/completion/completer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/completion/completer.py b/qutebrowser/completion/completer.py index 0c83a4976..c5c1915ca 100644 --- a/qutebrowser/completion/completer.py +++ b/qutebrowser/completion/completer.py @@ -157,7 +157,7 @@ class Completer(QObject): result = runner.parse(text, fallback=True, keep=True) parts = [x for x in result.cmdline if x] pos = self._cmd.cursorPosition() - len(self._cmd.prefix()) - pos = min(pos, len(text)) + pos = min(pos, len(text)) # Qt treats 2-byte UTF-16 chars as 2 chars log.completion.debug('partitioning {} around position {}'.format(parts, pos)) for i, part in enumerate(parts): From 4f1bfd37e620c112bc215fff548e95e942ef77a0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Oct 2016 21:20:13 +0200 Subject: [PATCH 26/68] Regenerate authors --- README.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.asciidoc b/README.asciidoc index 8574cb119..c078214d7 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -195,6 +195,7 @@ Contributors, sorted by the number of commits in descending order: * rikn00 * kanikaa1234 * haitaka +* Sebastian Frysztak * Nick Ginther * Michał Góral * Michael Ilsaas From 356f6dc9246e47bb321f3f87795c937d853b61e6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Oct 2016 09:27:38 +0200 Subject: [PATCH 27/68] Disable OS X Yosemite build on Travis for now See #2013 --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77942e091..3a087d233 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,10 @@ matrix: - os: osx env: TESTENV=py35 OSX=elcapitan osx_image: xcode7.3 - - os: osx - env: TESTENV=py35 OSX=yosemite - osx_image: xcode6.4 + # https://github.com/The-Compiler/qutebrowser/issues/2013 + # - os: osx + # env: TESTENV=py35 OSX=yosemite + # osx_image: xcode6.4 - os: linux env: TESTENV=pylint - os: linux From 53ef16e26b9fb333b8f77ccc99db448ca2935f8a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Oct 2016 10:40:28 +0200 Subject: [PATCH 28/68] Try to stabilize test_insert_mode --- .../data/insert_mode_settings/html/autofocus.html | 11 ++++++++++- .../end2end/data/insert_mode_settings/html/input.html | 11 ++++++++++- .../data/insert_mode_settings/html/textarea.html | 10 +++++++++- tests/end2end/test_insert_mode.py | 4 ++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/tests/end2end/data/insert_mode_settings/html/autofocus.html b/tests/end2end/data/insert_mode_settings/html/autofocus.html index db5399252..5b707426f 100644 --- a/tests/end2end/data/insert_mode_settings/html/autofocus.html +++ b/tests/end2end/data/insert_mode_settings/html/autofocus.html @@ -3,8 +3,17 @@ Inputs Autofocus + - + diff --git a/tests/end2end/data/insert_mode_settings/html/input.html b/tests/end2end/data/insert_mode_settings/html/input.html index 2965693d3..0617cae3f 100644 --- a/tests/end2end/data/insert_mode_settings/html/input.html +++ b/tests/end2end/data/insert_mode_settings/html/input.html @@ -3,8 +3,17 @@ Input + - + diff --git a/tests/end2end/data/insert_mode_settings/html/textarea.html b/tests/end2end/data/insert_mode_settings/html/textarea.html index 403809a3a..1ab9d7524 100644 --- a/tests/end2end/data/insert_mode_settings/html/textarea.html +++ b/tests/end2end/data/insert_mode_settings/html/textarea.html @@ -3,8 +3,16 @@ Textarea + - + diff --git a/tests/end2end/test_insert_mode.py b/tests/end2end/test_insert_mode.py index cd57968ca..6939dae0e 100644 --- a/tests/end2end/test_insert_mode.py +++ b/tests/end2end/test_insert_mode.py @@ -56,6 +56,10 @@ def test_insert_mode(file_name, elem_id, source, input_text, auto_insert, # second time. quteproc.send_cmd(':debug-set-fake-clipboard "{}"'.format(input_text)) quteproc.send_cmd(':insert-text {clipboard}') + else: + raise ValueError("Invalid source {!r}".format(source)) + + quteproc.wait_for_js('contents: {}'.format(input_text)) quteproc.send_cmd(':leave-mode') quteproc.send_cmd(':hint all') From ffa276a1826a95bf1f80b15f48cfbf2b9cfe6dad Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 6 Oct 2016 14:43:16 +0200 Subject: [PATCH 29/68] pdfjs: compatibility for v1.6.210 They renamed PDFView to PDFViewerApplication, which we need to account for in our pdfjs scripts. Also, it seems like the actual viewer is now only created when the DOM has been loaded. This means that at the time when our script is executed, the viewer does not yet exist. Thus we need to delay the open request too by registering a DOMContentLoaded handler. --- qutebrowser/browser/pdfjs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/pdfjs.py b/qutebrowser/browser/pdfjs.py index 51ed2dfbe..3bc2c2dc3 100644 --- a/qutebrowser/browser/pdfjs.py +++ b/qutebrowser/browser/pdfjs.py @@ -62,8 +62,10 @@ def _generate_pdfjs_script(url): url: The url of the pdf page as QUrl. """ return ( - 'PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n' - 'PDFView.open("{url}");\n' + 'document.addEventListener("DOMContentLoaded", function() {{\n' + ' PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n' + ' (window.PDFView || window.PDFViewerApplication).open("{url}");\n' + '}});\n' ).format(url=javascript.string_escape(url.toString(QUrl.FullyEncoded))) From a9ac123bfa034c5c36ac0528d74b61a2dd492a0a Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 6 Oct 2016 16:18:21 +0200 Subject: [PATCH 30/68] tests: relax pdfjs tests Updating the whole snippet in two places is bad, so we relax the testing code. --- tests/unit/browser/test_pdfjs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/browser/test_pdfjs.py b/tests/unit/browser/test_pdfjs.py index ad489bc7a..a33dae5bf 100644 --- a/tests/unit/browser/test_pdfjs.py +++ b/tests/unit/browser/test_pdfjs.py @@ -36,11 +36,11 @@ from qutebrowser.browser import pdfjs 'http://foobar/%22);alert(%22attack!%22);'), ]) def test_generate_pdfjs_script(url, expected): - expected_code = ('PDFJS.verbosity = PDFJS.VERBOSITY_LEVELS.info;\n' - 'PDFView.open("{}");\n'.format(expected)) + expected_open = 'open("{}");'.format(expected) url = QUrl(url) actual = pdfjs._generate_pdfjs_script(url) - assert actual == expected_code + assert expected_open in actual + assert 'PDFView' in actual def test_fix_urls(): From b8156a0c32a26f264466272a2d0d575a3517ea66 Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Thu, 6 Oct 2016 21:02:15 +0200 Subject: [PATCH 31/68] BDD tests for :command-history-prev/next ref #999 --- tests/end2end/features/misc.feature | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index c24f0ea9f..7aaf82930 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -671,3 +671,38 @@ Feature: Various utility commands. And I wait until the scroll position changed And I run :click-element id link Then the error "Element position is out of view!" should be shown + + ## :command-history-{prev,next} + + Scenario: Calling previous command + When I run :set-cmd-text :message-info blah + And I run :command-accept + And I wait for "blah" in the log + And I run :set-cmd-text : + And I run :command-history-prev + And I run :command-accept + Then the message "blah" should be shown + + Scenario: Browsing through commands + When I run :set-cmd-text :message-info blarg + And I run :command-accept + And I wait for "blarg" in the log + And I run :set-cmd-text : + And I run :command-history-prev + And I run :command-history-prev + And I run :command-history-next + And I run :command-accept + Then the message "blarg" should be shown + + Scenario: Calling previous command when history is empty + Given I have a fresh instance + When I run :set-cmd-text : + And I run :command-history-prev + And I run :command-accept + Then the error "No command given" should be shown + + Scenario: Calling next command when there's no next command + When I run :set-cmd-text : + And I run :command-history-next + And I run :command-accept + Then the error "No command given" should be shown From 378976db299fe46d02beb79f0cae45e5e8d30379 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Oct 2016 21:02:44 +0200 Subject: [PATCH 32/68] Make log.stub work when inspect.stack fails I got this during shutdown once: Traceback (most recent call last): File ".../qutebrowser/mainwindow/mainwindow.py", line 552, in closeEvent File ".../qutebrowser/mainwindow/mainwindow.py", line 538, in _do_close File ".../qutebrowser/mainwindow/tabbedbrowser.py", line 218, in shutdown self._remove_tab(tab) File ".../qutebrowser/mainwindow/tabbedbrowser.py", line 280, in _remove_tab tab.shutdown() File ".../qutebrowser/browser/webengine/webenginetab.py", line 536, in shutdown log.stub() File ".../qutebrowser/utils/log.py", line 151, in stub function = inspect.stack()[1][3] File "/usr/lib64/python3.5/inspect.py", line 1464, in stack return getouterframes(sys._getframe(1), context) File "/usr/lib64/python3.5/inspect.py", line 1441, in getouterframes frameinfo = (frame,) + getframeinfo(frame, context) File "/usr/lib64/python3.5/inspect.py", line 1414, in getframeinfo lines, lnum = findsource(frame) File "/usr/lib64/python3.5/inspect.py", line 804, in findsource if pat.match(lines[lnum]): break IndexError: list index out of range --- qutebrowser/utils/log.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index c88df8a38..044b75b65 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -148,7 +148,11 @@ console_filter = None def stub(suffix=''): """Show a STUB: message for the calling function.""" - function = inspect.stack()[1][3] + try: + function = inspect.stack()[1][3] + except IndexError: # pragma: no cover + misc.exception("Failed to get stack") + function = '' text = "STUB: {}".format(function) if suffix: text = '{} ({})'.format(text, suffix) From 9ad4d46599f3a576462643fb0ec326cbd12bc3e1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Oct 2016 22:58:45 +0200 Subject: [PATCH 33/68] Update changelog --- CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 051f86487..addde7ef5 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -179,6 +179,7 @@ Fixed - Fixed hang when using multiple spaces in a row with the URL completion - Fixed crash when closing a window without focusing it - Userscripts now can access QUTE_FIFO correctly on Windows +- Compatibility with pdfjs v1.6.210 v0.8.3 (unreleased) ------------------- From aa6d71ce68e7cd50cb2cdfab974e88a95c8df46b Mon Sep 17 00:00:00 2001 From: Kevin Velghe Date: Thu, 29 Sep 2016 20:58:21 +0200 Subject: [PATCH 34/68] Fix viewsource userscript For months I've been wondering what created these files in my home directory ... --- misc/userscripts/qutebrowser_viewsource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/userscripts/qutebrowser_viewsource b/misc/userscripts/qutebrowser_viewsource index 535855bb3..b528c41e8 100755 --- a/misc/userscripts/qutebrowser_viewsource +++ b/misc/userscripts/qutebrowser_viewsource @@ -24,9 +24,9 @@ # Caveat: Does not use authentication of any kind. Add it in if you want it to. # -path=/tmp/qutebrowser_$(mktemp XXXXXXXX).html +path=$(mktemp --tmpdir qutebrowser_XXXXXXXX.html) -curl "$QUTE_URL" > $path +curl "$QUTE_URL" > "$path" urxvt -e vim "$path" rm "$path" From ec5ef2c629dd28f53b4cad04adcca0a7cedab60d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Oct 2016 06:40:13 +0200 Subject: [PATCH 35/68] Mention qutebrowser-announce mailinglist --- README.asciidoc | 3 +++ doc/quickstart.asciidoc | 3 ++- doc/qutebrowser.1.asciidoc | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index c078214d7..34f9f8656 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -70,6 +70,9 @@ message to the https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[mailinglist] at mailto:qutebrowser@lists.qutebrowser.org[]. +There's also a https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser-announce[announce-only mailinglist] +at mailto:qutebrowser-announce@lists.qutebrowser.org[]. + Contributions / Bugs -------------------- diff --git a/doc/quickstart.asciidoc b/doc/quickstart.asciidoc index 9d5375898..dc1426931 100644 --- a/doc/quickstart.asciidoc +++ b/doc/quickstart.asciidoc @@ -32,7 +32,8 @@ image:http://qutebrowser.org/img/cheatsheet-small.png["qutebrowser key binding c `scripts/asciidoc2html.py` to generate the documentation. * Go to the link:qute://settings[settings page] to set up qutebrowser the way you want it. * Subscribe to -https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[the mailinglist] +https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[the mailinglist] or +https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser-announce[the announce-only mailinglist]. * Let me know what features you are missing or things that need (even small!) improvements. diff --git a/doc/qutebrowser.1.asciidoc b/doc/qutebrowser.1.asciidoc index 1da675498..2e1c4762c 100644 --- a/doc/qutebrowser.1.asciidoc +++ b/doc/qutebrowser.1.asciidoc @@ -162,6 +162,8 @@ this program. If not, see . * Website: http://www.qutebrowser.org/ * Mailinglist: mailto:qutebrowser@lists.qutebrowser.org[] / https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser +* Announce-only mailinglist: mailto:qutebrowser-announce@lists.qutebrowser.org[] / +https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser-announce * IRC: irc://irc.freenode.org/#qutebrowser[`#qutebrowser`] on http://freenode.net/[Freenode] * Github: https://github.com/The-Compiler/qutebrowser From ea5cbb0c7f7d3ed68668ab3b62821e065f074615 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Oct 2016 06:49:04 +0200 Subject: [PATCH 36/68] Add new mailinglist to release checklist too [ci skip] --- CONTRIBUTING.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.asciidoc b/CONTRIBUTING.asciidoc index da5dc7025..e7ed06481 100644 --- a/CONTRIBUTING.asciidoc +++ b/CONTRIBUTING.asciidoc @@ -652,4 +652,4 @@ as closed. * OS X: Run `python3 scripts/dev/build_release.py --upload v0.X.Y` (replace X/Y by hand) * On server: Run `python3 scripts/dev/download_release.py v0.X.Y` (replace X/Y by hand) * Update `qutebrowser-git` PKGBUILD if dependencies/install changed -* Announce to qutebrowser mailinglist +* Announce to qutebrowser and qutebrowser-announce mailinglist From 15a2b6ba82b5e1d77906efe8d85a4d8c3f5a71d6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Oct 2016 07:32:35 +0200 Subject: [PATCH 37/68] flake8 requirements: Update pyparsing to 2.1.10 --- misc/requirements/requirements-flake8.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-flake8.txt b/misc/requirements/requirements-flake8.txt index bd8665e47..16db859b6 100644 --- a/misc/requirements/requirements-flake8.txt +++ b/misc/requirements/requirements-flake8.txt @@ -21,5 +21,5 @@ pep8-naming==0.4.1 pycodestyle==2.0.0 pydocstyle==1.1.1 pyflakes==1.3.0 -pyparsing==2.1.9 +pyparsing==2.1.10 six==1.10.0 From 0a8133cc9fd7917c7b2b7af33b14eb3e6d58e1ff Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Oct 2016 07:32:45 +0200 Subject: [PATCH 38/68] test requirements: Update xdis to 2.3.2 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 6986dcdf4..97d7fe49d 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -34,4 +34,4 @@ spark-parser==1.4.0 uncompyle6==2.8.3 vulture==0.10 Werkzeug==0.11.11 -xdis==2.3.1 +xdis==2.3.2 From 5eed5eb7f737da50006a8f19cb1b1f3f5de1edf0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 7 Oct 2016 09:44:54 +0200 Subject: [PATCH 39/68] commit 5708bb0306fb28549fc47e686790d006398c27fa Author: Florian Bruhin Date: Fri Oct 7 07:44:54 2016 +0200 Turn off private browsing in misc.feature tests --- tests/end2end/features/misc.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 7aaf82930..930da91dc 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -549,6 +549,7 @@ Feature: Various utility commands. And I open cookies/set?qute-test=42 without waiting And I wait until cookies is loaded And I open cookies in a new tab + And I set general -> private-browsing to false Then the cookie qute-test should be set to 42 ## https://github.com/The-Compiler/qutebrowser/issues/1742 @@ -557,6 +558,7 @@ Feature: Various utility commands. Scenario: Private browsing is activated in QtWebKit without restart When I set general -> private-browsing to true And I open data/javascript/localstorage.html + And I set general -> private-browsing to false Then the page should contain the plaintext "Local storage status: not working" Scenario: :repeat-command From 97d00b2355182f493576d5dbd63db7b4c2b30c6c Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Sat, 8 Oct 2016 11:10:27 +0200 Subject: [PATCH 40/68] Ignore NetworkManager-related Qt warnings (discussed in #2016) --- pytest.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pytest.ini b/pytest.ini index 2b68a77af..0c2d00f21 100644 --- a/pytest.ini +++ b/pytest.ini @@ -30,6 +30,9 @@ qt_log_ignore = ^QProcess: Destroyed while process .* is still running\. ^"Method "GetAll" with signature "s" on interface "org\.freedesktop\.DBus\.Properties" doesn't exist ^"Method \\"GetAll\\" with signature \\"s\\" on interface \\"org\.freedesktop\.DBus\.Properties\\" doesn't exist\\n" + ^propsReply "Method \\"GetAll\\" with signature \\"s\\" on interface \\"org\.freedesktop\.DBus\.Properties\\" doesn't exist\\n" + ^nmReply "Method \\"GetDevices\\" with signature \\"\\" on interface \\"org\.freedesktop\.NetworkManager\\" doesn't exist\\n" + ^"Object path cannot be empty" ^virtual void QSslSocketBackendPrivate::transmit\(\) SSL write failed with error: -9805 ^virtual void QSslSocketBackendPrivate::transmit\(\) SSLRead failed with: -9805 ^Type conversion already registered from type .* From a8847eacbef0c40a082a933ea9ea00b56bed00bc Mon Sep 17 00:00:00 2001 From: Sebastian Frysztak Date: Sat, 8 Oct 2016 18:14:37 +0200 Subject: [PATCH 41/68] Cover HistoryEndReachedError in command_history_next(). --- tests/end2end/features/misc.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 930da91dc..bac6125a7 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -693,6 +693,7 @@ Feature: Various utility commands. And I run :command-history-prev And I run :command-history-prev And I run :command-history-next + And I run :command-history-next And I run :command-accept Then the message "blarg" should be shown From 087342894ef6063932b2b624f8d4ab72ef684168 Mon Sep 17 00:00:00 2001 From: Kevin Velghe Date: Sun, 9 Oct 2016 00:11:52 +0200 Subject: [PATCH 42/68] Add setting for location of netrc file There is no reason I guess to do this with an environment variable. On top of that, introducing a settings also documents the netrc feature itself (Closes #1975?). --- README.asciidoc | 2 +- doc/help/settings.asciidoc | 7 +++++++ qutebrowser/browser/webkit/network/networkmanager.py | 2 +- qutebrowser/config/configdata.py | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 8574cb119..bae15c67b 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -160,9 +160,9 @@ Contributors, sorted by the number of commits in descending order: * Corentin Julé * meles5 * Philipp Hansch +* Kevin Velghe * Daniel Karbach * Panagiotis Ktistakis -* Kevin Velghe * Artur Shaik * Nathan Isom * Thorsten Wißmann diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 8f416d3a4..8b1803fb2 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -69,6 +69,7 @@ |<>|Whether to validate SSL handshakes. |<>|Whether to try to pre-fetch DNS entries to speed up browsing. |<>|Set custom headers for qutebrowser HTTP requests. +|<>|Set location of netrc-file for HTTP authentication. |============== .Quick reference for section ``completion'' @@ -808,6 +809,12 @@ Set custom headers for qutebrowser HTTP requests. Default: empty +[[network-netrc-file]] +=== netrc-file +Set location of netrc-file for HTTP authentication. + +Default: empty + == completion Options related to completion and command history. diff --git a/qutebrowser/browser/webkit/network/networkmanager.py b/qutebrowser/browser/webkit/network/networkmanager.py index 151c06829..d28bd6be4 100644 --- a/qutebrowser/browser/webkit/network/networkmanager.py +++ b/qutebrowser/browser/webkit/network/networkmanager.py @@ -330,7 +330,7 @@ class NetworkManager(QNetworkAccessManager): # altogether. reply.netrc_used = True try: - net = netrc.netrc(os.environ.get('QUTE_NETRC')) + net = netrc.netrc(config.get('network', 'netrc-file')) authenticators = net.authenticators(reply.url().host()) if authenticators is not None: (user, _account, password) = authenticators diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 3b62f3183..e503c3e45 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -438,6 +438,10 @@ def data(readonly=False): SettingValue(typ.HeaderDict(none_ok=True), ''), "Set custom headers for qutebrowser HTTP requests."), + ('netrc-file', + SettingValue(typ.File(none_ok=True), ''), + "Set location of netrc-file for HTTP authentication."), + readonly=readonly )), From 40eb875fb6c7ca26b2cdade7e7f1586de64ff60b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 07:33:59 +0200 Subject: [PATCH 43/68] Add a test for private-browsing mode --- tests/end2end/features/misc.feature | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 933c698c2..f58dcf9e2 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -709,3 +709,16 @@ Feature: Various utility commands. And I run :command-history-next And I run :command-accept Then the error "No command given" should be shown + + Scenario: Calling previous command with private-browsing mode + When I run :set-cmd-text :message-info blah + And I run :command-accept + And I set general -> private-browsing to true + And I run :set-cmd-text :message-error This should only be shown once + And I run :command-accept + And I wait for the error "This should only be shown once" + And I run :set-cmd-text : + And I run :command-history-prev + And I run :command-accept + And I set general -> private-browsing to false + Then the message "blah" should be shown From 03c0eb244e49ba524e71eff79a0596d5c497a5d8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 07:34:22 +0200 Subject: [PATCH 44/68] Remove whitespace at EOL --- tests/end2end/features/misc.feature | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index f58dcf9e2..e90ea8a60 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -675,7 +675,7 @@ Feature: Various utility commands. Then the error "Element position is out of view!" should be shown ## :command-history-{prev,next} - + Scenario: Calling previous command When I run :set-cmd-text :message-info blah And I run :command-accept @@ -684,7 +684,7 @@ Feature: Various utility commands. And I run :command-history-prev And I run :command-accept Then the message "blah" should be shown - + Scenario: Browsing through commands When I run :set-cmd-text :message-info blarg And I run :command-accept @@ -696,14 +696,14 @@ Feature: Various utility commands. And I run :command-history-next And I run :command-accept Then the message "blarg" should be shown - + Scenario: Calling previous command when history is empty Given I have a fresh instance When I run :set-cmd-text : And I run :command-history-prev And I run :command-accept Then the error "No command given" should be shown - + Scenario: Calling next command when there's no next command When I run :set-cmd-text : And I run :command-history-next From cc74c87a4c7a147fae4604b2f6e56be793d4affc Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 07:34:32 +0200 Subject: [PATCH 45/68] Regenerate authors --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 34f9f8656..5cd602d1b 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -185,6 +185,7 @@ Contributors, sorted by the number of commits in descending order: * Julian Weigt * Jonas Schürmann * error800 +* Sebastian Frysztak * Michael Hoang * Liam BEGUIN * skinnay @@ -198,7 +199,6 @@ Contributors, sorted by the number of commits in descending order: * rikn00 * kanikaa1234 * haitaka -* Sebastian Frysztak * Nick Ginther * Michał Góral * Michael Ilsaas From 422bbd0f2cc4e3138324593ff86f39219975c2bb Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 07:40:11 +0200 Subject: [PATCH 46/68] pip requirements: Update setuptools to 28.3.0 --- misc/requirements/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-pip.txt b/misc/requirements/requirements-pip.txt index 8d7d67eb4..9961ec39d 100644 --- a/misc/requirements/requirements-pip.txt +++ b/misc/requirements/requirements-pip.txt @@ -1,2 +1,2 @@ pip==8.1.2 -setuptools==28.2.0 +setuptools==28.3.0 From 8670009c9217a26bee38dfa6242fd76af97baf60 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 08:11:58 +0200 Subject: [PATCH 47/68] test requirements: Update uncompyle6 to 2.8.4 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 97d7fe49d..7e02af560 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -31,7 +31,7 @@ pytest-warnings==0.1.0 pytest-xvfb==0.3.0 six==1.10.0 spark-parser==1.4.0 -uncompyle6==2.8.3 +uncompyle6==2.8.4 vulture==0.10 Werkzeug==0.11.11 xdis==2.3.2 From 6d6655524c5c5caecf1eb6ae5896709b64861306 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 08:26:32 +0200 Subject: [PATCH 48/68] Fix quoting --- tests/end2end/features/misc.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index e90ea8a60..5fec8b736 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -714,7 +714,7 @@ Feature: Various utility commands. When I run :set-cmd-text :message-info blah And I run :command-accept And I set general -> private-browsing to true - And I run :set-cmd-text :message-error This should only be shown once + And I run :set-cmd-text :message-error "This should only be shown once" And I run :command-accept And I wait for the error "This should only be shown once" And I run :set-cmd-text : From aba67d08222e207caceaaf6f5e8739cfb2fcbed1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 09:30:05 +0200 Subject: [PATCH 49/68] Add @qtwebengine_todo --- tests/end2end/features/misc.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 5fec8b736..29fab26ad 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -710,6 +710,7 @@ Feature: Various utility commands. And I run :command-accept Then the error "No command given" should be shown + @qtwebengine_todo: private browsing is not implemented yet Scenario: Calling previous command with private-browsing mode When I run :set-cmd-text :message-info blah And I run :command-accept From fbc084e4163635941709409f2a8cf5229ec6f3ca Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Fri, 30 Sep 2016 16:55:51 -0400 Subject: [PATCH 50/68] Remove ::cmd syntax support. CommandRunner.parse had some logic for handling commands of form ::cmd. However, this complicated the parsing logic for something that appears to only be used in tests. One could use it in a userscript, but this is unlikely as it is undocumented. Removing support for this simplifies the logic of parse. The commnd `run-with-count` is added to provide this functionality. It works like `repeat` but passes the count along to the command instead of running the command multiple times. This resolves #1997: Qutebrowser crashes when pasting commands. This bug was caused by excess stripping of ':' from the command string by _parse_count. --- qutebrowser/commands/runners.py | 43 +++---------------------- qutebrowser/misc/utilcmds.py | 17 ++++++++++ tests/end2end/features/caret.feature | 2 +- tests/end2end/features/misc.feature | 12 ++++++- tests/end2end/features/tabs.feature | 4 +-- tests/end2end/fixtures/quteprocess.py | 3 +- tests/unit/commands/test_runners.py | 9 ------ tests/unit/completion/test_completer.py | 1 + 8 files changed, 39 insertions(+), 52 deletions(-) diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 3d74fc266..a4644b2a3 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -31,8 +31,7 @@ from qutebrowser.utils import message, objreg, qtutils, utils from qutebrowser.misc import split -ParseResult = collections.namedtuple('ParseResult', ['cmd', 'args', 'cmdline', - 'count']) +ParseResult = collections.namedtuple('ParseResult', ['cmd', 'args', 'cmdline']) last_command = {} @@ -154,26 +153,6 @@ class CommandRunner(QObject): for sub in sub_texts: yield self.parse(sub, *args, **kwargs) - def _parse_count(self, cmdstr): - """Split a count prefix off from a command for parse(). - - Args: - cmdstr: The command/args including the count. - - Return: - A (count, cmdstr) tuple, with count being None or int. - """ - if ':' not in cmdstr: - return (None, cmdstr) - - count, cmdstr = cmdstr.split(':', maxsplit=1) - try: - count = int(count) - except ValueError: - # We just ignore invalid prefixes - count = None - return (count, cmdstr) - def parse(self, text, *, fallback=False, keep=False): """Split the commandline text into command and arguments. @@ -187,7 +166,6 @@ class CommandRunner(QObject): A ParseResult tuple. """ cmdstr, sep, argstr = text.partition(' ') - count, cmdstr = self._parse_count(cmdstr) if not cmdstr and not fallback: raise cmdexc.NoSuchCommandError("No command given") @@ -202,8 +180,7 @@ class CommandRunner(QObject): raise cmdexc.NoSuchCommandError( '{}: no such command'.format(cmdstr)) cmdline = split.split(text, keep=keep) - return ParseResult(cmd=None, args=None, cmdline=cmdline, - count=count) + return ParseResult(cmd=None, args=None, cmdline=cmdline) args = self._split_args(cmd, argstr, keep) if keep and args: @@ -213,7 +190,7 @@ class CommandRunner(QObject): else: cmdline = [cmdstr] + args[:] - return ParseResult(cmd=cmd, args=args, cmdline=cmdline, count=count) + return ParseResult(cmd=cmd, args=args, cmdline=cmdline) def _completion_match(self, cmdstr): """Replace cmdstr with a matching completion if there's only one match. @@ -291,20 +268,10 @@ class CommandRunner(QObject): args = result.args else: args = replace_variables(self._win_id, result.args) - if count is not None: - if result.count is not None: - raise cmdexc.CommandMetaError("Got count via command and " - "prefix!") - result.cmd.run(self._win_id, args, count=count) - elif result.count is not None: - result.cmd.run(self._win_id, args, count=result.count) - else: - result.cmd.run(self._win_id, args) + result.cmd.run(self._win_id, args, count=count) if result.cmdline[0] != 'repeat-command': - last_command[cur_mode] = ( - self._parse_count(text)[1], - count if count is not None else result.count) + last_command[cur_mode] = (text, count) @pyqtSlot(str, int) @pyqtSlot(str) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 2447afd53..62202998c 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -86,6 +86,23 @@ def repeat(times: int, command, win_id): commandrunner.run_safely(command) +@cmdutils.register(maxsplit=1, hide=True, no_cmd_split=True, + no_replace_variables=True) +@cmdutils.argument('win_id', win_id=True) +@cmdutils.argument('count', count=True) +def run_with_count(count_arg: int, command, win_id, count=1): + """Run a command with the given count. + + If run_with_count itself is run with a count, it multiplies count_arg. + + Args: + count_arg: The count to pass to the command. + command: The command to run, with optional args. + count: The count that run_with_count itself received. + """ + runners.CommandRunner(win_id).run(command, count_arg * count) + + @cmdutils.register(hide=True) def message_error(text): """Show an error message in the statusbar. diff --git a/tests/end2end/features/caret.feature b/tests/end2end/features/caret.feature index fdfb7f6d8..47b00622d 100644 --- a/tests/end2end/features/caret.feature +++ b/tests/end2end/features/caret.feature @@ -3,7 +3,7 @@ Feature: Caret mode Background: Given I open data/caret.html - And I run :tab-only ;; :enter-mode caret + And I run :tab-only ;; enter-mode caret # document diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 29fab26ad..701d9d7cf 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -499,7 +499,7 @@ Feature: Various utility commands. Scenario: Using :debug-log-capacity When I run :debug-log-capacity 100 And I run :message-info oldstuff - And I run :repeat 20 :message-info otherstuff + And I run :repeat 20 message-info otherstuff And I run :message-info newstuff And I open qute:log Then the page should contain the plaintext "newstuff" @@ -723,3 +723,13 @@ Feature: Various utility commands. And I run :command-accept And I set general -> private-browsing to false Then the message "blah" should be shown + + ## :run-with-count + + Scenario: :run-with-count + When I run :run-with-count 2 scroll down + Then "command called: scroll ['down'] (count=2)" should be logged + + Scenario: :run-with-count with count + When I run :run-with-count 2 scroll down with count 3 + Then "command called: scroll ['down'] (count=6)" should be logged diff --git a/tests/end2end/features/tabs.feature b/tests/end2end/features/tabs.feature index 7ae98619c..b138397c5 100644 --- a/tests/end2end/features/tabs.feature +++ b/tests/end2end/features/tabs.feature @@ -987,13 +987,13 @@ Feature: Tab management Scenario: Using :tab-next after closing last tab (#1448) When I set tabs -> last-close to close And I run :tab-only - And I run :tab-close ;; :tab-next + And I run :tab-close ;; tab-next Then qutebrowser should quit And no crash should happen Scenario: Using :tab-prev after closing last tab (#1448) When I set tabs -> last-close to close And I run :tab-only - And I run :tab-close ;; :tab-prev + And I run :tab-close ;; tab-prev Then qutebrowser should quit And no crash should happen diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index acd6b0f49..46a0d2ff7 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -437,7 +437,8 @@ class QuteProc(testprocess.Process): command = command.replace('\\', r'\\') if count is not None: - command = ':{}:{}'.format(count, command.lstrip(':')) + command = ':run-with-count {} {}'.format(count, + command.lstrip(':')) self.send_ipc([command]) if not invalid: diff --git a/tests/unit/commands/test_runners.py b/tests/unit/commands/test_runners.py index 50fcbde1c..77c9d8f72 100644 --- a/tests/unit/commands/test_runners.py +++ b/tests/unit/commands/test_runners.py @@ -64,15 +64,6 @@ class TestCommandRunner: with pytest.raises(cmdexc.NoSuchCommandError): list(cr.parse_all(command)) - def test_parse_with_count(self): - """Test parsing of commands with a count.""" - cr = runners.CommandRunner(0) - result = cr.parse('20:scroll down') - assert result.cmd.name == 'scroll' - assert result.count == 20 - assert result.args == ['down'] - assert result.cmdline == ['scroll', 'down'] - def test_partial_parsing(self): """Test partial parsing with a runner where it's enabled. diff --git a/tests/unit/completion/test_completer.py b/tests/unit/completion/test_completer.py index 7e9fdbb48..2c02efa44 100644 --- a/tests/unit/completion/test_completer.py +++ b/tests/unit/completion/test_completer.py @@ -181,6 +181,7 @@ def _set_cmd_prompt(cmd, txt): (':open -- |', None, ''), (':gibberish nonesense |', None, ''), ('/:help|', None, ''), + ('::bind|', usertypes.Completion.command, ':bind'), ]) def test_update_completion(txt, kind, pattern, status_command_stub, completer_obj, completion_widget_stub): From a78fb6f5e41ceacbdd037b7afd5c6960a876d338 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 15:35:06 +0200 Subject: [PATCH 51/68] test requirements: Update xdis to 3.0.0 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 7e02af560..d9548738f 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -34,4 +34,4 @@ spark-parser==1.4.0 uncompyle6==2.8.4 vulture==0.10 Werkzeug==0.11.11 -xdis==2.3.2 +xdis==3.0.0 From d5f8181777db8a9a2a0d93f322e0170bdfaac0d7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 10 Oct 2016 15:44:08 +0200 Subject: [PATCH 52/68] test requirements: Update uncompyle6 to 2.9.0 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index d9548738f..664ff4d70 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -31,7 +31,7 @@ pytest-warnings==0.1.0 pytest-xvfb==0.3.0 six==1.10.0 spark-parser==1.4.0 -uncompyle6==2.8.4 +uncompyle6==2.9.0 vulture==0.10 Werkzeug==0.11.11 xdis==3.0.0 From 99acb2309b93c749b48fe1d09b3fe626f8a60dd9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Oct 2016 13:58:42 +0200 Subject: [PATCH 53/68] Regenerate authors --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 5cd602d1b..1a992460a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -183,9 +183,9 @@ Contributors, sorted by the number of commits in descending order: * knaggita * Oliver Caldwell * Julian Weigt +* Sebastian Frysztak * Jonas Schürmann * error800 -* Sebastian Frysztak * Michael Hoang * Liam BEGUIN * skinnay From 121b4bced5a27fb145e59856bce506cf6536a622 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Oct 2016 14:08:04 +0200 Subject: [PATCH 54/68] test requirements: Update pytest-cov to 2.4.0 --- misc/requirements/requirements-tests.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 664ff4d70..c72369c33 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -19,7 +19,7 @@ py==1.4.31 pytest==3.0.3 pytest-bdd==2.18.0 pytest-catchlog==1.2.2 -pytest-cov==2.3.1 +pytest-cov==2.4.0 pytest-faulthandler==1.3.0 pytest-instafail==0.3.0 pytest-mock==1.2 From 90d868b0335a0143693d35b411fbf70fdd16c613 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Oct 2016 14:08:53 +0200 Subject: [PATCH 55/68] test reqs: Update uncompile6/xdis to 2.9.1/3.0.2 --- misc/requirements/requirements-tests.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index c72369c33..43cdee933 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -31,7 +31,7 @@ pytest-warnings==0.1.0 pytest-xvfb==0.3.0 six==1.10.0 spark-parser==1.4.0 -uncompyle6==2.9.0 +uncompyle6==2.9.1 vulture==0.10 Werkzeug==0.11.11 -xdis==3.0.0 +xdis==3.0.2 From bdab57743a3520d644b5c947f8fbbc593b35bb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20D=C3=A9saulniers?= Date: Tue, 11 Oct 2016 04:37:35 -0400 Subject: [PATCH 56/68] add cast userscript for ChromeCast --- misc/userscripts/cast | 150 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100755 misc/userscripts/cast diff --git a/misc/userscripts/cast b/misc/userscripts/cast new file mode 100755 index 000000000..fd1bab4d5 --- /dev/null +++ b/misc/userscripts/cast @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +# +# Behaviour +# Userscript for qutebrowser which casts the url passed in $1 to the default +# ChromeCast device in the network using the program `castnow` +# +# Usage +# You can launch the script from qutebrowser as follows: +# spawn --userscript ${PATH_TO_FILE} {url} +# +# Then, you can control the chromecast by launching the simple command +# `castnow` in a shell which will connect to the running castnow instance. +# +# For stopping the script, issue the command `pkill -f castnow` which would +# then let the rest of the userscript execute for cleaning temporary file. +# +# Thanks +# This userscript borrows Thorsten Wißmann's javascript code from his `mpv` +# userscript. +# +# Dependencies +# - castnow, https://github.com/xat/castnow +# +# Author +# Simon Désaulniers + +if [ -z "$QUTE_FIFO" ] ; then + cat 1>&2 <&2 + else + echo "message-$cmd '${msg//\'/\\\'}'" >> "$QUTE_FIFO" + fi +} + +js() { +cat < + The video is being cast on your ChromeCast device. +

+

+ In order to restore this particular video + click here. +

+ "; + replacement.style.position = "relative"; + replacement.style.zIndex = "100003000000"; + replacement.style.fontSize = "1rem"; + replacement.style.textAlign = "center"; + replacement.style.verticalAlign = "middle"; + replacement.style.height = "100%"; + replacement.style.background = "#101010"; + replacement.style.color = "white"; + replacement.style.border = "4px dashed #545454"; + replacement.style.padding = "2em"; + replacement.style.margin = "auto"; + App.all_replacements[i] = replacement; + App.backup_videos[i] = video; + video.parentNode.replaceChild(replacement, video); + } + + function restore_video(obj, index) { + obj = App.all_replacements[index]; + video = App.backup_videos[index]; + console.log(video); + obj.parentNode.replaceChild(video, obj); + } + + /** force repainting the video, thanks to: + * http://martinwolf.org/2014/06/10/force-repaint-of-an-element-with-javascript/ + */ + var siteHeader = document.getElementById('header'); + siteHeader.style.display='none'; + siteHeader.offsetHeight; // no need to store this anywhere, the reference is enough + siteHeader.style.display='block'; + +EOF +} + +printjs() { + js | sed 's,//.*$,,' | tr '\n' ' ' +} +echo "jseval -q $(printjs)" >> "$QUTE_FIFO" + +tmpdir=$(mktemp -d) +file_to_cast=${tmpdir}/qutecast + +# kill any running instance of castnow +pkill -f /usr/bin/castnow + +# start youtube download in stream mode (-o -) into temporary file +youtube-dl -qo - "$1" > ${file_to_cast} & +ytdl_pid=$! + +msg info "Casting $1" >> "$QUTE_FIFO" +# start castnow in stream mode to cast on ChromeCast +tail -F "${file_to_cast}" | castnow - + +# cleanup remaining background process and file on disk +kill ${ytdl_pid} +rm -rf ${tmpdir} From 8cda3b9aea7c66b97df8362b689dd0d5ca5debda Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 12 Oct 2016 16:17:42 +0200 Subject: [PATCH 57/68] Regenerate authors --- README.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.asciidoc b/README.asciidoc index 1a992460a..ee420eac8 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -248,6 +248,7 @@ Contributors, sorted by the number of commits in descending order: * Tim Harder * Thiago Barroso Perrotta * Sorokin Alexei +* Simon Désaulniers * Rok Mandeljc * Noah Huesser * Moez Bouhlel From c6f0b918324bea4070146f19426adeea1e29b9c7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 12 Oct 2016 16:21:03 +0200 Subject: [PATCH 58/68] Regenerate docs --- doc/help/commands.asciidoc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 8cc5184f8..093b6f2c6 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -994,6 +994,7 @@ How many steps to zoom out. |<>|Remove chars backward from the cursor to the beginning of the line. |<>|Remove chars from the cursor to the beginning of the word. |<>|Paste the most recently deleted text. +|<>|Run a command with the given count. |<>|Scroll the current tab in the given direction. |<>|Scroll the frame page-wise. |<>|Scroll to a specific percentage of the page. @@ -1342,6 +1343,26 @@ Paste the most recently deleted text. This acts like readline's yank. +[[run-with-count]] +=== run-with-count +Syntax: +:run-with-count 'count-arg' 'command'+ + +Run a command with the given count. + +If run_with_count itself is run with a count, it multiplies count_arg. + +==== positional arguments +* +'count-arg'+: The count to pass to the command. +* +'command'+: The command to run, with optional args. + +==== count +The count that run_with_count itself received. + +==== note +* This command does not split arguments after the last argument and handles quotes literally. +* With this command, +;;+ is interpreted literally instead of splitting off a second command. +* This command does not replace variables like +\{url\}+. + [[scroll]] === scroll Syntax: +:scroll 'direction'+ From 9e08eb0d5c48d60807d2583bda1eddc2a72976ab Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 12 Oct 2016 16:21:54 +0200 Subject: [PATCH 59/68] Update changelog --- CHANGELOG.asciidoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index addde7ef5..09dcca173 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -47,6 +47,8 @@ Added https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API[HTML5 page visibility API] - New `readability` userscript which shows a readable version of a page (using the `readability-lxml` python package) +- New `cast` userscript to show a video on a Google Chromecast +- New `:run-with-count` command which replaces the (undocumented) `:count:command` syntax. Changed ~~~~~~~ From d5a3d2e191154b0676f27a5c2c56a0d5968ef85e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 13 Oct 2016 11:30:51 +0200 Subject: [PATCH 60/68] tox requirements: Update tox to 2.4.0 --- misc/requirements/requirements-tox.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tox.txt b/misc/requirements/requirements-tox.txt index f077153ff..26345ab63 100644 --- a/misc/requirements/requirements-tox.txt +++ b/misc/requirements/requirements-tox.txt @@ -2,5 +2,5 @@ pluggy==0.4.0 py==1.4.31 -tox==2.3.1 +tox==2.4.0 virtualenv==15.0.3 From d301f200e222f6768eef263045394315104f9aef Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 14 Oct 2016 06:45:41 +0200 Subject: [PATCH 61/68] Improve docs for netrc-file setting --- doc/help/settings.asciidoc | 4 ++-- qutebrowser/config/configdata.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 8b1803fb2..d738a68ca 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -69,7 +69,7 @@ |<>|Whether to validate SSL handshakes. |<>|Whether to try to pre-fetch DNS entries to speed up browsing. |<>|Set custom headers for qutebrowser HTTP requests. -|<>|Set location of netrc-file for HTTP authentication. +|<>|Set location of a netrc-file for HTTP authentication. If empty, ~/.netrc is used. |============== .Quick reference for section ``completion'' @@ -811,7 +811,7 @@ Default: empty [[network-netrc-file]] === netrc-file -Set location of netrc-file for HTTP authentication. +Set location of a netrc-file for HTTP authentication. If empty, ~/.netrc is used. Default: empty diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index e503c3e45..ea3939a44 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -440,7 +440,8 @@ def data(readonly=False): ('netrc-file', SettingValue(typ.File(none_ok=True), ''), - "Set location of netrc-file for HTTP authentication."), + "Set location of a netrc-file for HTTP authentication. If empty, " + "~/.netrc is used."), readonly=readonly )), From c012a4e05c92133bfcb765dc2acd8a1fa2936e77 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 14 Oct 2016 06:46:58 +0200 Subject: [PATCH 62/68] Regenerate authors --- README.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 27fc8df56..86743bc71 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -162,8 +162,8 @@ Contributors, sorted by the number of commits in descending order: * Claude * Corentin Julé * meles5 -* Philipp Hansch * Kevin Velghe +* Philipp Hansch * Daniel Karbach * Panagiotis Ktistakis * Artur Shaik From 8e879f98791ece4421fd16515065c9d1a3726c45 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 14 Oct 2016 06:48:38 +0200 Subject: [PATCH 63/68] tox requirements: Update tox to 2.4.1 --- misc/requirements/requirements-tox.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-tox.txt b/misc/requirements/requirements-tox.txt index 26345ab63..acb3c0012 100644 --- a/misc/requirements/requirements-tox.txt +++ b/misc/requirements/requirements-tox.txt @@ -2,5 +2,5 @@ pluggy==0.4.0 py==1.4.31 -tox==2.4.0 +tox==2.4.1 virtualenv==15.0.3 From 229faac9cba8faf2cbff36ad639a3163bd84675a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 14 Oct 2016 07:24:36 +0200 Subject: [PATCH 64/68] Stabilize :session-delete tests --- qutebrowser/misc/sessions.py | 2 ++ tests/end2end/features/sessions.feature | 2 ++ 2 files changed, 4 insertions(+) diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index cd3d2f3bc..c3a3a8e34 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -481,3 +481,5 @@ class SessionManager(QObject): log.sessions.exception("Error while deleting session!") raise cmdexc.CommandError("Error while deleting session: {}" .format(e)) + else: + log.sessions.debug("Deleted session {}.".format(name)) diff --git a/tests/end2end/features/sessions.feature b/tests/end2end/features/sessions.feature index 234a428ae..af3e43f11 100644 --- a/tests/end2end/features/sessions.feature +++ b/tests/end2end/features/sessions.feature @@ -294,11 +294,13 @@ Feature: Saving and loading sessions Scenario: Deleting internal session with --force When I run :session-save --force _internal And I run :session-delete --force _internal + And I wait for "Deleted session _internal." in the log Then the session _internal should not exist Scenario: Normally deleting a session When I run :session-save deleted_session And I run :session-delete deleted_session + And I wait for "Deleted session deleted_session." in the log Then the session deleted_session should not exist Scenario: Deleting a session which doesn't exist From 72ae9c133c1c4351873ea938451231c68de59a6b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 16 Oct 2016 17:27:28 +0200 Subject: [PATCH 65/68] test reqs: Update uncompyle6/xdis to 2.9.2/3.1.0 --- misc/requirements/requirements-tests.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index 43cdee933..6608275ab 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -31,7 +31,7 @@ pytest-warnings==0.1.0 pytest-xvfb==0.3.0 six==1.10.0 spark-parser==1.4.0 -uncompyle6==2.9.1 +uncompyle6==2.9.2 vulture==0.10 Werkzeug==0.11.11 -xdis==3.0.2 +xdis==3.1.0 From 6a93eee14e51ea3105dd418ab7001d9aec7d3bd3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 16 Oct 2016 17:53:12 +0200 Subject: [PATCH 66/68] pip requirements: Update setuptools to 28.5.0 --- misc/requirements/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-pip.txt b/misc/requirements/requirements-pip.txt index 9961ec39d..b3703d847 100644 --- a/misc/requirements/requirements-pip.txt +++ b/misc/requirements/requirements-pip.txt @@ -1,2 +1,2 @@ pip==8.1.2 -setuptools==28.3.0 +setuptools==28.5.0 From fe5daca35160286984ea1bcb0c02dea65c54d440 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 16 Oct 2016 21:30:25 +0200 Subject: [PATCH 67/68] pip requirements: Update setuptools to 28.6.0 --- misc/requirements/requirements-pip.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/requirements/requirements-pip.txt b/misc/requirements/requirements-pip.txt index b3703d847..ddf8adbb4 100644 --- a/misc/requirements/requirements-pip.txt +++ b/misc/requirements/requirements-pip.txt @@ -1,2 +1,2 @@ pip==8.1.2 -setuptools==28.5.0 +setuptools==28.6.0 From 27d8f25eebe481929c041b760405913ef129cf10 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 17 Oct 2016 07:25:35 +0200 Subject: [PATCH 68/68] travis: Allow El Capitan to fail --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3a087d233..8c7175f51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,10 @@ matrix: env: TESTENV=check-manifest - os: linux env: TESTENV=eslint + allow_failures: + - os: osx + env: TESTENV=py35 OSX=elcapitan + osx_image: xcode7.3 cache: directories: