From d2287b7a2ec7d01a6e5d82bb881c62f360951d8e Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Thu, 25 Jan 2018 22:38:25 -0500 Subject: [PATCH] move backend specific code out of AbstractTab into respective backend classes. --- qutebrowser/browser/browsertab.py | 6 ------ qutebrowser/browser/webengine/webenginetab.py | 2 ++ qutebrowser/browser/webkit/webkittab.py | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index b53cd32ca..331934cb9 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -724,12 +724,6 @@ class AbstractTab(QWidget): self._progress = 0 self._has_ssl_errors = False self.data.viewing_source = False - if self.backend == usertypes.Backend.QtWebKit: - obj = self.networkaccessmanager() - else: - obj = self - if hasattr(obj, 'netrc_used'): - delattr(obj, 'netrc_used') self._set_load_status(usertypes.LoadStatus.loading) self.load_started.emit() diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 4a05312f8..838bf3b55 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -783,6 +783,8 @@ class WebEngineTab(browsertab.AbstractTab): # https://bugreports.qt.io/browse/QTBUG-61506 self.search.clear() super()._on_load_started() + if hasattr(self, 'netrc_used'): + delattr(self, 'netrc_used') @pyqtSlot(QWebEnginePage.RenderProcessTerminationStatus, int) def _on_render_process_terminated(self, status, exitcode): diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 6b8f067fd..29df35e8f 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -704,6 +704,13 @@ class WebKitTab(browsertab.AbstractTab): page = self._widget.page() return page.userAgentForUrl(self.url()) + @pyqtSlot() + def _on_load_started(self): + super()._on_load_started() + obj = self.networkaccessmanager() + if hasattr(obj, 'netrc_used'): + delattr(obj, 'netrc_used') + @pyqtSlot() def _on_frame_load_finished(self): """Make sure we emit an appropriate status when loading finished.