Don't use requested URLs

This commit is contained in:
Florian Bruhin 2018-06-14 00:08:43 +02:00
parent 394d91a11b
commit 651ed5247b

View File

@ -797,25 +797,14 @@ class _WebEngineScripts(QObject):
def _on_config_changed(self, option): def _on_config_changed(self, option):
if option in ['scrolling.bar', 'content.user_stylesheets']: if option in ['scrolling.bar', 'content.user_stylesheets']:
self._init_stylesheet() self._init_stylesheet()
url = self._tab.url(requested=True) self._update_stylesheet(url=self._tab.url())
self._update_stylesheet(url=url)
@pyqtSlot()
def _on_url_changed(self):
requested_url = self._tab.url(requested=True)
# Ignore blank QUrls to avoid crashes.
if not requested_url.isValid():
log.webview.debug("Not updating per-domain stylesheets due to the QUrl being blank")
return
self._update_stylesheet(requested_url)
@pyqtSlot() @pyqtSlot()
def _on_load_finished(self): def _on_load_finished(self):
url = self._tab.url(requested=True) url = self._tab.url()
self._update_stylesheet(url) self._update_stylesheet(url)
@pyqtSlot(QUrl)
def _update_stylesheet(self, url=None): def _update_stylesheet(self, url=None):
"""Update the custom stylesheet in existing tabs.""" """Update the custom stylesheet in existing tabs."""
css = shared.get_user_stylesheet(url=url) css = shared.get_user_stylesheet(url=url)