catching greasemonkey errors aswell

This commit is contained in:
Jesko 2018-08-15 22:52:47 +02:00 committed by Jimmy
parent 583c7e4198
commit 8aa682e769
2 changed files with 6 additions and 1 deletions

View File

@ -2087,7 +2087,7 @@ class CommandDispatcher:
widget = self._current_widget()
try:
widget.run_js_async(js_code, callback=jseval_cb, world=world)
except OverflowError as e:
except OverflowError:
raise cmdexc.CommandError("World Id not in valid range")
@cmdutils.register(instance='command-dispatcher', scope='window')

View File

@ -948,6 +948,11 @@ class _WebEngineScripts(QObject):
new_script = QWebEngineScript()
try:
world = int(script.jsworld)
if not 0 <= world < 256:
log.greasemonkey.error(
"script {} has invalid value for '@qute-js-world'"
": {}".format(script.name, script.jsworld))
continue
except ValueError:
try:
world = _JS_WORLD_MAP[usertypes.JsWorld[