Merge pull request #18983 from Snuffleupagus/api-FetchBuiltInCMap-FetchStandardFontData-async
Change the "FetchBuiltInCMap"/"FetchStandardFontData" message-handlers to be asynchronous
This commit is contained in:
commit
06f3b2d0a6
@ -2916,29 +2916,31 @@ class WorkerTransport {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
messageHandler.on("FetchBuiltInCMap", data => {
|
messageHandler.on("FetchBuiltInCMap", async data => {
|
||||||
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||||
|
throw new Error("Not implemented: FetchBuiltInCMap");
|
||||||
|
}
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
return Promise.reject(new Error("Worker was destroyed."));
|
throw new Error("Worker was destroyed.");
|
||||||
}
|
}
|
||||||
if (!this.cMapReaderFactory) {
|
if (!this.cMapReaderFactory) {
|
||||||
return Promise.reject(
|
throw new Error(
|
||||||
new Error(
|
"CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."
|
||||||
"CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this.cMapReaderFactory.fetch(data);
|
return this.cMapReaderFactory.fetch(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
messageHandler.on("FetchStandardFontData", data => {
|
messageHandler.on("FetchStandardFontData", async data => {
|
||||||
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||||
|
throw new Error("Not implemented: FetchStandardFontData");
|
||||||
|
}
|
||||||
if (this.destroyed) {
|
if (this.destroyed) {
|
||||||
return Promise.reject(new Error("Worker was destroyed."));
|
throw new Error("Worker was destroyed.");
|
||||||
}
|
}
|
||||||
if (!this.standardFontDataFactory) {
|
if (!this.standardFontDataFactory) {
|
||||||
return Promise.reject(
|
throw new Error(
|
||||||
new Error(
|
"StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."
|
||||||
"StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return this.standardFontDataFactory.fetch(data);
|
return this.standardFontDataFactory.fetch(data);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user