mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
perf: 校验实时选择器
This commit is contained in:
parent
25d3c64630
commit
b7a1b30f15
|
@ -503,12 +503,12 @@ class GkdAbService : CompositionAbService({
|
|||
|
||||
fun execAction(gkdAction: GkdAction): ActionResult {
|
||||
val serviceVal = service ?: throw RpcError("无障碍没有运行")
|
||||
val selector = try {
|
||||
Selector.parse(gkdAction.selector)
|
||||
} catch (e: Exception) {
|
||||
throw RpcError("非法选择器")
|
||||
val selector = Selector.parseOrNull(gkdAction.selector) ?: throw RpcError("非法选择器")
|
||||
selector.propertyNames.forEach { n ->
|
||||
if (!allowPropertyNames.contains(n)) {
|
||||
throw RpcError("未知属性名:$n")
|
||||
}
|
||||
}
|
||||
|
||||
val targetNode =
|
||||
serviceVal.safeActiveWindow?.querySelector(selector, gkdAction.quickFind)
|
||||
?: throw RpcError("没有选择到节点")
|
||||
|
|
Loading…
Reference in New Issue
Block a user