summaryrefslogtreecommitdiff
path: root/qutebrowser
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-08-26 17:27:27 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-08-26 17:27:27 +0200
commitb5af26f8d07b840fd187874df6ccaded60a67cc9 (patch)
treeba6055d5d38a3f371957855459fda844c7b3c952 /qutebrowser
parent735f1774e4c622ea50a4576d180daecfc0698918 (diff)
downloadqutebrowser-b5af26f8d07b840fd187874df6ccaded60a67cc9.tar.gz
qutebrowser-b5af26f8d07b840fd187874df6ccaded60a67cc9.zip
Work around world id issue
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/browser/webengine/webenginetab.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py
index f01e902fb..d71a31ad5 100644
--- a/qutebrowser/browser/webengine/webenginetab.py
+++ b/qutebrowser/browser/webengine/webenginetab.py
@@ -45,10 +45,10 @@ from qutebrowser.misc import objects, miscwidgets
# Mapping worlds from usertypes.JsWorld to QWebEngineScript world IDs.
_JS_WORLD_MAP = {
- usertypes.JsWorld.main: QWebEngineScript.ScriptWorldId.MainWorld,
- usertypes.JsWorld.application: QWebEngineScript.ScriptWorldId.ApplicationWorld,
- usertypes.JsWorld.user: QWebEngineScript.ScriptWorldId.UserWorld,
- usertypes.JsWorld.jseval: QWebEngineScript.ScriptWorldId.UserWorld + 1,
+ usertypes.JsWorld.main: 1,
+ usertypes.JsWorld.application: 2,
+ usertypes.JsWorld.user: 3,
+ usertypes.JsWorld.jseval: 4,
}
@@ -198,7 +198,8 @@ class WebEngineSearch(browsertab.AbstractSearch):
self._wrap_handler = _WebEngineSearchWrapHandler()
def _empty_flags(self):
- return QWebEnginePage.FindFlags(0) # type: ignore[call-overload]
+ return 0
+ #return QWebEnginePage.FindFlag() # type: ignore[call-overload]
def connect_signals(self):
self._wrap_handler.connect_signal(self._widget.page())
@@ -991,7 +992,7 @@ class _Quirk:
filename: str
injection_point: QWebEngineScript.InjectionPoint = (
QWebEngineScript.InjectionPoint.DocumentCreation)
- world: QWebEngineScript.ScriptWorldId = QWebEngineScript.ScriptWorldId.MainWorld
+ world: int = 1
predicate: bool = True
name: Optional[str] = None
@@ -1030,7 +1031,7 @@ class _WebEngineScripts(QObject):
self._tab.run_js_async(code)
def _inject_js(self, name, js_code, *,
- world=QWebEngineScript.ScriptWorldId.ApplicationWorld,
+ world=2,
injection_point=QWebEngineScript.InjectionPoint.DocumentCreation,
subframes=False):
"""Inject the given script to run early on a page load."""
@@ -1170,7 +1171,7 @@ class _WebEngineScripts(QObject):
_Quirk(
'whatsapp_web',
injection_point=QWebEngineScript.InjectionPoint.DocumentReady,
- world=QWebEngineScript.ScriptWorldId.ApplicationWorld,
+ world=1,
),
_Quirk('discord'),
_Quirk(
@@ -1330,7 +1331,7 @@ class WebEngineTab(browsertab.AbstractTab):
def run_js_async(self, code, callback=None, *, world=None):
world_id_type = Union[QWebEngineScript.ScriptWorldId, int]
if world is None:
- world_id: world_id_type = QWebEngineScript.ScriptWorldId.ApplicationWorld
+ world_id: world_id_type = 1
elif isinstance(world, int):
world_id = world
if not 0 <= world_id <= qtutils.MAX_WORLD_ID: