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

Re-factor how the GenericL10n class fetches localization-data

- Re-factor the existing `fetchData` helper function such that it can fetch more types of data, and it now supports "arraybuffer", "json", and "text".
   This only needed minor adjustments in the `DOMCMapReaderFactory` and `DOMStandardFontDataFactory` classes.[1]

 - Expose the `fetchData` helper function in the API, such that the viewer is able to access it.

 - Use the `fetchData` helper function in the `GenericL10n` class, since this should allow fetching of localization-data even if the default viewer is run in an environment without support for the Fetch API.

---
[1] While testing this I also noticed a minor inconsistency when handling standard font-data on the worker-thread.
This commit is contained in:
Jonas Jenwald 2023-11-14 12:54:21 +01:00
parent 44cde3ccca
commit 709d89420e
6 changed files with 45 additions and 20 deletions

View file

@ -44,6 +44,7 @@ import {
} from "../../src/display/api.js";
import {
DOMSVGFactory,
fetchData,
getFilenameFromUrl,
getPdfFilenameFromUrl,
getXfaPageViewport,
@ -78,6 +79,7 @@ const expectedAPI = Object.freeze({
createValidAbsoluteUrl,
DOMSVGFactory,
FeatureTest,
fetchData,
getDocument,
getFilenameFromUrl,
getPdfFilenameFromUrl,