Try to update settings in acceptNavigationRequest
This still doesn't seem to update them early enough?
This commit is contained in:
parent
bd6e99158e
commit
8b666d2d2e
@ -872,6 +872,12 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
if not ok:
|
||||
self._load_finished_fake.emit(False)
|
||||
|
||||
@pyqtSlot(usertypes.NavigationRequest)
|
||||
def _on_navigation_request(self, navigation):
|
||||
super()._on_navigation_request(navigation)
|
||||
if navigation.accepted:
|
||||
webenginesettings.update_for_tab(self, navigation.url)
|
||||
|
||||
def _connect_signals(self):
|
||||
view = self._widget
|
||||
page = view.page()
|
||||
@ -907,8 +913,5 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
page.loadFinished.connect(self._restore_zoom)
|
||||
page.loadFinished.connect(self._on_load_finished)
|
||||
|
||||
self.url_changed.connect(
|
||||
functools.partial(webenginesettings.update_for_tab, self))
|
||||
|
||||
def event_target(self):
|
||||
return self._widget.focusProxy()
|
||||
|
@ -781,6 +781,10 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
self.data.open_target = usertypes.ClickTarget.normal
|
||||
navigation.accepted = False
|
||||
|
||||
if (navigation.accepted and navigation.navigation_type !=
|
||||
navigation.Type.reloaded):
|
||||
webkitsettings.update_for_tab(self, navigation.url)
|
||||
|
||||
def _connect_signals(self):
|
||||
view = self._widget
|
||||
page = view.page()
|
||||
@ -801,8 +805,5 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
frame.initialLayoutCompleted.connect(self._on_history_trigger)
|
||||
page.navigation_request.connect(self._on_navigation_request)
|
||||
|
||||
self.url_changed.connect(
|
||||
functools.partial(webkitsettings.update_for_tab, self))
|
||||
|
||||
def event_target(self):
|
||||
return self._widget
|
||||
|
@ -24,8 +24,17 @@
|
||||
import attr
|
||||
|
||||
|
||||
# Sentinel object
|
||||
UNSET = object()
|
||||
class _UnsetObject:
|
||||
|
||||
"""Sentinel object."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __repr__(self):
|
||||
return '<UNSET>'
|
||||
|
||||
|
||||
UNSET = _UnsetObject()
|
||||
|
||||
|
||||
@attr.s
|
||||
|
@ -230,6 +230,9 @@ def update_for_tab(mappings, tab, url):
|
||||
mapping = mappings[values.opt.name]
|
||||
|
||||
value = values.get_for_url(url, fallback=False)
|
||||
log.config.debug("Updating for {}: {} = {}".format(
|
||||
url.toDisplayString(), values.opt.name, value))
|
||||
|
||||
# FIXME:conf have a proper API for this.
|
||||
settings = tab._widget.settings() # pylint: disable=protected-access
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user