From 9d963d55f5dfc46a2a7f35c2922a46f8a16fee01 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 28 Sep 2017 17:42:21 +0200 Subject: [PATCH] Fix :debug-cache-stats with QtWebEngine When we use --backend webengine, the QtWebKit stuff might be importable, but the history still isn't initialized because of that. --- qutebrowser/misc/utilcmds.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 4b6909344..5c85aae10 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -171,12 +171,15 @@ def debug_cache_stats(): prefix_info = configdata.is_valid_prefix.cache_info() # pylint: disable=protected-access render_stylesheet_info = config._render_stylesheet.cache_info() + + history_info = None try: from PyQt5.QtWebKit import QWebHistoryInterface interface = QWebHistoryInterface.defaultInterface() - history_info = interface.historyContains.cache_info() + if interface is not None: + history_info = interface.historyContains.cache_info() except ImportError: - history_info = None + pass log.misc.debug('is_valid_prefix: {}'.format(prefix_info)) log.misc.debug('_render_stylesheet: {}'.format(render_stylesheet_info))