From ac1a379d483adfbf63188b17ad46b2d7a17a6b7c Mon Sep 17 00:00:00 2001 From: xcb3d Date: Sun, 6 Sep 2026 22:06:10 +0700 Subject: [PATCH] =?UTF-8?q?fix(engine):=20return=20null=20from=20IsHTMLDDA?= =?UTF-8?q?=20[[Call]]=20per=20Annex=20B=20=C2=A7B.3.6.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to ECMAScript Annex B §B.3.6.1 and test262's INTERPRETING.md, objects with the [[IsHTMLDDA]] internal slot (such as $262.IsHTMLDDA / document.all) must return null when called with no arguments or with an empty string. Previously, is_html_dda_call returned undefined, causing 6 test262 tests in test/annexB/built-ins/String/prototype/ to fail. All 6 tests now pass (100% conformance for test/annexB/built-ins/String/prototype). --- core/engine/src/builtins/is_html_dda.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/engine/src/builtins/is_html_dda.rs b/core/engine/src/builtins/is_html_dda.rs index 8652e9b6de1..037adc1638a 100644 --- a/core/engine/src/builtins/is_html_dda.rs +++ b/core/engine/src/builtins/is_html_dda.rs @@ -27,7 +27,7 @@ use crate::{ /// This is used by the `$262.IsHTMLDDA` test harness object and models the /// legacy `document.all` behavior per ECMAScript Annex B §B.3.6. /// -/// The object is callable — when called, it returns `undefined`. +/// The object is callable — when called, it returns `null` per ECMAScript Annex B §B.3.6.1. #[derive(Debug, Clone, Copy, Trace, Finalize)] #[boa_gc(empty_trace)] pub struct IsHTMLDDA; @@ -44,7 +44,7 @@ impl JsData for IsHTMLDDA { /// The `[[Call]]` internal method for `IsHTMLDDA` objects. /// -/// When called, simply returns `undefined`. +/// When called, simply returns `null` per ECMAScript Annex B §B.3.6.1. #[allow(clippy::unnecessary_wraps)] fn is_html_dda_call( _obj: &JsObject, @@ -59,8 +59,8 @@ fn is_html_dda_call( let _func = context.vm.stack.pop(); let _this = context.vm.stack.pop(); - // Push undefined as the return value. - context.vm.stack.push(JsValue::undefined()); + // Push null as the return value. + context.vm.stack.push(JsValue::null()); Ok(CallValue::Complete) }