mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Slightly re-factor the transportFactory initialization in getDocument
Given that the `WorkerTransport`-constructor will access all possible factory-instances, let's ensure that the `transportFactory`-object always has a consistent shape regardless of other options. Also, since `useWorkerFetch` is always true in MOZCENTRAL builds we never need to create `CMapReaderFactory`/`StandardFontDataFactory`-instances there.
This commit is contained in:
parent
a1283785e5
commit
a989244570
@ -341,16 +341,17 @@ function getDocument(src = {}) {
|
|||||||
const transportFactory = {
|
const transportFactory = {
|
||||||
canvasFactory: new CanvasFactory({ ownerDocument, enableHWA }),
|
canvasFactory: new CanvasFactory({ ownerDocument, enableHWA }),
|
||||||
filterFactory: new FilterFactory({ docId, ownerDocument }),
|
filterFactory: new FilterFactory({ docId, ownerDocument }),
|
||||||
|
cMapReaderFactory:
|
||||||
|
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||||
|
useWorkerFetch
|
||||||
|
? null
|
||||||
|
: new CMapReaderFactory({ baseUrl: cMapUrl, isCompressed: cMapPacked }),
|
||||||
|
standardFontDataFactory:
|
||||||
|
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
|
||||||
|
useWorkerFetch
|
||||||
|
? null
|
||||||
|
: new StandardFontDataFactory({ baseUrl: standardFontDataUrl }),
|
||||||
};
|
};
|
||||||
if (!useWorkerFetch) {
|
|
||||||
transportFactory.cMapReaderFactory = new CMapReaderFactory({
|
|
||||||
baseUrl: cMapUrl,
|
|
||||||
isCompressed: cMapPacked,
|
|
||||||
});
|
|
||||||
transportFactory.standardFontDataFactory = new StandardFontDataFactory({
|
|
||||||
baseUrl: standardFontDataUrl,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!worker) {
|
if (!worker) {
|
||||||
const workerParams = {
|
const workerParams = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user