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

Merge pull request #17882 from calixteman/bug1889122

Use the string value of the field when calling the Format callback (bug 1889122)
This commit is contained in:
calixteman 2024-04-10 09:40:54 +02:00 committed by GitHub
commit 77ee914bd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 85 additions and 3 deletions

View file

@ -58,6 +58,19 @@ class PDFScriptingManager {
this.#eventBus = eventBus;
this.#externalServices = externalServices;
this.#docProperties = docProperties;
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
Object.defineProperty(this, "sandboxTrip", {
value: () =>
setTimeout(
() =>
this.#scripting?.dispatchEventInSandbox({
name: "sandboxtripbegin",
}),
0
),
});
}
}
setViewer(pdfViewer) {
@ -258,6 +271,17 @@ class PDFScriptingManager {
const { id, siblings, command, value } = detail;
if (!id) {
if (
typeof PDFJSDev !== "undefined" &&
PDFJSDev.test("TESTING") &&
command === "sandboxTripEnd"
) {
window.setTimeout(() => {
window.dispatchEvent(new CustomEvent("sandboxtripend"));
}, 0);
return;
}
switch (command) {
case "clear":
console.clear();