Add tab.url(requested=True) to get original URL

This commit is contained in:
Florian Bruhin 2016-08-10 13:07:12 +02:00
parent 81eb53a152
commit eed3460317
3 changed files with 13 additions and 5 deletions

View File

@ -542,7 +542,7 @@ class AbstractTab(QWidget):
def _on_ssl_errors(self): def _on_ssl_errors(self):
self._has_ssl_errors = True self._has_ssl_errors = True
def url(self): def url(self, requested=False):
raise NotImplementedError raise NotImplementedError
def progress(self): def progress(self):

View File

@ -363,8 +363,12 @@ class WebEngineTab(browsertab.AbstractTab):
self._openurl_prepare(url) self._openurl_prepare(url)
self._widget.load(url) self._widget.load(url)
def url(self): def url(self, requested=False):
return self._widget.url() page = self._widget.page()
if requested:
return page.requestedUrl()
else:
return page.url()
def dump_async(self, callback, *, plain=False): def dump_async(self, callback, *, plain=False):
if plain: if plain:

View File

@ -514,8 +514,12 @@ class WebKitTab(browsertab.AbstractTab):
self._openurl_prepare(url) self._openurl_prepare(url)
self._widget.openurl(url) self._widget.openurl(url)
def url(self): def url(self, requested=False):
return self._widget.url() frame = self._widget.page().mainFrame()
if requested:
return frame.requestedUrl()
else:
return frame.url()
def dump_async(self, callback, *, plain=False): def dump_async(self, callback, *, plain=False):
frame = self._widget.page().mainFrame() frame = self._widget.page().mainFrame()