Skip to content

feat: implement [[IsHTMLDDA]] internal slot (Annex B §B.3.6)#4980

Merged
jedel1043 merged 5 commits intoboa-dev:mainfrom
xcb3d:feat/is-html-dda
Mar 11, 2026
Merged

feat: implement [[IsHTMLDDA]] internal slot (Annex B §B.3.6)#4980
jedel1043 merged 5 commits intoboa-dev:mainfrom
xcb3d:feat/is-html-dda

Conversation

@xcb3d
Copy link
Copy Markdown
Contributor

@xcb3d xcb3d commented Mar 10, 2026

This Pull Request implements the [[IsHTMLDDA]] internal slot (ECMAScript Annex B §B.3.6), enabling correct handling of document.all-like objects.

It changes the following:

  • Add IsHTMLDDA marker struct with a custom [[Call]] internal method that returns undefined (builtins/is_html_dda.rs)
  • Modify typeof operator to return "undefined" for objects with [[IsHTMLDDA]] (value/variant.rs)
  • Modify ToBoolean to return false for objects with [[IsHTMLDDA]] (value/inner/nan_boxed.rs, value/inner/legacy.rs)
  • Modify abstract equality (==) so that [[IsHTMLDDA]] objects are loosely equal to null and undefined (value/equality.rs)
  • Fix String.prototype.{match,matchAll,replace,replaceAll,search,split} to treat [[IsHTMLDDA]] objects as "undefined or null" in the spec's "neither undefined nor null" check (builtins/string/mod.rs)
  • Add $262.IsHTMLDDA to the Test262 harness (tests/tester/src/exec/js262.rs)
  • Remove IsHTMLDDA from ignored features in test262_config.toml

@xcb3d xcb3d requested a review from a team as a code owner March 10, 2026 03:43
@xcb3d xcb3d force-pushed the feat/is-html-dda branch from 0369ddf to 0a5a66d Compare March 10, 2026 03:45
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 10, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,869 49,901 +32
Ignored 2,260 2,222 -38
Failed 834 840 +6
Panics 0 0 0
Conformance 94.16% 94.22% +0.06%
Fixed tests (32):
test/annexB/built-ins/Object/is/emulates-undefined.js (previously Ignored)
test/annexB/built-ins/TypedArrayConstructors/from/iterator-method-emulates-undefined.js (previously Ignored)
test/annexB/built-ins/Array/from/iterator-method-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/if/emulated-undefined.js (previously Ignored)
test/annexB/language/statements/for-of/iterator-close-return-emulates-undefined-throws-when-called.js (previously Ignored)
test/annexB/language/statements/const/dstr/object-pattern-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/const/dstr/array-pattern-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/for-await-of/iterator-close-return-emulates-undefined-throws-when-called.js (previously Ignored)
test/annexB/language/statements/class/subclass/superclass-prototype-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/class/subclass/superclass-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/function/default-parameters-emulates-undefined.js (previously Ignored)
test/annexB/language/statements/switch/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/assignment/dstr/object-pattern-emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/assignment/dstr/array-pattern-emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/logical-and/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/logical-or/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/strict-equals/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/coalesce/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/yield/star-iterable-throw-emulates-undefined-throws-when-called.js (previously Ignored)
test/annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called.js (previously Ignored)
test/annexB/language/expressions/logical-not/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/conditional/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/logical-assignment/emulates-undefined-and.js (previously Ignored)
test/annexB/language/expressions/logical-assignment/emulates-undefined-or.js (previously Ignored)
test/annexB/language/expressions/logical-assignment/emulates-undefined-coalesce.js (previously Ignored)
test/annexB/language/expressions/strict-does-not-equals/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/typeof/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/does-not-equals/emulates-undefined.js (previously Ignored)
test/annexB/language/expressions/equals/emulates-undefined.js (previously Ignored)
test/staging/sm/generators/yield-star-throw-htmldda.js (previously Ignored)
test/staging/sm/Reflect/defineProperty.js (previously Ignored)
test/staging/sm/expressions/nullish-coalescing.js (previously Ignored)

Tested main commit: ccc9aef508a81afb58eb8ae2ae7d511c9b409d48
Tested PR commit: f3a7e4486dd8615b1b3f4594257c915fb6f51a0c
Compare commits: ccc9aef...f3a7e44

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 3.03030% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.20%. Comparing base (6ddc2b4) to head (f3a7e44).
⚠️ Report is 806 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/builtins/is_html_dda.rs 0.00% 11 Missing ⚠️
core/engine/src/value/equality.rs 0.00% 6 Missing ⚠️
core/engine/src/value/inner/nan_boxed.rs 0.00% 5 Missing ⚠️
tests/tester/src/exec/js262.rs 0.00% 4 Missing ⚠️
core/engine/src/value/inner/legacy.rs 0.00% 3 Missing ⚠️
core/engine/src/value/variant.rs 25.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4980       +/-   ##
===========================================
+ Coverage   47.24%   58.20%   +10.95%     
===========================================
  Files         476      559       +83     
  Lines       46892    61404    +14512     
===========================================
+ Hits        22154    35740    +13586     
- Misses      24738    25664      +926     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xcb3d xcb3d force-pushed the feat/is-html-dda branch from 0a5a66d to e920713 Compare March 10, 2026 04:08
Copy link
Copy Markdown
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to gate every related to IsHTMLDDA behind the annex-b feature, because we don't wanna bundle this in builds that don't care about web compatibility.

Comment thread core/engine/src/builtins/string/mod.rs Outdated
Comment on lines +1007 to +1010
if search_value.is_object()
&& !search_value
.as_object()
.is_some_and(|o| o.is::<IsHTMLDDA>())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think changing this is correct. According to the specification:

From the perspective of the ECMAScript language, language values are compared for equality using the SameValue abstract operation and the abstract operations it transitively calls.

So even if [[IsHTMLDDA]] objects act like undefined, per the spec semantics they should evaluate to not equal to undefined.

@xcb3d xcb3d force-pushed the feat/is-html-dda branch 2 times, most recently from 4232eb7 to 9dcf0a8 Compare March 10, 2026 06:36
@xcb3d xcb3d force-pushed the feat/is-html-dda branch from 9dcf0a8 to cfd86eb Compare March 10, 2026 06:46
@xcb3d xcb3d requested a review from jedel1043 March 10, 2026 07:13
Comment thread core/engine/src/value/inner/legacy.rs Outdated
Comment on lines +278 to +283
#[cfg(feature = "annex-b")]
if obj.is::<IsHTMLDDA>() {
return false;
}
let _ = obj;
true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use a match guard here to avoid the weird let _ assignment

#[cfg(feature = "annex-b")]
Self::Object(obj) if obj.is::<IsHTMLDDA>() =>

Also applies to the nan boxed version

@xcb3d xcb3d requested a review from jedel1043 March 10, 2026 14:46
Copy link
Copy Markdown
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jedel1043 jedel1043 enabled auto-merge March 11, 2026 07:12
@jedel1043 jedel1043 added this pull request to the merge queue Mar 11, 2026
Merged via the queue into boa-dev:main with commit a493485 Mar 11, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants