|
|
@@ -91,12 +91,6 @@ object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|
|
coroutineContext: CoroutineContext?
|
|
|
): Any? {
|
|
|
val cx = Context.enter() as RhinoContext
|
|
|
- try {
|
|
|
- cx.checkRecursive()
|
|
|
- } catch (e: RhinoRecursionError) {
|
|
|
- Context.exit()
|
|
|
- throw e
|
|
|
- }
|
|
|
val previousCoroutineContext = cx.coroutineContext
|
|
|
if (coroutineContext != null && coroutineContext[Job] != null) {
|
|
|
cx.coroutineContext = coroutineContext
|
|
|
@@ -105,6 +99,7 @@ object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|
|
cx.recursiveCount++
|
|
|
val ret: Any?
|
|
|
try {
|
|
|
+ cx.checkRecursive()
|
|
|
var filename = this["javax.script.filename"] as? String
|
|
|
filename = filename ?: "<Unknown source>"
|
|
|
ret = cx.evaluateReader(scope, reader, filename, 1, null)
|
|
|
@@ -132,17 +127,12 @@ object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|
|
@Throws(ContinuationPending::class)
|
|
|
override suspend fun evalSuspend(reader: Reader, scope: Scriptable): Any? {
|
|
|
val cx = Context.enter() as RhinoContext
|
|
|
- try {
|
|
|
- cx.checkRecursive()
|
|
|
- } catch (e: RhinoRecursionError) {
|
|
|
- Context.exit()
|
|
|
- throw e
|
|
|
- }
|
|
|
var ret: Any?
|
|
|
withContext(VMBridgeReflect.contextLocal.asContextElement()) {
|
|
|
cx.allowScriptRun = true
|
|
|
cx.recursiveCount++
|
|
|
try {
|
|
|
+ cx.checkRecursive()
|
|
|
var filename = this@RhinoScriptEngine["javax.script.filename"] as? String
|
|
|
filename = filename ?: "<Unknown source>"
|
|
|
val script = cx.compileReader(reader, filename, 1, null)
|