优化
This commit is contained in:
@@ -10,13 +10,18 @@ import android.os.Build
|
|||||||
import com.github.liuyueyi.quick.transfer.ChineseUtils
|
import com.github.liuyueyi.quick.transfer.ChineseUtils
|
||||||
import com.github.liuyueyi.quick.transfer.constants.TransType
|
import com.github.liuyueyi.quick.transfer.constants.TransType
|
||||||
import com.jeremyliao.liveeventbus.LiveEventBus
|
import com.jeremyliao.liveeventbus.LiveEventBus
|
||||||
|
import com.script.rhino.RhinoScriptEngine
|
||||||
import io.legado.app.base.AppContextWrapper
|
import io.legado.app.base.AppContextWrapper
|
||||||
import io.legado.app.constant.AppConst.channelIdDownload
|
import io.legado.app.constant.AppConst.channelIdDownload
|
||||||
import io.legado.app.constant.AppConst.channelIdReadAloud
|
import io.legado.app.constant.AppConst.channelIdReadAloud
|
||||||
import io.legado.app.constant.AppConst.channelIdWeb
|
import io.legado.app.constant.AppConst.channelIdWeb
|
||||||
import io.legado.app.constant.PreferKey
|
import io.legado.app.constant.PreferKey
|
||||||
import io.legado.app.data.appDb
|
import io.legado.app.data.appDb
|
||||||
import io.legado.app.help.*
|
import io.legado.app.help.AppWebDav
|
||||||
|
import io.legado.app.help.CrashHandler
|
||||||
|
import io.legado.app.help.DefaultData
|
||||||
|
import io.legado.app.help.LifecycleHelp
|
||||||
|
import io.legado.app.help.RuleBigDataHelp
|
||||||
import io.legado.app.help.book.BookHelp
|
import io.legado.app.help.book.BookHelp
|
||||||
import io.legado.app.help.config.AppConfig
|
import io.legado.app.help.config.AppConfig
|
||||||
import io.legado.app.help.config.ThemeConfig.applyDayNight
|
import io.legado.app.help.config.ThemeConfig.applyDayNight
|
||||||
@@ -36,6 +41,7 @@ class App : Application() {
|
|||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
RhinoScriptEngine
|
||||||
oldConfig = Configuration(resources.configuration)
|
oldConfig = Configuration(resources.configuration)
|
||||||
CrashHandler(this)
|
CrashHandler(this)
|
||||||
//预下载Cronet so
|
//预下载Cronet so
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.legado.app.data.entities
|
package io.legado.app.data.entities
|
||||||
|
|
||||||
import cn.hutool.crypto.symmetric.AES
|
import cn.hutool.crypto.symmetric.AES
|
||||||
|
import com.script.SimpleBindings
|
||||||
|
import com.script.rhino.RhinoScriptEngine
|
||||||
import io.legado.app.constant.AppConst
|
import io.legado.app.constant.AppConst
|
||||||
import io.legado.app.constant.AppLog
|
import io.legado.app.constant.AppLog
|
||||||
import io.legado.app.data.entities.rule.RowUi
|
import io.legado.app.data.entities.rule.RowUi
|
||||||
@@ -10,9 +12,6 @@ import io.legado.app.help.config.AppConfig
|
|||||||
import io.legado.app.help.http.CookieStore
|
import io.legado.app.help.http.CookieStore
|
||||||
import io.legado.app.model.SharedJsScope
|
import io.legado.app.model.SharedJsScope
|
||||||
import io.legado.app.rhino.Bindings
|
import io.legado.app.rhino.Bindings
|
||||||
import io.legado.app.rhino.Rhino
|
|
||||||
import io.legado.app.rhino.evaluate
|
|
||||||
import io.legado.app.rhino.putBindings
|
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
import org.intellij.lang.annotations.Language
|
import org.intellij.lang.annotations.Language
|
||||||
import org.mozilla.javascript.Scriptable
|
import org.mozilla.javascript.Scriptable
|
||||||
@@ -237,14 +236,15 @@ interface BaseSource : JsExtensions {
|
|||||||
bindings["baseUrl"] = getKey()
|
bindings["baseUrl"] = getKey()
|
||||||
bindings["cookie"] = CookieStore
|
bindings["cookie"] = CookieStore
|
||||||
bindings["cache"] = CacheManager
|
bindings["cache"] = CacheManager
|
||||||
return Rhino.use {
|
// return Rhino.use {
|
||||||
val scope = initStandardObjects()
|
// val scope = initStandardObjects()
|
||||||
scope.putBindings(bindings)
|
// scope.putBindings(bindings)
|
||||||
getShareScope()?.let {
|
// getShareScope()?.let {
|
||||||
scope.prototype = it
|
// scope.prototype = it
|
||||||
}
|
// }
|
||||||
evaluate(scope, jsStr)
|
// evaluate(scope, jsStr)
|
||||||
}
|
// }
|
||||||
|
return RhinoScriptEngine.eval(jsStr, SimpleBindings(bindings))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getShareScope(): Scriptable? {
|
fun getShareScope(): Scriptable? {
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package io.legado.app.model.analyzeRule
|
|||||||
|
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
|
import com.script.SimpleBindings
|
||||||
|
import com.script.rhino.RhinoScriptEngine
|
||||||
import io.legado.app.constant.AppPattern.JS_PATTERN
|
import io.legado.app.constant.AppPattern.JS_PATTERN
|
||||||
import io.legado.app.data.entities.*
|
import io.legado.app.data.entities.*
|
||||||
import io.legado.app.help.CacheManager
|
import io.legado.app.help.CacheManager
|
||||||
@@ -9,9 +11,6 @@ import io.legado.app.help.JsExtensions
|
|||||||
import io.legado.app.help.http.CookieStore
|
import io.legado.app.help.http.CookieStore
|
||||||
import io.legado.app.model.webBook.WebBook
|
import io.legado.app.model.webBook.WebBook
|
||||||
import io.legado.app.rhino.Bindings
|
import io.legado.app.rhino.Bindings
|
||||||
import io.legado.app.rhino.Rhino
|
|
||||||
import io.legado.app.rhino.evaluate
|
|
||||||
import io.legado.app.rhino.putBindings
|
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withTimeout
|
import kotlinx.coroutines.withTimeout
|
||||||
@@ -695,14 +694,15 @@ class AnalyzeRule(
|
|||||||
bindings["title"] = chapter?.title
|
bindings["title"] = chapter?.title
|
||||||
bindings["src"] = content
|
bindings["src"] = content
|
||||||
bindings["nextChapterUrl"] = nextChapterUrl
|
bindings["nextChapterUrl"] = nextChapterUrl
|
||||||
return Rhino.use {
|
// return Rhino.use {
|
||||||
val scope = initStandardObjects()
|
// val scope = initStandardObjects()
|
||||||
scope.putBindings(bindings)
|
// scope.putBindings(bindings)
|
||||||
source?.getShareScope()?.let {
|
// source?.getShareScope()?.let {
|
||||||
scope.prototype = it
|
// scope.prototype = it
|
||||||
}
|
// }
|
||||||
evaluate(scope, jsStr)
|
// evaluate(scope, jsStr)
|
||||||
}
|
// }
|
||||||
|
return RhinoScriptEngine.eval(jsStr, SimpleBindings(bindings))
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSource(): BaseSource? {
|
override fun getSource(): BaseSource? {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import android.util.Base64
|
|||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import cn.hutool.core.util.HexUtil
|
import cn.hutool.core.util.HexUtil
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
|
import com.script.SimpleBindings
|
||||||
|
import com.script.rhino.RhinoScriptEngine
|
||||||
import io.legado.app.constant.AppConst.UA_NAME
|
import io.legado.app.constant.AppConst.UA_NAME
|
||||||
import io.legado.app.constant.AppPattern
|
import io.legado.app.constant.AppPattern
|
||||||
import io.legado.app.constant.AppPattern.JS_PATTERN
|
import io.legado.app.constant.AppPattern.JS_PATTERN
|
||||||
@@ -19,9 +21,6 @@ import io.legado.app.help.config.AppConfig
|
|||||||
import io.legado.app.help.glide.GlideHeaders
|
import io.legado.app.help.glide.GlideHeaders
|
||||||
import io.legado.app.help.http.*
|
import io.legado.app.help.http.*
|
||||||
import io.legado.app.rhino.Bindings
|
import io.legado.app.rhino.Bindings
|
||||||
import io.legado.app.rhino.Rhino
|
|
||||||
import io.legado.app.rhino.evaluate
|
|
||||||
import io.legado.app.rhino.putBindings
|
|
||||||
import io.legado.app.utils.*
|
import io.legado.app.utils.*
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
@@ -267,14 +266,15 @@ class AnalyzeUrl(
|
|||||||
bindings["book"] = ruleData as? Book
|
bindings["book"] = ruleData as? Book
|
||||||
bindings["source"] = source
|
bindings["source"] = source
|
||||||
bindings["result"] = result
|
bindings["result"] = result
|
||||||
return Rhino.use {
|
// return Rhino.use {
|
||||||
val scope = initStandardObjects()
|
// val scope = initStandardObjects()
|
||||||
scope.putBindings(bindings)
|
// scope.putBindings(bindings)
|
||||||
source?.getShareScope()?.let {
|
// source?.getShareScope()?.let {
|
||||||
scope.prototype = it
|
// scope.prototype = it
|
||||||
}
|
// }
|
||||||
evaluate(scope, jsStr)
|
// evaluate(scope, jsStr)
|
||||||
}
|
// }
|
||||||
|
return RhinoScriptEngine.eval(jsStr, SimpleBindings(bindings))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun put(key: String, value: String): String {
|
fun put(key: String, value: String): String {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package io.legado.app.rhino
|
package io.legado.app.rhino
|
||||||
|
|
||||||
import com.script.RhinoContextFactory
|
|
||||||
import org.mozilla.javascript.Context
|
import org.mozilla.javascript.Context
|
||||||
import org.mozilla.javascript.ContextFactory
|
|
||||||
import org.mozilla.javascript.Undefined
|
import org.mozilla.javascript.Undefined
|
||||||
import org.mozilla.javascript.Wrapper
|
import org.mozilla.javascript.Wrapper
|
||||||
|
|
||||||
@@ -25,19 +23,18 @@ object Rhino {
|
|||||||
return if (result1 is Undefined) null else result1
|
return if (result1 is Undefined) null else result1
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
// init {
|
||||||
ContextFactory.initGlobal(object : RhinoContextFactory() {
|
// ContextFactory.initGlobal(object : RhinoContextFactory() {
|
||||||
|
//
|
||||||
override fun makeContext(): Context {
|
// override fun makeContext(): Context {
|
||||||
val cx = super.makeContext()
|
// val cx = super.makeContext()
|
||||||
cx.languageVersion = 200
|
// cx.languageVersion = 200
|
||||||
cx.optimizationLevel = -1
|
// cx.optimizationLevel = -1
|
||||||
cx.setClassShutter(RhinoClassShutter)
|
// cx.setClassShutter(RhinoClassShutter)
|
||||||
//cx.wrapFactory = RhinoWrapFactory
|
// return cx
|
||||||
return cx
|
// }
|
||||||
}
|
//
|
||||||
|
// })
|
||||||
})
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ import java.security.*
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
||||||
var accessContext: AccessControlContext? = null
|
var accessContext: AccessControlContext? = null
|
||||||
private var topLevel: RhinoTopLevel? = null
|
private var topLevel: RhinoTopLevel? = null
|
||||||
private val indexedProps: MutableMap<Any, Any?>
|
private val indexedProps: MutableMap<Any, Any?>
|
||||||
@@ -197,63 +197,6 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|||||||
return if (result1 is Undefined) null else result1
|
return if (result1 is Undefined) null else result1
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
|
||||||
if (System.getSecurityManager() != null) {
|
|
||||||
try {
|
|
||||||
AccessController.checkPermission(AllPermission())
|
|
||||||
} catch (var6: AccessControlException) {
|
|
||||||
accessContext = AccessController.getContext()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val cx = Context.enter()
|
|
||||||
try {
|
|
||||||
topLevel = RhinoTopLevel(cx, this)
|
|
||||||
} finally {
|
|
||||||
Context.exit()
|
|
||||||
}
|
|
||||||
indexedProps = HashMap()
|
|
||||||
implementor = object : InterfaceImplementor(this) {
|
|
||||||
|
|
||||||
override fun isImplemented(obj: Any?, clazz: Class<*>): Boolean {
|
|
||||||
var obj1 = obj
|
|
||||||
return try {
|
|
||||||
if (obj1 != null && obj1 !is Scriptable) {
|
|
||||||
obj1 = Context.toObject(obj1, topLevel)
|
|
||||||
}
|
|
||||||
val engineScope = getRuntimeScope(context)
|
|
||||||
val localScope = if (obj1 != null) obj1 as Scriptable else engineScope
|
|
||||||
val methods = clazz.methods
|
|
||||||
val methodsSize = methods.size
|
|
||||||
for (index in 0 until methodsSize) {
|
|
||||||
val method = methods[index]
|
|
||||||
if (method.declaringClass != Any::class.java) {
|
|
||||||
if (ScriptableObject.getProperty(
|
|
||||||
localScope,
|
|
||||||
method.name
|
|
||||||
) !is Function
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} finally {
|
|
||||||
Context.exit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun convertResult(method: Method?, res: Any?): Any? {
|
|
||||||
method ?: return null
|
|
||||||
val desiredType = method.returnType
|
|
||||||
if (desiredType == Void.TYPE) return null
|
|
||||||
return Context.jsToJava(res, desiredType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
ContextFactory.initGlobal(object : ContextFactory() {
|
ContextFactory.initGlobal(object : ContextFactory() {
|
||||||
|
|
||||||
@@ -310,6 +253,58 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|||||||
return super.doTopCall(callable, cx, scope, thisObj, args)
|
return super.doTopCall(callable, cx, scope, thisObj, args)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (System.getSecurityManager() != null) {
|
||||||
|
try {
|
||||||
|
AccessController.checkPermission(AllPermission())
|
||||||
|
} catch (var6: AccessControlException) {
|
||||||
|
accessContext = AccessController.getContext()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val cx = Context.enter()
|
||||||
|
try {
|
||||||
|
topLevel = RhinoTopLevel(cx, this)
|
||||||
|
} finally {
|
||||||
|
Context.exit()
|
||||||
|
}
|
||||||
|
indexedProps = HashMap()
|
||||||
|
implementor = object : InterfaceImplementor(this) {
|
||||||
|
|
||||||
|
override fun isImplemented(obj: Any?, clazz: Class<*>): Boolean {
|
||||||
|
var obj1 = obj
|
||||||
|
return try {
|
||||||
|
if (obj1 != null && obj1 !is Scriptable) {
|
||||||
|
obj1 = Context.toObject(obj1, topLevel)
|
||||||
|
}
|
||||||
|
val engineScope = getRuntimeScope(context)
|
||||||
|
val localScope = if (obj1 != null) obj1 as Scriptable else engineScope
|
||||||
|
val methods = clazz.methods
|
||||||
|
val methodsSize = methods.size
|
||||||
|
for (index in 0 until methodsSize) {
|
||||||
|
val method = methods[index]
|
||||||
|
if (method.declaringClass != Any::class.java) {
|
||||||
|
if (ScriptableObject.getProperty(
|
||||||
|
localScope,
|
||||||
|
method.name
|
||||||
|
) !is Function
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
true
|
||||||
|
} finally {
|
||||||
|
Context.exit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convertResult(method: Method?, res: Any?): Any? {
|
||||||
|
method ?: return null
|
||||||
|
val desiredType = method.returnType
|
||||||
|
if (desiredType == Void.TYPE) return null
|
||||||
|
return Context.jsToJava(res, desiredType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@ import java.security.*
|
|||||||
* @author A. Sundararajan
|
* @author A. Sundararajan
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
object RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
||||||
var accessContext: AccessControlContext? = null
|
var accessContext: AccessControlContext? = null
|
||||||
private var topLevel: RhinoTopLevel? = null
|
private var topLevel: RhinoTopLevel? = null
|
||||||
private val indexedProps: MutableMap<Any, Any?>
|
private val indexedProps: MutableMap<Any, Any?>
|
||||||
@@ -198,63 +198,7 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (System.getSecurityManager() != null) {
|
|
||||||
try {
|
|
||||||
AccessController.checkPermission(AllPermission())
|
|
||||||
} catch (var6: AccessControlException) {
|
|
||||||
accessContext = AccessController.getContext()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val cx = Context.enter()
|
|
||||||
try {
|
|
||||||
topLevel = RhinoTopLevel(cx, this)
|
|
||||||
} finally {
|
|
||||||
Context.exit()
|
|
||||||
}
|
|
||||||
indexedProps = HashMap()
|
|
||||||
implementor = object : InterfaceImplementor(this) {
|
|
||||||
|
|
||||||
override fun isImplemented(obj: Any?, clazz: Class<*>): Boolean {
|
|
||||||
var obj1 = obj
|
|
||||||
return try {
|
|
||||||
if (obj1 != null && obj1 !is Scriptable) {
|
|
||||||
obj1 = Context.toObject(obj1, topLevel)
|
|
||||||
}
|
|
||||||
val engineScope = getRuntimeScope(context)
|
|
||||||
val localScope = if (obj1 != null) obj1 as Scriptable else engineScope
|
|
||||||
val methods = clazz.methods
|
|
||||||
val methodsSize = methods.size
|
|
||||||
for (index in 0 until methodsSize) {
|
|
||||||
val method = methods[index]
|
|
||||||
if (method.declaringClass != Any::class.java) {
|
|
||||||
if (ScriptableObject.getProperty(
|
|
||||||
localScope,
|
|
||||||
method.name
|
|
||||||
) !is Function
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} finally {
|
|
||||||
Context.exit()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun convertResult(method: Method?, res: Any?): Any? {
|
|
||||||
method ?: return null
|
|
||||||
val desiredType = method.returnType
|
|
||||||
if (desiredType == Void.TYPE) return null
|
|
||||||
return Context.jsToJava(res, desiredType)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
companion object {
|
|
||||||
|
|
||||||
init {
|
|
||||||
ContextFactory.initGlobal(object : ContextFactory() {
|
ContextFactory.initGlobal(object : ContextFactory() {
|
||||||
|
|
||||||
override fun makeContext(): Context {
|
override fun makeContext(): Context {
|
||||||
@@ -309,6 +253,58 @@ class RhinoScriptEngine : AbstractScriptEngine(), Invocable, Compilable {
|
|||||||
return super.doTopCall(callable, cx, scope, thisObj, args)
|
return super.doTopCall(callable, cx, scope, thisObj, args)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (System.getSecurityManager() != null) {
|
||||||
|
try {
|
||||||
|
AccessController.checkPermission(AllPermission())
|
||||||
|
} catch (var6: AccessControlException) {
|
||||||
|
accessContext = AccessController.getContext()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val cx = Context.enter()
|
||||||
|
try {
|
||||||
|
topLevel = RhinoTopLevel(cx, this)
|
||||||
|
} finally {
|
||||||
|
Context.exit()
|
||||||
|
}
|
||||||
|
indexedProps = HashMap()
|
||||||
|
implementor = object : InterfaceImplementor(this) {
|
||||||
|
|
||||||
|
override fun isImplemented(obj: Any?, clazz: Class<*>): Boolean {
|
||||||
|
var obj1 = obj
|
||||||
|
return try {
|
||||||
|
if (obj1 != null && obj1 !is Scriptable) {
|
||||||
|
obj1 = Context.toObject(obj1, topLevel)
|
||||||
|
}
|
||||||
|
val engineScope = getRuntimeScope(context)
|
||||||
|
val localScope = if (obj1 != null) obj1 as Scriptable else engineScope
|
||||||
|
val methods = clazz.methods
|
||||||
|
val methodsSize = methods.size
|
||||||
|
for (index in 0 until methodsSize) {
|
||||||
|
val method = methods[index]
|
||||||
|
if (method.declaringClass != Any::class.java) {
|
||||||
|
if (ScriptableObject.getProperty(
|
||||||
|
localScope,
|
||||||
|
method.name
|
||||||
|
) !is Function
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
true
|
||||||
|
} finally {
|
||||||
|
Context.exit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convertResult(method: Method?, res: Any?): Any? {
|
||||||
|
method ?: return null
|
||||||
|
val desiredType = method.returnType
|
||||||
|
if (desiredType == Void.TYPE) return null
|
||||||
|
return Context.jsToJava(res, desiredType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user