Skip to content

Duktape → QuickJS migration + phase-one DOM lifecycle port #181

Description

@mplsllc

Tracking issue for the JS engine swap (was never filed; recording now per DIRECTIVE #3).

Done (shipped, awaiting G3 verify — commits held)

  • fixes541 — phase-one DOM lifecycle port in macsurf_qjs.c: node-identity map (1024-bucket chained, keyed by dom_node*), owner-document keepalive ref per wrapper, idempotent finalizer (map-entry = already-cleaned flag), guaranteed qjs_wrap_drain() (drops node + owner_doc, then clears) at realm reset + heap destroy, qjs_get_node() align/range pointer guard on all 18 accessors. Consume-semantics ref contract (wrapper owns exactly one node ref + one doc keepalive, released solely by finalizer/drain). Engine-agnostic main.c JS-init gates; js_stub.c guard fixed.
  • fixes542 — prefix flip: WITH_QUICKJS default, WITH_DUKTAPE no longer auto-defined.
  • fixes543 — full Duktape purge: all WITH_DUKTAPE guards collapsed to #ifdef WITH_QUICKJS; symbols renamed (macsurf_duk_monotonic_msmacsurf_monotonic_ms, macsurf_duk_date_get_nowmacsurf_date_get_now); deleted libduktape/, content/handlers/javascript/duktape/ (both duk_config.h), frontend macsurf_js*.c/.h + macsurf_es6.c/.h + macos9_js_click.c.

Design/audit refs: docs/research/quickjs-dom-port-phase1.md, docs/research/teardown-ordering-audit.md.

Verify (G3, after rebuild)

  • Identity round-trip: el.parentNode === el.parentNode; appendChildparentNoderemoveChildparentNode === null.
  • qjs wrap_drain: N per navigation; no UAF across multi-page browsing.

Next (phase two+, on the validated bridge)

  • Widen DOM coverage off the identity map: classList/DOMTokenList, real querySelector/querySelectorAll (see DOM: document.querySelector / querySelectorAll basic selector support #29), live NodeList/HTMLCollection, attributes/NamedNodeMap. These need a CSS-selector backend + live-collection proxy (separate work).
  • Dead-code sweep: macsurf_date_get_now now has no caller; the in-macsurf_qjs.c ES6 transpile cache is effectively unused (QuickJS runs ES2023 natively).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: js-engineDuktape, ES5 evaluator, JS bindings

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions