Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the "FetchBuiltInCMap"/"FetchStandardFontData" message-handlers to be asynchronous #18983

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/display/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down