mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
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
1 changed files with 14 additions and 12 deletions
|
@ -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) {
|
||||
return Promise.reject(new Error("Worker was destroyed."));
|
||||
throw new Error("Worker was destroyed.");
|
||||
}
|
||||
if (!this.cMapReaderFactory) {
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
"CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."
|
||||
)
|
||||
throw new Error(
|
||||
"CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."
|
||||
);
|
||||
}
|
||||
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) {
|
||||
return Promise.reject(new Error("Worker was destroyed."));
|
||||
throw new Error("Worker was destroyed.");
|
||||
}
|
||||
if (!this.standardFontDataFactory) {
|
||||
return Promise.reject(
|
||||
new Error(
|
||||
"StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."
|
||||
)
|
||||
throw new Error(
|
||||
"StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."
|
||||
);
|
||||
}
|
||||
return this.standardFontDataFactory.fetch(data);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue