Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Jan 28, 2024
1 parent e3aa72b commit 9d8cc72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.script.CompiledScript
import com.script.ScriptContext
import com.script.ScriptEngine
import com.script.ScriptException
import kotlinx.coroutines.asContextElement
import kotlinx.coroutines.withContext
import org.mozilla.javascript.*
import java.io.IOException
Expand Down Expand Up @@ -98,7 +99,7 @@ internal class RhinoCompiledScript(
override suspend fun evalSuspend(scope: Scriptable): Any? {
val cx = Context.enter()
var ret: Any?
withContext(ContextElement()) {
withContext(VMBridgeReflect.contextLocal.asContextElement()) {
try {
try {
ret = cx.executeScriptWithContinuations(script, scope)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.script.rhino

import com.script.*
import kotlinx.coroutines.asContextElement
import kotlinx.coroutines.withContext
import org.mozilla.javascript.*
import org.mozilla.javascript.Function
Expand Down Expand Up @@ -87,7 +88,7 @@ object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
override suspend fun evalSuspend(reader: Reader, scope: Scriptable): Any? {
val cx = Context.enter()
var ret: Any?
withContext(ContextElement()) {
withContext(VMBridgeReflect.contextLocal.asContextElement()) {
try {
var filename = this@RhinoScriptEngine["javax.script.filename"] as? String
filename = filename ?: "<Unknown source>"
Expand Down

0 comments on commit 9d8cc72

Please sign in to comment.