Add fetch(), setInterval/clearInterval, requestAnimationFrame/cancelAnimationFrame, Math object (35 methods + 8 constants), global utilities (parseInt, parseFloat, isNaN, isFinite, URI encoding/decoding), Number statics, console enhancements (dir, table, assert, count/countReset, time/timeEnd), and Promise combinators (all, race, allSettled, any). Code review fixes include: Promise combinators correctly leave result pending for unsettled inputs, FetchStore cleanup on body consumption, Window method dispatch for all scheduling APIs, interval timing drift fix, all response headers stored, RafQueue O(1) cancel, Math.random CAS loop, and policy check comment rewording. 80+ new unit tests, 36 integration tests, 8 JS262 promotions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
185 lines
16 KiB
Markdown
185 lines
16 KiB
Markdown
# JavaScript Feature Matrix
|
|
|
|
Status of JS language features in the custom interpreter (`js_parser` + `js_vm`).
|
|
|
|
## Legend
|
|
|
|
| Status | Meaning |
|
|
|--------|---------|
|
|
| Supported | Feature works and has conformance tests |
|
|
| Not Supported | Feature not yet implemented (tracked as known_fail) |
|
|
| Partial | Some sub-features work, others don't |
|
|
|
|
## Language Core
|
|
|
|
| Feature | Status | Conformance Tests | Known Failures | Notes |
|
|
|---------|--------|-------------------|----------------|-------|
|
|
| `var` declarations | Supported | 11 | 0 | Hoisting, function scope, block visibility |
|
|
| `let` declarations | Supported | (in var-decl tests) | 0 | Block scoping, TDZ |
|
|
| `const` declarations | Supported | (in var-decl tests) | 0 | Immutability enforced |
|
|
| Number literals | Supported | (in expr tests) | 0 | IEEE 754 f64 |
|
|
| String literals | Supported | (in expr tests) | 0 | UTF-8, escape sequences |
|
|
| Boolean literals | Supported | (in type tests) | 0 | |
|
|
| `null` / `undefined` | Supported | (in type tests) | 0 | |
|
|
| Arithmetic operators | Supported | 16 | 0 | `+`, `-`, `*`, `/`, `%` with coercion |
|
|
| Comparison operators | Supported | (in expr tests) | 0 | `==`, `===`, `!=`, `!==`, `<`, `>`, `<=`, `>=` |
|
|
| Unary operators | Supported | (in expr tests) | 0 | `typeof`, `delete`, `void`, `-`, `!` |
|
|
| Logical operators | Supported | 2 | 0 | `&&`, `\|\|` with short-circuit evaluation |
|
|
| Bitwise operators | Supported | 33 | 0 | `&`, `\|`, `^`, `~`, `<<`, `>>`, `>>>` |
|
|
| Ternary operator | Supported | 4 | 0 | `? :` |
|
|
| Exponentiation operator | Supported | 2 | 19 | `**`, `**=` (ES2016) |
|
|
| Nullish coalescing | Supported | 1 | 0 | `??` (ES2020) |
|
|
| Logical assignment | Supported | 6 | 0 | `&&=`, `\|\|=`, `??=` (ES2021) |
|
|
| Compound assignment | Supported | 1 | 0 | `+=`, `-=`, `*=`, `**=`, `&=`, `\|=`, `^=`, `<<=`, `>>=`, `>>>=` |
|
|
| Increment/decrement | Supported | 1 | 0 | `++`, `--` (prefix and postfix) |
|
|
| Computed member access | Supported | 1 | 0 | `obj[key]` |
|
|
| `instanceof` | Supported | 2 | 0 | Walks prototype chain |
|
|
| `in` operator | Supported | 1 | 0 | Walks prototype chain |
|
|
| `delete` operator | Supported | 1 | 0 | Member, computed, identifier |
|
|
| `void` operator | Supported | 1 | 0 | Returns `undefined` |
|
|
| ToPrimitive (valueOf/toString coercion) | Supported | (in test262 tests) | 0 | `[Symbol.toPrimitive]`, `valueOf()`, `toString()` hint-based coercion |
|
|
| Wrapper objects (`new Number/String/Boolean`) | Supported | (in test262 tests) | 0 | `new Number()`, `new String()`, `new Boolean()` with `valueOf()`/`toString()` |
|
|
| `class` declarations | Supported | 10 | 0 | constructor, methods, extends, super(), super.method(), static |
|
|
| Template literals | Supported | 24 | 0 | `` `${expr}` `` |
|
|
| `if`/`else` | Supported | 6 | 0 | Nested, truthiness rules |
|
|
| `for` loops | Supported | 6 | 0 | `for (init; test; update)`, break, continue, let scoping |
|
|
| `for...in` | Supported | 20 | 0 | Object key enumeration incl. prototype chain, arrays, break/continue, let/const scoping |
|
|
| `for...of` | Partial | 19 | 0 | Arrays and strings only; no general iterator protocol yet |
|
|
| `while` loops | Supported | 3 | 0 | break, continue |
|
|
| `do...while` loops | Supported | 2 | 0 | Executes body at least once |
|
|
| `switch` | Supported | 1 | 0 | Basic matching, fall-through, break, default |
|
|
| Function declarations | Supported | 10 | 0 | Hoisting, recursion, closures |
|
|
| Function expressions | Supported | (in func tests) | 0 | Named and anonymous |
|
|
| Arrow functions | Supported | 3 | 0 | Expression/block body, lexical `this`, `new` rejection |
|
|
| `try`/`catch`/`finally` | Supported | 5 | 0 | All clause combinations, catch param scoping |
|
|
| `throw` | Supported | (in try-catch tests) | 0 | Throw + catch integration |
|
|
| Array literals + methods | Supported | 19 | 0 | `[1,2,3]`, `Array.isArray()`, `Array.from()`, `Array.of()`, `.push()`, `.pop()`, `.join()`, `.indexOf()`, `.lastIndexOf()`, `.includes()`, `.slice()`, `.concat()`, `.reverse()`, `.shift()`, `.unshift()`, `.splice()`, `.fill()`, `.copyWithin()`, `.at()`, `.flat()`, `.flatMap()`, `.map()`, `.forEach()`, `.filter()`, `.find()`, `.findIndex()`, `.some()`, `.every()`, `.reduce()`, `.reduceRight()`, `.sort()`, `.toString()`, `.entries()`, `.keys()`, `.values()`, `.toReversed()`, `.toSorted()`, `.toSpliced()`, `.with()` |
|
|
| Object literals | Supported | 9 | 0 | Creation, dot access, assignment, nesting, `Object.keys/values/entries`, `Object.create`, `Object.getPrototypeOf`, `Object.assign`, `Object.defineProperty`, `Object.defineProperties`, `Object.getOwnPropertyDescriptor`, `Object.getOwnPropertyDescriptors`, `Object.getOwnPropertyNames`, `Object.setPrototypeOf`, `Object.freeze`/`isFrozen`, `Object.seal`/`isSealed`, `Object.preventExtensions`/`isExtensible`, `Object.is`, `Object.fromEntries`, `Object.hasOwn`, `.isPrototypeOf()` |
|
|
| `this` keyword | Supported | 5 | 0 | Global scope, constructors, method calls |
|
|
| String methods | Supported | 3 | 0 | `.length`, `.charAt()`, `.indexOf()`, `.slice()`, `.padStart()`, `.padEnd()`, `.replaceAll()`, `.matchAll()`, `.at()`, `.codePointAt()`, `.normalize()` (stub), `String.fromCharCode()`, `String.fromCodePoint()`, `String.raw` (ASCII-focused, `chars()` indexing) |
|
|
| `Function.name` / `.call()` | Supported | 1 | 0 | Direct member-call only (`fn.call(thisArg, ...)`) |
|
|
| `Object.prototype.toString` | Supported | 1 | 0 | `Object.prototype.toString.call(value)` type tagging |
|
|
| `hasOwnProperty` / `propertyIsEnumerable` | Supported | 2 | 0 | Own vs inherited, enumerable check; works on objects and functions |
|
|
| Non-enumerable properties | Supported | (internal) | 0 | Builtin prototype methods non-enumerable; `for...in` / `Object.keys()` / spread respect it |
|
|
| Function properties | Supported | (in test262 tests) | 0 | `fn.prop = val`, `fn.prop`, `fn.method()` |
|
|
| Spread / rest `...` | Supported | 6 | 0 | Arrays, strings, function args/params, object spread, `Symbol.iterator` iterables; object spread key order non-deterministic for non-numeric keys |
|
|
| Destructuring | Supported | 8 | 0 | Array/object patterns in `let`/`const`/`var`, defaults, holes, rest, nesting, renaming, function params, arrow params, assignment, for-of/in; shorthand properties `{x}` and array elisions `[1,,3]` |
|
|
| `typeof` | Supported | 5 | 0 | All value types |
|
|
| Strict mode (`"use strict"`) | Supported | 61 | 0 | Program/function/arrow/class; directive prologue detection, `has_escape` guard, reserved words, duplicate params, non-simple params, `delete` identifier, `this` binding, `.call()` coercion, `eval`/`arguments` binding restriction, `with` rejection, legacy octal rejection, octal escape rejection, undeclared variable ReferenceError |
|
|
| `eval()` | Supported | 3 | 0 | Direct eval with scope access, indirect eval, strict mode isolation, parse errors as SyntaxError |
|
|
| `RegExp` | Supported | 73 | 0 | Regex literals, `RegExp` constructor, `test()`, `exec()`, `toString()`, flags (`g`, `i`, `m`, `s`, `u`, `y`), `lastIndex`, `String.prototype.match/search/replace/split/matchAll/replaceAll` with regex; function replacers, `$<name>` named group substitution, `[Symbol.match/replace/search/split]` |
|
|
| `Symbol` | Supported | 25 | 0 | Unique identity, `.description`, `.toString()`, `Symbol.for()`/`Symbol.keyFor()`, symbol-keyed properties, `Object.getOwnPropertySymbols()`, well-known symbols (iterator, toPrimitive, hasInstance, toStringTag, species, isConcatSpreadable, match, replace, search, split) |
|
|
| `WeakRef` | Supported | 8 | 0 | `new WeakRef(target)`, `.deref()`, TypeError on primitive target, uses `Rc::downgrade()`/`Weak::upgrade()` for genuine weak references |
|
|
| `FinalizationRegistry` | Supported | 8 | 0 | `new FinalizationRegistry(callback)`, `.register(target, heldValue, token?)`, `.unregister(token)`, TypeError on non-callable callback, target===token check |
|
|
| `WeakMap` | Supported | 12 | 0 | `new WeakMap()`, `new WeakMap(iterable)`, `.get()`/`.set()`/`.has()`/`.delete()`, object-key-only enforcement, `.set()` returns `this` for chaining |
|
|
| `Map` | Supported | 16 | 0 | `new Map()`, `new Map(iterable)`, `.get()`/`.set()`/`.has()`/`.delete()`/`.clear()`, `.size`, `.forEach()`, `.entries()`/`.keys()`/`.values()`, SameValueZero equality, insertion-order iteration |
|
|
| `Set` | Supported | 11 | 0 | `new Set()`, `new Set(iterable)`, `.add()`/`.has()`/`.delete()`/`.clear()`, `.size`, `.forEach()`, `.entries()`/`.keys()`/`.values()`, SameValueZero equality, deduplication |
|
|
| `WeakSet` | Supported | 5 | 0 | `new WeakSet()`, `new WeakSet(iterable)`, `.add()`/`.has()`/`.delete()`, object-key-only enforcement |
|
|
| `Date` | Supported | 25 | 0 | `new Date()`, `new Date(ms)`, `new Date(string)`, `new Date(year,month,...)`, `Date.now()`, `Date.parse()`, `Date.UTC()`, all getters/setters (local+UTC), `toISOString()`, `toJSON()`, `toDateString()`, `toTimeString()`, `toUTCString()`, `toString()`, `valueOf()` |
|
|
| `Proxy` | Supported | 17 | 0 | `new Proxy(target, handler)`, get/set/has/deleteProperty/apply traps, `Proxy.revocable()`, function proxy targets |
|
|
| `JSON` | Supported | 2 | 0 | `JSON.stringify()` (replacer function/array, space, toJSON, circular detection, boxed primitives), `JSON.parse()` (reviver, strict JSON spec) |
|
|
|
|
## Web APIs (DOM / Events / Scheduling)
|
|
|
|
| Feature | Status | Conformance Tests | Known Failures | Notes |
|
|
|---------|--------|-------------------|----------------|-------|
|
|
| `document.getElementById()` | Supported | 6 | 0 | Returns null for missing |
|
|
| `document.createElement()` | Supported | (in dom tests) | 0 | |
|
|
| `document.querySelector/All()` | Supported | (in dom tests) | 0 | CSS selector-based queries (§3.8) |
|
|
| `document.getElementsByTagName/ClassName()` | Supported | (in dom tests) | 0 | Live HTMLCollection (§3.8) |
|
|
| `element.appendChild()` | Supported | (in dom tests) | 0 | Returns appended child |
|
|
| `element.removeChild()` | Supported | (in dom tests) | 0 | Error if not a child |
|
|
| `element.insertBefore()` / `replaceChild()` | Supported | (in dom tests) | 0 | (§3.8) |
|
|
| `element.textContent` | Supported | (in dom tests) | 0 | Get and set |
|
|
| `element.innerHTML` | Supported | (in dom tests) | 0 | Get/set via fragment parse/serialize (§3.8) |
|
|
| `element.classList` | Supported | (in dom tests) | 0 | DOMTokenList (§3.8) |
|
|
| `element.style` | Supported | (in dom tests) | 0 | CSSStyleDeclaration (§3.8) |
|
|
| `element.parentElement` / `children` / etc. | Supported | (in dom tests) | 0 | DOM traversal (§3.8) |
|
|
| `Node.cloneNode(deep)` | Supported | (in dom tests) | 0 | (§3.8) |
|
|
| `element.addEventListener()` | Supported | 6 | 0 | Bubbling + capture phases |
|
|
| `element.removeEventListener()` | Supported | (in event tests) | 0 | |
|
|
| `dispatchEvent(event)` | Supported | (in event tests) | 0 | Custom events via `new Event()` (§3.9) |
|
|
| `event.preventDefault()` | Supported | (in event tests) | 0 | |
|
|
| `event.stopPropagation()` | Supported | (in event tests) | 0 | |
|
|
| `event.type` | Supported | (in event tests) | 0 | |
|
|
| Keyboard events | Supported | (in event tests) | 0 | `keydown`, `keyup` (§3.9) |
|
|
| Mouse events | Supported | (in event tests) | 0 | `mousedown/up/move/enter/leave` (§3.9) |
|
|
| Focus events | Supported | (in event tests) | 0 | `focus`, `blur`, `focusin`, `focusout` (§3.9) |
|
|
| `setTimeout()` | Supported | 7 | 0 | Deterministic virtual clock |
|
|
| `clearTimeout()` | Supported | (in sched tests) | 0 | |
|
|
| `setInterval()` / `clearInterval()` | Supported | (in sched tests) | 0 | Shared ID space with setTimeout (§3.10) |
|
|
| `requestAnimationFrame()` / `cancelAnimationFrame()` | Supported | (in sched tests) | 0 | Wired into render loop with DOMHighResTimeStamp (§3.10) |
|
|
| `queueMicrotask()` | Supported | (in sched tests) | 0 | |
|
|
| `fetch()` | Supported | (in web_api tests) | 0 | String URL only; Response with .text()/.json() (§3.10) |
|
|
| `Promise` constructor | Supported | 5 | 0 | `new Promise(fn)` |
|
|
| `Promise.resolve()` | Supported | (in promise tests) | 0 | |
|
|
| `Promise.reject()` | Supported | (in promise tests) | 0 | |
|
|
| `Promise.all/race/allSettled/any` | Supported | (in promise tests) | 0 | Static combinators (§3.10) |
|
|
| `.then()` / `.catch()` | Supported | (in promise tests) | 0 | Chaining, error recovery |
|
|
| `console.log/warn/error/info/debug` | Supported | (in unit tests) | 0 | Capture sink for testing |
|
|
| `console.dir/table/assert/count/time` | Supported | (in unit tests) | 0 | Console enhancements (§3.10) |
|
|
| `Math` object | Supported | 43 | 0 | All constants + 35 static methods (§3.10) |
|
|
| `parseInt/parseFloat/isNaN/isFinite` | Supported | 37 | 0 | Global + Number.* variants (§3.10) |
|
|
| `encodeURI/decodeURI/Component` | Supported | (in global tests) | 0 | URI encoding/decoding (§3.10) |
|
|
|
|
## Error Handling
|
|
|
|
| Error Type | Status | Notes |
|
|
|------------|--------|-------|
|
|
| `ReferenceError` | Supported | Undeclared variables, TDZ |
|
|
| `TypeError` | Supported | Null property access, non-function calls, const assignment |
|
|
| `ParseError` | Supported | Syntax errors |
|
|
| `RuntimeError` | Supported | Statement limit exceeded |
|
|
| Source locations | Supported | Line:col in error messages |
|
|
|
|
### Error Constructors (29 unit tests, 3 js262 tests)
|
|
|
|
| Constructor | Status | Notes |
|
|
|------------|--------|-------|
|
|
| `Error` | Supported | Constructor, toString, instanceof, call-without-new |
|
|
| `TypeError` | Supported | Prototype chain → Error.prototype |
|
|
| `ReferenceError` | Supported | Prototype chain → Error.prototype |
|
|
| `SyntaxError` | Supported | Prototype chain → Error.prototype |
|
|
| `RangeError` | Supported | Prototype chain → Error.prototype |
|
|
| `EvalError` | Supported | Prototype chain → Error.prototype |
|
|
| `URIError` | Supported | Prototype chain → Error.prototype |
|
|
| Internal → Error objects | Supported | Caught runtime errors are proper Error objects with instanceof |
|
|
|
|
## ES Modules (ES2015+)
|
|
|
|
| Feature | Status | Conformance Tests | Known Failures | Notes |
|
|
|---------|--------|-------------------|----------------|-------|
|
|
| `import` declarations | Supported | 31 (parser) + 6 (VM) | 0 | Named, default, namespace, combined, side-effect |
|
|
| `export` declarations | Supported | (in module tests) | 0 | Named, default, declaration, re-export, aggregate |
|
|
| `export default` | Supported | (in module tests) | 0 | Expressions, named/anonymous functions and classes |
|
|
| `export * from` | Supported | (in module tests) | 0 | Star re-export (excludes `default`) |
|
|
| `import()` dynamic import | Partial | (in module tests) | 0 | Parsed and compiled; runtime returns `undefined` (Promise not yet wired) |
|
|
| Module registry (singleton) | Supported | 5 (unit) | 0 | Modules evaluated once, cached by URL |
|
|
| Circular dependencies | Supported | (in registry) | 0 | Linking/Evaluating sentinel prevents deadlock |
|
|
| `<script type="module">` | Supported | 2 (pipeline) | 0 | Inline and external, deferred timing |
|
|
| Module strict mode | Supported | (implicit) | 0 | Modules always strict per §10.2.1 |
|
|
| `import.meta` | Not Supported | — | — | Clear error message; deferred |
|
|
| Top-level `await` | Not Supported | — | — | Deferred |
|
|
| Import maps | Not Supported | — | — | Bare specifiers error |
|
|
|
|
## Test Counts Summary
|
|
|
|
| Category | Pass | Known Fail | Total |
|
|
|----------|------|------------|-------|
|
|
| JS262 conformance | 936 | 317 | 1254 |
|
|
| Integration (js_tests) | 45 | — | 45 |
|
|
| Integration (js_dom_tests) | 91 | — | 91 |
|
|
| Integration (js_events) | 37 | — | 37 |
|
|
| Integration (js_scheduling) | 24 | — | 24 |
|
|
| Integration (js_async) | 27 | — | 27 |
|
|
| Integration (js_modules) | 17 | — | 17 |
|
|
| Unit (js_vm) | 1933 | — | 1933 |
|
|
| Unit (js_parser) | 718 | — | 718 |
|
|
| Unit (js crate) | 28 | — | 28 |
|
|
| Unit (web_api) | 191 | — | 191 |
|
|
| **Total** | **4047** | **317** | **4365** |
|
|
|
|
**JS262 pass rate: 74.6%** (936/1254)
|
|
|
|
See `docs/test262_roadmap.md` for the integration plan and `docs/js_conformance_report.md` for known-fail details.
|