Work around getting an empty session title.

Fixes #879.
Supersedes #880.
This commit is contained in:
Florian Bruhin 2016-03-31 06:38:09 +02:00
parent a6a2210ce8
commit d83d2e442e

View File

@ -143,10 +143,18 @@ class SessionManager(QObject):
history = tab.page().history()
for idx, item in enumerate(history.items()):
qtutils.ensure_valid(item)
item_data = {
'url': bytes(item.url().toEncoded()).decode('ascii'),
'title': item.title(),
}
if not item.title():
# https://github.com/The-Compiler/qutebrowser/issues/879
if history.currentItemIndex() == idx:
item_data['title'] = tab.page().mainFrame().title()
else:
item_data['title'] = item_data['url']
if item.originalUrl() != item.url():
encoded = item.originalUrl().toEncoded()
item_data['original-url'] = bytes(encoded).decode('ascii')