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

[JS] Formatted value has to be a string when neither null nor undefined

This commit is contained in:
Calixte Denizet 2022-05-08 15:43:02 +02:00
parent cfac6fa511
commit ab3958d6e8
2 changed files with 4 additions and 2 deletions

View file

@ -1532,6 +1532,8 @@ class WidgetAnnotation extends Annotation {
}
}
assert(typeof value === "string", "Expected `value` to be a string.");
value = value.trim();
if (value === "") {

View file

@ -191,7 +191,7 @@ class EventDispatcher {
let formattedValue = null;
if (this.runActions(source, source, event, "Format")) {
formattedValue = event.value;
formattedValue = event.value?.toString?.();
}
source.obj._send({
@ -296,7 +296,7 @@ class EventDispatcher {
savedValue = event.value = target.obj.value;
let formattedValue = null;
if (this.runActions(target, target, event, "Format")) {
formattedValue = event.value;
formattedValue = event.value?.toString?.();
}
target.obj._send({