From 5c73910a3396b5eac3e672aa30573ef91e8d756d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 14 Mar 2018 10:19:23 +0100 Subject: [PATCH] Revert "Insert qutebrowser scripts on DocumentCreation and DocumentReady" This reverts commit fac0f66e52c189344c8d5c27e0018c5909cda7f9. --- qutebrowser/browser/webengine/webenginetab.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index c21d29fef..6206a7774 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -640,21 +640,17 @@ class WebEngineTab(browsertab.AbstractTab): utils.read_file('javascript/webelem.js'), utils.read_file('javascript/caret.js'), ]) - scripts = self._widget.page().scripts() - script = QWebEngineScript() - script.setInjectionPoint(QWebEngineScript.DocumentCreation) + # We can't use DocumentCreation here as WORKAROUND for + # https://bugreports.qt.io/browse/QTBUG-66011 + script.setInjectionPoint(QWebEngineScript.DocumentReady) script.setSourceCode(js_code) - script.setWorldId(QWebEngineScript.ApplicationWorld) - # FIXME:qtwebengine what about runsOnSubFrames? - scripts.insert(script) - # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-66011 - script2 = QWebEngineScript() - script2.setInjectionPoint(QWebEngineScript.DocumentReady) - script2.setSourceCode(js_code) - script2.setWorldId(QWebEngineScript.ApplicationWorld) - scripts.insert(script2) + page = self._widget.page() + script.setWorldId(QWebEngineScript.ApplicationWorld) + + # FIXME:qtwebengine what about runsOnSubFrames? + page.scripts().insert(script) def _install_event_filter(self): self._widget.focusProxy().installEventFilter(self._mouse_event_filter)