This commit is contained in:
Horis
2025-04-07 17:52:25 +08:00
parent adb2679d31
commit c33939e148
@@ -89,9 +89,11 @@ internal class RhinoCompiledScript(
} }
override suspend fun evalSuspend(scope: Scriptable): Any? { override suspend fun evalSuspend(scope: Scriptable): Any? {
val cx = Context.enter() val cx = Context.enter() as RhinoContext
var ret: Any? var ret: Any?
withContext(VMBridgeReflect.contextLocal.asContextElement()) { withContext(VMBridgeReflect.contextLocal.asContextElement()) {
cx.allowScriptRun = true
cx.recursiveCount++
try { try {
try { try {
ret = cx.executeScriptWithContinuations(script, scope) ret = cx.executeScriptWithContinuations(script, scope)
@@ -126,6 +128,8 @@ internal class RhinoCompiledScript(
} catch (var14: IOException) { } catch (var14: IOException) {
throw ScriptException(var14) throw ScriptException(var14)
} finally { } finally {
cx.allowScriptRun = false
cx.recursiveCount--
Context.exit() Context.exit()
} }
} }