|
|
@@ -27,7 +27,8 @@ object SharedJsScope {
|
|
|
if (scope == null) {
|
|
|
val context = SCRIPT_ENGINE.getScriptContext(SimpleBindings())
|
|
|
scope = SCRIPT_ENGINE.getRuntimeScope(context)
|
|
|
- Context.enter().use {
|
|
|
+ val rhino = Context.enter()
|
|
|
+ rhino.runCatching {
|
|
|
if (jsLib.isJsonObject()) {
|
|
|
val jsMap: Map<String, String> = GSON.fromJson(
|
|
|
jsLib,
|
|
|
@@ -42,13 +43,14 @@ object SharedJsScope {
|
|
|
val js = okHttpClient.newCallStrResponse {
|
|
|
url(value)
|
|
|
}.body
|
|
|
- it.evaluateString(scope, js, "jsLib", 1, null)
|
|
|
+ evaluateString(scope, js, "jsLib", 1, null)
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- it.evaluateString(scope, jsLib, "jsLib", 1, null)
|
|
|
+ evaluateString(scope, jsLib, "jsLib", 1, null)
|
|
|
}
|
|
|
}
|
|
|
+ Context.exit()
|
|
|
scopeMap[key] = WeakReference(scope)
|
|
|
}
|
|
|
return scope
|