Add tab.url(requested=True) to get original URL
This commit is contained in:
parent
81eb53a152
commit
eed3460317
@ -542,7 +542,7 @@ class AbstractTab(QWidget):
|
||||
def _on_ssl_errors(self):
|
||||
self._has_ssl_errors = True
|
||||
|
||||
def url(self):
|
||||
def url(self, requested=False):
|
||||
raise NotImplementedError
|
||||
|
||||
def progress(self):
|
||||
|
@ -363,8 +363,12 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
self._openurl_prepare(url)
|
||||
self._widget.load(url)
|
||||
|
||||
def url(self):
|
||||
return self._widget.url()
|
||||
def url(self, requested=False):
|
||||
page = self._widget.page()
|
||||
if requested:
|
||||
return page.requestedUrl()
|
||||
else:
|
||||
return page.url()
|
||||
|
||||
def dump_async(self, callback, *, plain=False):
|
||||
if plain:
|
||||
|
@ -514,8 +514,12 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
self._openurl_prepare(url)
|
||||
self._widget.openurl(url)
|
||||
|
||||
def url(self):
|
||||
return self._widget.url()
|
||||
def url(self, requested=False):
|
||||
frame = self._widget.page().mainFrame()
|
||||
if requested:
|
||||
return frame.requestedUrl()
|
||||
else:
|
||||
return frame.url()
|
||||
|
||||
def dump_async(self, callback, *, plain=False):
|
||||
frame = self._widget.page().mainFrame()
|
||||
|
Loading…
Reference in New Issue
Block a user