kunfei 3 سال پیش
والد
کامیت
b3571d93d6
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      app/src/main/java/io/legado/app/data/entities/BaseSource.kt

+ 3 - 1
app/src/main/java/io/legado/app/data/entities/BaseSource.kt

@@ -235,7 +235,9 @@ interface BaseSource : JsExtensions {
         bindings["baseUrl"] = getKey()
         bindings["baseUrl"] = getKey()
         bindings["cookie"] = CookieStore
         bindings["cookie"] = CookieStore
         bindings["cache"] = CacheManager
         bindings["cache"] = CacheManager
-        return SCRIPT_ENGINE.eval(jsStr, bindings)
+        val scope = SCRIPT_ENGINE.getRuntimeScope(SCRIPT_ENGINE.getScriptContext(bindings))
+        scope.prototype = getShareScope()
+        return SCRIPT_ENGINE.eval(jsStr, scope)
     }
     }
 
 
     fun getShareScope(): Scriptable? {
     fun getShareScope(): Scriptable? {