1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Don't stop calculating field values when a Calculate callback throws

It fixes #18561.
This commit is contained in:
Calixte Denizet 2024-08-05 19:11:48 +02:00
parent c60c0d1c6d
commit ad12f33999
4 changed files with 39 additions and 1 deletions

View file

@ -14,6 +14,7 @@
*/
import {
serializeError,
USERACTIVATION_CALLBACKID,
USERACTIVATION_MAXTIME_VALIDITY,
} from "./app_utils.js";
@ -344,7 +345,15 @@ class EventDispatcher {
event.value = null;
const target = this._objects[targetId];
let savedValue = target.obj._getValue();
this.runActions(source, target, event, "Calculate");
try {
this.runActions(source, target, event, "Calculate");
} catch (error) {
const fieldId = target.obj._id;
const serializedError = serializeError(error);
serializedError.value = `Error when calculating value for field "${fieldId}"\n${serializedError.value}`;
this._externalCall("send", [serializedError]);
continue;
}
if (!event.rc) {
continue;
}