Move qtutils.ensure_valid in WebView.openurl
This commit is contained in:
parent
e80475ed57
commit
8b67d68d4a
@ -27,7 +27,7 @@ from PyQt5.QtWidgets import QWidget, QLayout
|
||||
|
||||
from qutebrowser.keyinput import modeman
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.utils import utils, objreg, usertypes, message, log
|
||||
from qutebrowser.utils import utils, objreg, usertypes, message, log, qtutils
|
||||
|
||||
|
||||
tab_id_gen = itertools.count(0)
|
||||
@ -546,6 +546,10 @@ class AbstractTab(QWidget):
|
||||
def load_status(self):
|
||||
return self._load_status
|
||||
|
||||
def _openurl_prepare(self, url):
|
||||
qtutils.ensure_valid(url)
|
||||
self.title_changed.emit(url.toDisplayString())
|
||||
|
||||
def openurl(self, url):
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -261,7 +261,7 @@ class WebEngineTab(browsertab.AbstractTab):
|
||||
self.backend = usertypes.Backend.QtWebEngine
|
||||
|
||||
def openurl(self, url):
|
||||
self.title_changed.emit(url.toDisplayString())
|
||||
self._openurl_prepare(url)
|
||||
self._widget.load(url)
|
||||
|
||||
def url(self):
|
||||
|
@ -467,7 +467,7 @@ class WebKitTab(browsertab.AbstractTab):
|
||||
self.backend = usertypes.Backend.QtWebKit
|
||||
|
||||
def openurl(self, url):
|
||||
self.title_changed.emit(url.toDisplayString())
|
||||
self._openurl_prepare(url)
|
||||
self._widget.openurl(url)
|
||||
|
||||
def url(self):
|
||||
|
@ -278,7 +278,6 @@ class WebView(QWebView):
|
||||
Args:
|
||||
url: The URL to load as QUrl
|
||||
"""
|
||||
qtutils.ensure_valid(url)
|
||||
self.load(url)
|
||||
if url.scheme() == 'qute':
|
||||
frame = self.page().mainFrame()
|
||||
|
Loading…
Reference in New Issue
Block a user