Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
unknown 2017-12-07 13:36:49 -07:00
commit 2483b8315c
3 changed files with 11 additions and 8 deletions

View File

@ -1317,7 +1317,7 @@ tabs.title.format:
* `{backend}`: Either ''webkit'' or ''webengine''
* `{private}`: Indicates when private mode is enabled.
* `{current_url}`: URL of the current web page.
* `{protocol}` : Internet Protocol of the current web page.
* `{protocol}`: Protocol (http/https/...) of the current web page
tabs.title.format_pinned:
default: '{index}'

View File

@ -166,23 +166,25 @@ class TabWidget(QTabWidget):
fields['backend'] = objects.backend.name
fields['private'] = ' [Private Mode] ' if tab.private else ''
url = self.tab_url(idx)
if tab.load_status() == usertypes.LoadStatus.loading:
fields['perc'] = '[{}%] '.format(tab.progress())
else:
fields['perc'] = ''
try:
fields['host'] = self.tab_url(idx).host()
fields['host'] = url.host()
except qtutils.QtValueError:
fields['host'] = ''
try:
fields['current_url'] = self.tab_url(idx).url()
fields['current_url'] = url.url()
except qtutils.QtValueError:
fields['current_url'] = ''
try:
fields['protocol'] = self.tab_url(idx).scheme()
fields['protocol'] = url.scheme()
except qtutils.QtValueError:
fields['protocol'] = ''

View File

@ -131,11 +131,12 @@ class FakeUrl:
"""QUrl stub which provides .path(), isValid() and host()."""
def __init__(self, path=None, valid=True, host=None, url=None):
def __init__(self, path=None, valid=True, host=None, url=None, scheme=None):
self.path = mock.Mock(return_value=path)
self.isValid = mock.Mock(returl_value=valid)
self.host = mock.Mock(returl_value=host)
self.url = mock.Mock(return_value=url)
self.scheme = mock.Mock(return_value=scheme)
class FakeNetworkReply: