mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Remove the compatibility checks in WorkerMessageHandler.createDocumentHandler
For some time these checks have only targeted Node.js environments, since the features in question exist in all supported browsers (even when a `legacy`-build is used). Now that we've updated the minimum supported Node.js version to 18, a number of polyfills are thus (finally) no longer necessary in that environment. Hence for certain *basic* functionality, such as e.g. text-extraction, it's now possible to use either a modern- or a `legacy`-build of the PDF.js library in Node.js environments. *Please note:* For e.g. canvas-rendering in Node.js environments it's still necessary to use a `legacy`-build, since that functionality requires various polyfills.
This commit is contained in:
parent
ed8be6f882
commit
1753e321cd
2 changed files with 0 additions and 16 deletions
|
@ -129,20 +129,6 @@ class WorkerMessageHandler {
|
|||
"; thus breaking e.g. `for...in` iteration of `Array`s."
|
||||
);
|
||||
}
|
||||
|
||||
// Ensure that (primarily) Node.js users won't accidentally attempt to use
|
||||
// a non-translated/non-polyfilled build of the library, since that would
|
||||
// quickly fail anyway because of missing functionality.
|
||||
if (isNodeJS && typeof Path2D === "undefined") {
|
||||
const partialMsg =
|
||||
"The browser/environment lacks native support for critical " +
|
||||
"functionality used by the PDF.js library (e.g. `Path2D`); ";
|
||||
|
||||
if (isNodeJS) {
|
||||
throw new Error(partialMsg + "please use a `legacy`-build instead.");
|
||||
}
|
||||
throw new Error(partialMsg + "please update to a supported browser.");
|
||||
}
|
||||
}
|
||||
const workerHandlerName = docId + "_worker";
|
||||
let handler = new MessageHandler(workerHandlerName, docId, port);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue