Skip to main content

Module rquickjs_backend

Module rquickjs_backend 

Source
Expand description

M3-B Phase B — rquickjs backend for super::XfaJsRuntime.

Compiled in only when the xfa-js-sandboxed Cargo feature is enabled.

This backend is intentionally minimal:

  • No host bindings registered. Phase C adds the first useful ones per benchmarks/runs/M3B_HOST_BINDINGS_MINIMUM_SET.md.
  • Date.now, Math.random, fetch, require, process and friends are absent because they are never registered (rquickjs default contexts expose only spec-mandated ECMAScript built-ins).
  • JS_SetMemoryLimit enforces the per-document memory budget; any allocation that pushes the runtime over the limit fails with super::SandboxError::OutOfMemory.
  • Per-script time budget is enforced with the rquickjs interrupt handler that polls a wall-clock deadline; eval_with_options bails out with super::SandboxError::Timeout when the deadline elapses.
  • All FFI is wrapped in std::panic::catch_unwind so a QuickJS panic never crosses into the parent flatten path (benchmarks/runs/M3B_RUNTIME_SECURITY_MODEL.md §1 S-17).

Structs§

QuickJsRuntime
QuickJS-backed runtime adapter. One instance is reusable across many documents; callers MUST invoke XfaJsRuntime::reset_for_new_document at the start of each flatten.