pub fn run_js_calculations(
form: &mut FormTree,
scripts: &[(FormNodeId, &str)],
runtime: &mut XfaJsRuntime,
cancel: Arc<AtomicBool>,
) -> Result<ScriptResult, ScriptError>Expand description
Execute JavaScript calculate scripts on specific form fields.
This is the application/x-javascript dispatch path. Callers provide an
explicit list of (target_field_id, js_script_body) pairs — the language
detection happens at a higher layer (the template parser / XFA merger)
which knows the contentType of each <script> element.
For each pair the function:
- Snapshots all field raw-values into a
FieldValuesstore. - Executes the JS script body via the sandboxed
XfaJsRuntime. - Flushes any
rawValuemutations back into theFormTree.
Errors from individual scripts are swallowed (best-effort, matching Adobe
behaviour). Use the returned ScriptResult to inspect which fields were
updated.