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

@@ -187,20 +187,26 @@
((and (= typ "keyword") (= val "some"))
(do
(adv!)
(let
((var-name (tp-val)))
(do
(adv!)
(match-kw "in")
(let
((collection (parse-expr)))
(do
(match-kw "with")
(list
(quote some)
var-name
collection
(parse-expr))))))))
(if
(and
(= (tp-type) "ident")
(> (len tokens) (+ p 1))
(= (get (nth tokens (+ p 1)) "value") "in"))
(let
((var-name (tp-val)))
(do
(adv!)
(match-kw "in")
(let
((collection (parse-expr)))
(do
(match-kw "with")
(list
(quote some)
var-name
collection
(parse-expr))))))
(list (quote not) (list (quote no) (parse-expr))))))
((and (= typ "keyword") (= val "every"))
(do
(adv!)
@@ -277,7 +283,7 @@
(do
(adv!)
(let
((strict (if (string-ends-with? type-name "!") (string-slice type-name 0 (- (len type-name) 1)) nil)))
((strict (if (= (nth type-name (- (len type-name) 1)) "!") (string-slice type-name 0 (- (len type-name) 1)) nil)))
(if
strict
(list
@@ -327,7 +333,7 @@
(do
(adv!)
(let
((strict (if (string-ends-with? type-name "!") (string-slice type-name 0 (- (len type-name) 1)) nil)))
((strict (if (= (nth type-name (- (len type-name) 1)) "!") (string-slice type-name 0 (- (len type-name) 1)) nil)))
(if
strict
(list (quote type-check!) left strict)