Conversation
Test262 conformance changes
|
9848a6e to
2e1480c
Compare
|
If you're using AI agents to do this work, maybe you should use something like git-worktree to avoid accidentally pushing unrelated commits? Just a suggestion. |
|
yep sure @jedel1043 ill keep that in mind . i got little confused because of some uncommited changes of my other pr . and again thank you for the suggestion of worktree that it will keep my workspace clean . Will keep in mind and ill surely improve from next time and thanks for the quick reviews |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4638 +/- ##
==========================================
+ Coverage 47.24% 57.23% +9.99%
==========================================
Files 476 550 +74
Lines 46892 60428 +13536
==========================================
+ Hits 22154 34587 +12433
- Misses 24738 25841 +1103 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cd41627 to
ca51b07
Compare
ca51b07 to
b286eec
Compare
|
@jedel1043 yep sure |
## Summary This PR makes `Headers` iterable in Boa runtime so it can be consumed by iterable APIs. This Pull Request closes boa-dev#4611 ### What changed - Added a regression test for `Headers` iterability: - spread: `[...new Headers([["x", "y"]])]` - `Map` construction: `new Map(new Headers([["x", "y"]]))` - Wired `Headers.prototype[Symbol.iterator]` during fetch registration. - Exposed `entries`, `keys`, and `values` as class methods on `Headers`. ### Why `Headers` should be iterable over `[name, value]` pairs. Without `@@iterator`, spread and `Map` construction throw a `TypeError`. ## Testing ```bash cargo test -p boa_runtime fetch::tests -- --nocapture All fetch tests pass, including the new regression test.
# Summary This PR adds support for well-known symbol-keyed methods, statics, and accessors in the `#[boa(class)]` macro. This allows builtins to declare them declaratively instead of manually patching prototypes after registration. **Closes:** #4688 --- # What Changed ## `core/macros/src/class.rs` - Introduced a `MethodName` enum (`String | Symbol`) replacing the raw `String` name on: - `Function` - `Accessor` - `ClassVisitor` - `MethodName::to_key_tokens()` now emits: - `js_string!(...)` for string keys - `JsSymbol::iterator()` (etc.) for symbol keys - `name_of()` now: - Checks for `#[boa(symbol = "...")]` first - Validates against the 13 well-known symbol names - Falls through to `#[boa(rename = "...")]` or default rename scheme otherwise - `serialize_class_impl()` now uses polymorphic key tokens for: - `builder.method()` - `builder.static_method()` - `builder.accessor()` - `match` is handled via `Ident::new_raw` since it is a Rust keyword ## `core/macros/src/module.rs` - Updated `Function::from_sig` callsite to wrap the name in `MethodName::String(...)` ## `core/runtime/src/fetch/headers.rs` - Added `#[boa(symbol = "iterator")]` on `JsHeaders` - Replaced the manual prototype patching TODO from #4638 ## `tests/macros/tests/class.rs` - Added `Pair` struct with: - `#[boa(symbol = "toPrimitive")]` - `#[boa(symbol = "iterator")]` - Added `boa_class_symbol_methods` test covering: - Numeric coercion (`+p`) - Addition (`p + 3`) - Spread (`[...p]`) - `for...of` --- # Accepted Symbol Names The following well-known symbol names are supported: - `asyncIterator` - `hasInstance` - `isConcatSpreadable` - `iterator` - `match` - `matchAll` - `replace` - `search` - `species` - `split` - `toPrimitive` - `toStringTag` - `unscopables` Unknown names produce a compile-time error listing valid options. --- # Usage Example ```rust #[boa_class] impl MyType { #[boa(symbol = "iterator")] fn iter(&self, ctx: &mut Context) -> JsValue { /* ... */ } #[boa(symbol = "toPrimitive")] fn to_prim(&self) -> i32 { 42 } } ``` --------- Co-authored-by: José Julián Espina <jedel0124@gmail.com>
Summary
This PR makes
Headersiterable in Boa runtime so it can be consumed by iterable APIs.This Pull Request closes #4611
What changed
Headersiterability:[...new Headers([["x", "y"]])]Mapconstruction:new Map(new Headers([["x", "y"]]))Headers.prototype[Symbol.iterator]during fetch registration.entries,keys, andvaluesas class methods onHeaders.Why
Headersshould be iterable over[name, value]pairs. Without@@iterator, spread andMapconstruction throw aTypeError.Testing
cargo test -p boa_runtime fetch::tests -- --nocapture All fetch tests pass, including the new regression test.