fix: Boolean 构造器对象臂按 B.3.4 特判 DDA 宿主对象为 falsy

This commit is contained in:
2026-09-26 21:26:11 +00:00
parent 631d430772
commit ad6874cd23
2 changed files with 35 additions and 1 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ pub fn boolean_constructor<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
// SAFETY: arg 已确认是字符串值。
!unsafe { (*arg.as_string_ptr()).is_empty() }
} else if arg.is_object() {
true
// [[IsHTMLDDA]] 宿主对象按 undefined 处理(B.3.4),falsy。
// SAFETY: arg 已确认是对象值,借用即时消费。
!unsafe { (*arg.as_js_object_ptr()).is_html_dda_obj() }
} else if arg.is_int() {
arg.as_int() != 0
} else if arg.is_double() {