6.7.0 - Alpha11 - Fine tuning
This commit is contained in:
@@ -155,6 +155,9 @@ abstract class Augmentable(private val scriptRuntime: ScriptRuntime? = null) : F
|
||||
try {
|
||||
(this as Invokable).invoke(*args)
|
||||
} catch (e: Exception) {
|
||||
if (ScriptInterruptedException.causedByInterrupt(e)) {
|
||||
throw e
|
||||
}
|
||||
val message = e.message?.let { msg ->
|
||||
when {
|
||||
msg.contains("\n") -> {
|
||||
@@ -460,7 +463,7 @@ abstract class Augmentable(private val scriptRuntime: ScriptRuntime? = null) : F
|
||||
}.also { it.printStackTrace() }
|
||||
|
||||
if (ScriptInterruptedException.causedByInterrupt(e)) {
|
||||
throw e
|
||||
throw ScriptInterruptedException(e)
|
||||
}
|
||||
val funcNameSuffix = if (funcName != funcNameAlias) " (${globalContext.getString(R.string.text_alias)}: $funcNameAlias)" else ""
|
||||
val methodDescription = "$key.$funcName$funcNameSuffix"
|
||||
|
||||
@@ -2,12 +2,12 @@ package org.autojs.autojs.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.AttributeSet
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebView
|
||||
import android.webkit.WebViewClient
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.net.toUri
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import org.autojs.autojs.runtime.api.Mime
|
||||
import org.autojs.autojs.util.TextUtils.markdownToHtml
|
||||
@@ -16,6 +16,7 @@ import org.autojs.autojs.util.TextUtils.markdownToHtml
|
||||
* Created by Stardust on Mar 5, 2017.
|
||||
* Transformed by SuperMonster003 on May 25, 2023.
|
||||
*/
|
||||
@Suppress("OVERRIDE_DEPRECATION")
|
||||
class CommonMarkdownView : WebView {
|
||||
|
||||
interface OnPageFinishedListener {
|
||||
@@ -52,7 +53,7 @@ class CommonMarkdownView : WebView {
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW).setData(Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
|
||||
context.startActivity(Intent(Intent.ACTION_VIEW).setData(url.toUri()).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.content.Intent
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Parcelable
|
||||
import android.util.Log
|
||||
import org.autojs.autojs.AutoJs
|
||||
import org.autojs.autojs.core.automator.UiObjectCollection
|
||||
import org.autojs.autojs.extension.AnyExtensions.isJsNullish
|
||||
@@ -187,7 +186,6 @@ object RhinoUtils {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Throws(NoSuchMethodException::class, InvocationTargetException::class, IllegalAccessException::class)
|
||||
fun callFunction(scriptRuntime: ScriptRuntime?, func: BaseFunction, scope: Scriptable?, thisObj: Scriptable?, args: Array<Any?>): Any? = withRhinoContext { cx ->
|
||||
try {
|
||||
val niceScope = scope ?: cx.initStandardObjects()
|
||||
@@ -195,17 +193,23 @@ object RhinoUtils {
|
||||
RhinoScriptRuntime.hasTopCall(cx) -> func.call(cx, niceScope, thisObj, args)
|
||||
else -> RhinoScriptRuntime.doTopCall(func, cx, niceScope, thisObj, args, false)
|
||||
}
|
||||
} catch (e: ScriptInterruptedException) {
|
||||
e.message?.let { Log.v(TAG, it) }
|
||||
} catch (e: InterruptedException) {
|
||||
throw ScriptInterruptedException(e)
|
||||
} catch (e: ContinuationPending) {
|
||||
throw e
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
when {
|
||||
isMainThread() -> {
|
||||
scriptRuntime?.exit(e) ?: throw WrappedRuntimeException(e)
|
||||
scriptRuntime?.exit(e) ?: when (e) {
|
||||
is ScriptInterruptedException -> throw e
|
||||
else -> throw WrappedRuntimeException(e)
|
||||
}
|
||||
}
|
||||
else -> when (e) {
|
||||
is ScriptInterruptedException -> throw e
|
||||
else -> throw WrappedRuntimeException(e)
|
||||
}
|
||||
else -> throw WrappedRuntimeException(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,15 +595,15 @@ object RhinoUtils {
|
||||
@Suppress("UnnecessaryVariable")
|
||||
@JvmStatic
|
||||
fun js_object_assign(tar: Scriptable?, src: Scriptable?): Scriptable = withRhinoContext { cx ->
|
||||
val topeLevelScope = ImporterTopLevel(cx)
|
||||
val topLevelScope = ImporterTopLevel(cx)
|
||||
val targetObj = when (tar != null) {
|
||||
true -> toObject(cx, topeLevelScope, tar)
|
||||
else -> toObject(cx, topeLevelScope, UNDEFINED)
|
||||
true -> toObject(cx, topLevelScope, tar)
|
||||
else -> toObject(cx, topLevelScope, UNDEFINED)
|
||||
}
|
||||
if (src.isJsNullish()) {
|
||||
return@withRhinoContext targetObj
|
||||
}
|
||||
val sourceObj = toObject(cx, topeLevelScope, src)
|
||||
val sourceObj = toObject(cx, topLevelScope, src)
|
||||
for (key in sourceObj.ids) {
|
||||
when (key) {
|
||||
is Int -> {
|
||||
|
||||
Reference in New Issue
Block a user