Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

M6: parity note for document scripts that throw (#3940)

mtlcl41077db1bd27faf
diff --git a/crates/js/src/lib.rs b/crates/js/src/lib.rs
index 4a2c2f666..81633d597 100644
--- a/crates/js/src/lib.rs
+++ b/crates/js/src/lib.rs
@@ -181,8 +181,8 @@ pub struct Outcome {
pub requests: Vec<Request>,
/// The script's error (syntax error, exception, or a limit reached), if it failed.
pub error: Option<String>,
- /// Errors in the document-level scripts that ran first. Each failing one stops where it
- /// failed; the others and the script itself still run, as in Acrobat (#3940).
+ /// Errors in the document-level scripts that ran first. Each is a script of its own: one
+ /// that throws stops where it failed, and the others and the script itself still run (#3940).
pub doc_errors: Vec<String>,
/// The script's completion value (what the console prints), unless undefined.
pub result: Option<String>,
diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.toml
index 973e0cc69..f416435ae 100644
--- a/parity/acrobat-features.toml
+++ b/parity/acrobat-features.toml
@@ -5141,8 +5141,8 @@ milestone = "M6"
status = "shipped"
commands = ["tools.document_js"]
tools = ["js_document_scripts", "js_set_document_script"]
-evidence = ["crates/ui-egui/tests/it/javascript.rs::document_scripts_and_preferences", "crates/automation/tests/it/automation.rs::javascript_through_tools", "crates/engine/src/tests.rs::form_javascript_validates_calculates_and_formats"]
-notes = "Names /JavaScript tree: list, add, edit, delete; functions are available to field scripts."
+evidence = ["crates/ui-egui/tests/it/javascript.rs::document_scripts_and_preferences", "crates/automation/tests/it/automation.rs::javascript_through_tools", "crates/engine/src/tests.rs::form_javascript_validates_calculates_and_formats", "crates/engine/src/tests.rs::a_document_script_that_throws_still_lets_the_form_calculate"]
+notes = "Names /JavaScript tree: list, add, edit, delete; functions are available to field scripts. A script that throws (calling an Acrobat method PdfCraft lacks, say) stops where it failed, but the others and the field scripts still run and the error is reported once (js_run's document_errors, the console) (#3940). Not like Acrobat: the scripts run again before every field script instead of once when the document opens, so what they do at top level repeats."
[[feature]]
id = "form.document-actions"