mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
fix: Boolean 构造器对象臂按 B.3.4 特判 DDA 宿主对象为 falsy
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user