pub struct QuickJsRuntime { /* private fields */ }Expand description
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.
Implementations§
Source§impl QuickJsRuntime
impl QuickJsRuntime
Sourcepub fn new() -> Result<Self, SandboxError>
pub fn new() -> Result<Self, SandboxError>
Construct a new sandboxed runtime with default budgets.
Sourcepub fn with_time_budget(self, budget: Duration) -> Self
pub fn with_time_budget(self, budget: Duration) -> Self
Override the per-script wall-clock budget. Must be called before any
execute_script invocation; takes effect on the next call.
Sourcepub fn with_memory_budget(self, bytes: usize) -> Self
pub fn with_memory_budget(self, bytes: usize) -> Self
Override the per-document memory budget. Must be called before any
execute_script invocation; takes effect on the next document.
Sourcepub fn with_walltime_fallback_multiplier(self, multiplier: u32) -> Self
pub fn with_walltime_fallback_multiplier(self, multiplier: u32) -> Self
QF1-E / SEC-01 — override the wall-time fallback multiplier. The
default is read from
super::ENV_WALLTIME_FALLBACK_MULTIPLIER / falls back to
super::WALLTIME_FALLBACK_MULTIPLIER_DEFAULT. Values below 2
are clamped to 2 so a clean timeout cannot be re-labelled as
WallTimeExceeded by accident. Tests use this to deterministically
pin the multiplier without racing the process-global env var.
Trait Implementations§
Source§impl Debug for QuickJsRuntime
impl Debug for QuickJsRuntime
Source§impl XfaJsRuntime for QuickJsRuntime
impl XfaJsRuntime for QuickJsRuntime
Source§fn reset_for_new_document(&mut self) -> Result<(), SandboxError>
fn reset_for_new_document(&mut self) -> Result<(), SandboxError>
Source§fn set_form_handle(
&mut self,
form: *mut FormTree,
root_id: FormNodeId,
) -> Result<(), SandboxError>
fn set_form_handle( &mut self, form: *mut FormTree, root_id: FormNodeId, ) -> Result<(), SandboxError>
FormTree the runtime should resolve paths
against and mutate. The dispatch path owns the mutable borrow and clears
the handle before returning.Source§fn set_data_handle(&mut self, dom: *const DataDom)
fn set_data_handle(&mut self, dom: *const DataDom)
DataDom for the current
document. Called once per document after set_form_handle, before any
scripts run. Default: no-op (backends without DataDom support ignore it). Read moreSource§fn set_declared_subform_names(&mut self, names: HashSet<String>)
fn set_declared_subform_names(&mut self, names: HashSet<String>)
subform/subformSet/exclGroup/
area) for the current document. Backends that resolve implicit SOM
identifiers use it to return a benign empty-node façade for a
declared-but-absent reference instead of undefined (Adobe semantics),
so guarded scripts (if (!Sub.Child.isNull) {...} else {...}) run their
else branch instead of throwing. Like set_data_handle, the caller
installs this before script execution. Default: no-op (the static
NullRuntime ignores it, so the default/non-sandboxed path is
unaffected and stays byte-identical).Source§fn reset_per_script(
&mut self,
current_id: FormNodeId,
activity: Option<&str>,
) -> Result<(), SandboxError>
fn reset_per_script( &mut self, current_id: FormNodeId, activity: Option<&str>, ) -> Result<(), SandboxError>
Source§fn set_static_page_count(&mut self, page_count: u32) -> Result<(), SandboxError>
fn set_static_page_count(&mut self, page_count: u32) -> Result<(), SandboxError>
Source§fn set_presave_gate(&mut self, enabled: bool)
fn set_presave_gate(&mut self, enabled: bool)
XFA_PRESAVE_DURING_FLATTEN=1 opt-in is active for the current
flatten. The dispatch path computes this once per document via
presave_during_flatten_enabled and forwards it here so the host
binding layer can mirror the dispatch decision (defence-in-depth). Read moreSource§fn execute_script(
&mut self,
activity: Option<&str>,
body: &str,
) -> Result<RuntimeOutcome, SandboxError>
fn execute_script( &mut self, activity: Option<&str>, body: &str, ) -> Result<RuntimeOutcome, SandboxError>
Source§fn take_metadata(&mut self) -> RuntimeMetadata
fn take_metadata(&mut self) -> RuntimeMetadata
take_metadata
call (or since reset_for_new_document, whichever was later).Source§fn take_occur_mutations(&mut self) -> Vec<(usize, String, i64)>
fn take_occur_mutations(&mut self) -> Vec<(usize, String, i64)>
occur.min/occur.max write intents
(node_index, prop, value) recorded during the script pass. The
dispatch path applies them (only when XFA_OCCUR_APPLY=1) after the
rollback decision. Default: none (non-sandboxed runtimes capture nothing).Source§fn take_diag_logs(&mut self) -> RuntimeDiagLogs
fn take_diag_logs(&mut self) -> RuntimeDiagLogs
XFA_RUNTIME_DIAG=1 is set at the host call sites.
Default impl returns empty logs (NullRuntime, non-sandboxed paths).Auto Trait Implementations§
impl !RefUnwindSafe for QuickJsRuntime
impl !Send for QuickJsRuntime
impl !Sync for QuickJsRuntime
impl !UnwindSafe for QuickJsRuntime
impl Freeze for QuickJsRuntime
impl Unpin for QuickJsRuntime
impl UnsafeUnpin for QuickJsRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more