Move qtutils.ensure_valid in WebView.openurl

This commit is contained in:
Florian Bruhin 2016-07-11 16:32:24 +02:00
parent e80475ed57
commit 8b67d68d4a
4 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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()