web + ai spec polyfill testbed
Why this matters
Draft browser standards like navigator.modelContext (WebMCP), isolated <web-island> elements, and Connection-Allowlist read cleanly in markdown explainers, but API ergonomics, schema validation edge cases, and security boundaries remain hidden until teams execute concrete conformance checks in a real browser.
What this opens up
Testing draft browser specs early before engines ship native implementations. The testbed separates Native Browser Pass vs. Polyfill Pass scores, times polyfill overhead via PerformanceObserver, and demonstrates the exact boundary where JavaScript shims cannot emulate browser-engine isolation.
How the tests work
- Click Run Conformance Suite to run all 15 assertions (5 per spec) and compare Native Browser Pass counts against Polyfill Pass counts.
- Click Register & Execute Tool (or edit the tool name, query, and
<web-island capabilities>fields) to test JSON-Schema validation,AbortSignalcleanup, andElementInternalsform participation live. - Test RFC 9651 fail-closed header parsing (
(), malformed strings,response-origin) beside the liveGET /probe/connection-allowlistedge iframe. - Run the two What Polyfills Cannot Fake probes (
<link rel="prefetch">egress bypass and Shadow DOM vs. opaque<iframe>) and inspectPerformanceObservermarks in the Wire Inspector.
Hypothesis
Running executable 15-assertion conformance suites across draft Web + AI proposals (
navigator.modelContext,<web-island>+ElementInternals, andConnection-Allowlist) with explicit Native vs. Polyfill score splits surfaces naming conflicts and engine-only security boundaries far earlier than reading explainer docs.
What confirms it: All 15 assertions run reproducibly with PerformanceObserver mark/measure timing, report accurate Native vs. Polyfill score splits without miscounting shims as native, and verify live HTTP Connection-Allowlist: (); report-to=allowlist headers.
What bounds or disproves it: The <link rel="prefetch"> and Shadow DOM vs. opaque <iframe> probes prove that JavaScript shims cannot block declarative browser prefetching, pre-connect handshakes, or cross-origin paint/DOM boundaries without native engine hooks.
Under the hood
Spec Polyfill Testbed (GitHub) splits its modular polyfills across public/lib/model-context.js, public/lib/web-island.js, public/lib/egress-guard.js, and public/lib/conformance-runner.js. Every polyfill marks itself with isPolyfill so the conformance runner never mistakes a JavaScript shim for native engine support, outputting independent Native Browser Pass and Polyfill Pass totals.
On the edge, src/worker.ts serves /api/specs, /island-frame (a sandboxed connect-src 'none' iframe document), /probe/connection-allowlist (emitting Connection-Allowlist: (); report-to=allowlist and Reporting-Endpoints), /api/egress-report (with a streaming byte cap), and /api/prefetch-canary so the <link rel="prefetch"> probe proves whether a declarative browser request still reached the origin despite JavaScript guardedFetch() enforcement.
Key terms & further reading
- WebMCP (navigator.modelContext) ↗
- A draft browser API allowing web pages to register structured, schema-validated tools that agents can invoke directly.
- Custom Elements & ElementInternals ↗
- Standard DOM primitives letting custom elements participate in native form submission, constraint validation, and ARIA roles.
- Connection-Allowlist header ↗
- A proposed HTTP header enforcing which network origins a document may contact at the browser networking layer, failing closed on
()or syntax errors. - RFC 9651 Structured Fields ↗
- The strict syntax specification for HTTP header inner lists and parameters used by
Connection-Allowlist. - PerformanceObserver marks & measures ↗
- A browser timing API recording sub-millisecond durations for polyfill setup, schema validation, and policy checks.
- Speculative prefetch (<link rel="prefetch">) ↗
- A declarative browser fetch that bypasses JavaScript
fetch()wrappers, exposing where only native engine enforcement holds.
Open questions
- Which polyfill assertions fail ONLY because of missing engine hooks (such as pre-connect allowlists or cross-origin intrinsic sizing)?
- Can this testbed generate WPT-shaped conformance cases cleanly as drafts stabilize?
Iteration log
- — Shipped 15-assertion interactive polyfill suite across WebMCP,
<web-island>, andConnection-Allowlistwith live header probe. - — Moved the 15-assertion conformance matrix and polyfill workbench ahead of setup docs for 700px embeds, added CSP-safe DOM syntax highlighting to code and JSON wire panes, hardened responsive wrapping, and routed all static assets through the Worker with
Cache-Control: no-cacheand 19 passing tests. - — Moved into Track 8 (
platform-observability), fixedisPolyfilldetection with explicit Native vs. Polyfill pass score splits, updated the live probe header toConnection-Allowlist: (); report-to=allowlist, unified<web-island>registration into modular polyfill files, added the ‘What Polyfills Cannot Fake’ prefetch probe, and shipped dark mode,?embed=1height bridging, and@containerdiagrams.
Primitives tested: Custom Elements v1 (<web-island>), ElementInternals, navigator.modelContext Polyfill, PerformanceObserver, Connection-Allowlist (report-to), Prefetch Boundary Probe.
This is an active lab under /labs/ and stays off the main RSS feed until graduated into a full essay.