use a temporary attribute of the class to prevent the loop; tested to work in both backends
This commit is contained in:
parent
9e258a490e
commit
4a4a6549d0
@ -99,7 +99,6 @@ class TabData:
|
||||
Only used for QtWebKit.
|
||||
pinned: Flag to pin the tab.
|
||||
fullscreen: Whether the tab has a video shown fullscreen currently.
|
||||
netrc_used: flag to avoid endless loop when using netrc
|
||||
"""
|
||||
|
||||
keep_icon = attr.ib(False)
|
||||
@ -108,7 +107,6 @@ class TabData:
|
||||
override_target = attr.ib(None)
|
||||
pinned = attr.ib(False)
|
||||
fullscreen = attr.ib(False)
|
||||
netrc_used = False
|
||||
|
||||
|
||||
class AbstractAction:
|
||||
@ -726,7 +724,12 @@ class AbstractTab(QWidget):
|
||||
self._progress = 0
|
||||
self._has_ssl_errors = False
|
||||
self.data.viewing_source = False
|
||||
self.data.netrc_used = 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()
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
"""Wrapper over a QWebEngineView."""
|
||||
|
||||
import os
|
||||
import math
|
||||
import functools
|
||||
import html as html_utils
|
||||
@ -741,8 +740,8 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
@pyqtSlot(QUrl, 'QAuthenticator*')
|
||||
def _on_authentication_required(self, url, authenticator):
|
||||
netrc = None
|
||||
if not self.data.netrc_used:
|
||||
self.data.netrc_used = True
|
||||
if not hasattr(self, 'netrc_used'):
|
||||
setattr(self, 'netrc_used', True)
|
||||
netrc = shared.netrc_authentication(url, authenticator)
|
||||
if not netrc:
|
||||
abort_on = [self.shutting_down, self.load_started]
|
||||
|
@ -269,8 +269,8 @@ class NetworkManager(QNetworkAccessManager):
|
||||
def on_authentication_required(self, reply, authenticator):
|
||||
"""Called when a website needs authentication."""
|
||||
netrc = False
|
||||
if not self.data.netrc_used:
|
||||
self.data.netrc_used = True
|
||||
if not hasattr(self, 'netrc_used'):
|
||||
setattr(self, 'netrc_used', True)
|
||||
netrc = shared.netrc_authentication(reply.url(), authenticator)
|
||||
if not netrc:
|
||||
abort_on = self._get_abort_signals(reply)
|
||||
|
Loading…
Reference in New Issue
Block a user