This commit is contained in:
Horis
2024-07-07 07:32:26 +08:00
parent d8e75c41eb
commit e10e243a97
2 changed files with 9 additions and 5 deletions
@@ -97,7 +97,7 @@ interface BaseSource : JsExtensions {
* 解析header规则 * 解析header规则
*/ */
fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply { fun getHeaderMap(hasLoginHeader: Boolean = false) = HashMap<String, String>().apply {
if (checkRhinoRecursiveCall()) return@apply checkRhinoRecursiveCall()
header?.let { header?.let {
GSON.fromJsonObject<Map<String, String>>( GSON.fromJsonObject<Map<String, String>>(
when { when {
@@ -13,10 +13,14 @@ fun Context?.getEnterCount(): Int {
return enterCountField.get(this) as Int return enterCountField.get(this) as Int
} }
fun checkRhinoRecursiveCall(): Boolean { fun checkRhinoRecursiveCall() {
return Context.getCurrentContext().getEnterCount() > 1 check(Context.getCurrentContext().getEnterCount() <= 1) {
"Rhino recursive call detected."
}
} }
fun checkRhinoCall(): Boolean { fun checkRhinoCall() {
return Context.getCurrentContext() != null check(Context.getCurrentContext() == null) {
"Rhino call detected."
}
} }