1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Merge pull request #16238 from Snuffleupagus/update-Node-compat-check

Update the Node.js compatibility-check in the worker-thread
This commit is contained in:
Tim van der Meij 2023-04-01 14:20:33 +02:00 committed by GitHub
commit 13f2426aab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -133,10 +133,14 @@ class WorkerMessageHandler {
// 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 (typeof ReadableStream === "undefined") {
if (
typeof Path2D === "undefined" ||
typeof ReadableStream === "undefined"
) {
const partialMsg =
"The browser/environment lacks native support for critical " +
"functionality used by the PDF.js library (e.g. `ReadableStream`); ";
"functionality used by the PDF.js library " +
"(e.g. `Path2D` and/or `ReadableStream`); ";
if (isNodeJS) {
throw new Error(partialMsg + "please use a `legacy`-build instead.");