1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

A couple of small scripting/XFA-related tweaks in the worker-code

- Use `PDFManager.ensureDoc`, rather than `PDFManager.ensure`, in a couple of spots in the code. If there exists a short-hand format, we should obviously use it whenever possible.

 - Fix a unit-test helper, to account for the previous changes. (Also, converts a function to be `async` instead.)

 - Add one more exists-check in `PDFDocument.loadXfaFonts`, which I missed to suggest in PR 13146, to prevent any possible errors if the method is ever called in a situation where it shouldn't be.
   Also, print a warning if the actual font-loading fails since that could help future debugging. (Finally, reduce overall indentation in the loop.)

 - Slightly unrelated, but make a small tweak of a comment in `src/core/fonts.js` to reduce possible confusion.
This commit is contained in:
Jonas Jenwald 2021-04-17 10:13:42 +02:00
parent ac3fa1e3d7
commit f560fe6875
4 changed files with 43 additions and 35 deletions

View file

@ -195,7 +195,7 @@ class WorkerMessageHandler {
]);
if (isPureXfa) {
const task = new WorkerTask("Load fonts for Xfa");
const task = new WorkerTask("loadXfaFonts");
startWorkerTask(task);
await pdfManager
.loadXfaFonts(handler, task)