Playwright sandbox: offline browser test environment for WASM kernel

New sx_playwright mode="sandbox" — injects the WASM kernel into about:blank
with full FFI, IO suspension tracing, and real DOM. No server needed.

Predefined stacks: core (kernel only), web (full web stack), hs (+ hyperscript),
test (+ test framework). Custom files and setup expressions supported.

Reproduces the host-callback IO suspension bug: direct callFn chains 6/6
suspensions correctly, but host-callback → addEventListener → _driveAsync
only completes 1/6. Bug is in the _driveAsync resume chain context.

Also: debug.sx mock DOM harness, test_hs_repeat.js Node.js reproduction.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-08 20:24:42 +00:00
parent a9066c0653
commit aeaa8cb498
5 changed files with 66 additions and 34 deletions

View File

@@ -22,7 +22,8 @@
(list (quote hs-type-check!) hs-type-check!)
(list (quote hs-matches?) hs-matches?)
(list (quote hs-coerce) hs-coerce)
(list (quote hs-contains?) hs-contains?)))
(list (quote hs-contains?) hs-contains?)
(list (quote hs-empty?) hs-empty?)))
(overrides (list)))
(do
(when
@@ -51,17 +52,19 @@
(list (quote let) defaults (list (quote let) overrides sx)))))))))
;; ── run-hs-fixture: evaluate one test case ────────────────────────────
(define
run-hs-fixture
(fn
(f)
(let
((src (get f "src"))
(expected (get f "expected"))
(ctx (if (or (get f "locals") (get f "me")) {:me (get f "me") :locals (get f "locals")} nil)))
(begin
(define _hs-error-sentinel "_HS_EVAL_ERROR_")
(define
run-hs-fixture
(fn
(f)
(let
((result (if ctx (eval-hs src ctx) (eval-hs src))))
(assert= result expected src)))))
((src (get f "src"))
(expected (get f "expected"))
(ctx (if (or (get f "locals") (get f "me")) {:me (get f "me") :locals (get f "locals")} nil)))
(let
((result (if ctx (eval-hs src ctx) (eval-hs src))))
(assert= result expected src))))))
;; ── arrayIndex (1 fixtures) ──────────────────────────────
(defsuite