ReviewOS

zig-utils/zig-js

ABI: implement the complete ZigString DOMException code matrix

#198
Closed chris opened this 9 days ago ·
9 days ago

Parent

Scope

Implement ZigString__toDOMExceptionInstance against the complete pinned u8 WebCore::ExceptionCode contract, not only AbortError/TimeoutError.

Evidence sources:

  • Home/Bun DOMExceptionCode enum ordering (0-40);
  • Bun JSDOMExceptionHandling.cpp at 4982b91e for special JS Error branches;
  • WebKit DOMException.cpp description table for DOM names, default messages, and legacy codes.

Required behavior:

  • codes 0-31: exact DOM names/default messages/legacy codes, except Bun's intentional code-9 JS SyntaxError divergence;
  • codes 32-40: RangeError, TypeError, JS SyntaxError, stack/OOM/existing-exception, invalid-this, invalid-URL, and crypto branches;
  • non-empty ZigString messages override DOM defaults;
  • selected-realm prototypes, freshness, tagged encodings, and first-exception/OOM behavior;
  • invalid/unrecognized codes must have an explicit tested disposition.

Acceptance

  • Every pinned enum value has a table-driven fixture row.
  • DOM names, messages, legacy codes, and special JS Error classes match pinned Bun/WebKit behavior.
  • Both inventories, focused runtime, README/docs, and parent issues are current.

Completion evidence

Implemented on main in a37d2f0b; README and ABI documentation published in f8ef4b7c.

  • All codes 0-40 have table-driven runtime coverage, including exact WebCore metadata and the intentional Bun code-9 SyntaxError divergence.
  • Special RangeError, TypeError, Error, undefined, and Node-style code branches match the pinned Bun source.
  • Non-empty UTF-16 messages override defaults; unknown code 255 uses the pinned empty-name DOMException fallback.
  • Selected-realm prototypes, same-VM sibling realms, tagged Latin-1/UTF-16 input, lone surrogates, freshness, and first-exception preservation are exercised.
  • zig build test-home-private-abi -Doptimize=Debug passes 89/89 symbols.
  • Home audit: 91/431 implemented, 340 pending. Bun core audit: 84/421 implemented, 337 pending.
9 days ago

Completed on main in a37d2f0 with documentation in f8ef4b7. Focused runtime: 89/89; Home: 91/431; Bun core: 84/421.

Sign in to comment on this issue.