fix: 还原 instanceof 的 null handler 归一化条件并翻转单测断言

This commit is contained in:
2026-10-14 07:14:36 +00:00
parent f3c3620b70
commit b1e2367556
4 changed files with 31 additions and 29 deletions
+3 -3
View File
@@ -416,9 +416,9 @@ impl Vm {
Ok(_) => return Ok(()),
Err(e) => return self.raise_call_error(&e).map(|_| ()),
};
// 仅 undefined 视为无 handler;null 非 undefined,须调用,Call(null) 抛
// TypeError。handler 在场须可调用;调用异常原值上抛(外围 try/catch 可捕获)。
if !has_instance_val.is_undefined() {
// GetMethod 语义:null 与 undefined 均归一化为无 handler,走 prototype
// 分支。handler 在场须可调用;调用异常原值上抛(外围 try/catch 可捕获)。
if !has_instance_val.is_undefined() && !has_instance_val.is_null() {
if !is_callable(has_instance_val) {
return self.raise_type_error("instanceof: @@hasInstance handler is not callable");
}