diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index c66f3fe2e..212cb4028 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -467,6 +467,7 @@ class WebEngineTab(browsertab.AbstractTab): # init js stuff self._init_js() self._child_event_filter = None + self.needs_qtbug54419_workaround = False def _init_js(self): js_code = '\n'.join([ diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py index 18a7607a5..46a99db24 100644 --- a/qutebrowser/browser/webengine/webview.py +++ b/qutebrowser/browser/webengine/webview.py @@ -67,15 +67,6 @@ class WebEngineView(QWebEngineView): debug_type = debug.qenum_key(QWebEnginePage, wintype) log.webview.debug("createWindow with type {}".format(debug_type)) - # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-54419 - vercheck = qtutils.version_check - qtbug_54419_fixed = ((vercheck('5.6.2') and not vercheck('5.7.0')) or - qtutils.version_check('5.7.1') or - os.environ.get('QUTE_QTBUG54419_PATCHED', '')) - if not qtbug_54419_fixed: - log.webview.debug("Ignoring createWindow because of QTBUG-54419") - return None - background = False if wintype in [QWebEnginePage.WebBrowserWindow, QWebEnginePage.WebDialog]: @@ -91,8 +82,17 @@ class WebEngineView(QWebEngineView): tabbed_browser = objreg.get('tabbed-browser', scope='window', window=self._win_id) - # pylint: disable=protected-access - return tabbed_browser.tabopen(background=background)._widget + tab = tabbed_browser.tabopen(background=background) + + # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-54419 + vercheck = qtutils.version_check + qtbug54419_fixed = ((vercheck('5.6.2') and not vercheck('5.7.0')) or + qtutils.version_check('5.7.1') or + os.environ.get('QUTE_QTBUG54419_PATCHED', '')) + if not qtbug54419_fixed: + tab.needs_qtbug54419_workaround = True + + return tab._widget # pylint: disable=protected-access class WebEnginePage(QWebEnginePage): diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 13b4f1884..7dfd9b8fd 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -515,9 +515,23 @@ class TabbedBrowser(tabwidget.TabWidget): except TabDeletedError: # We can get signals for tabs we already deleted... return + if not self.page_title(idx): self.set_page_title(idx, url.toDisplayString()) + # If needed, re-open the tab as a workaround for QTBUG-54419. + # See https://bugreports.qt.io/browse/QTBUG-54419 + if tab.needs_qtbug54419_workaround: + log.misc.debug("Doing QTBUG-54419 workaround for {}, " + "url {}".format(tab, url)) + self.setUpdatesEnabled(False) + try: + self.tabopen(url) + self.close_tab(tab, add_undo=False) + finally: + self.setUpdatesEnabled(True) + tab.needs_qtbug54419_workaround = False + @pyqtSlot(browsertab.AbstractTab, QIcon) def on_icon_changed(self, tab, icon): """Set the icon of a tab.