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.
This commit is contained in:
Florian Bruhin 2017-09-28 17:42:21 +02:00
parent 4b9bbaa04d
commit 9d963d55f5

View File

@ -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))