Merge pull request #12878 from Snuffleupagus/worker-compat-checks

Remove redundant compatibility checks, for modern `generic` builds, in `src/core/worker.js`
This commit is contained in:
Tim van der Meij 2021-01-20 21:03:04 +01:00 committed by GitHub
commit 9d4bad91e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,19 +139,15 @@ 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 (such as e.g.
// `ReadableStream` and `Promise.allSettled`).
// quickly fail anyway because of missing functionality.
if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("SKIP_BABEL")) &&
(typeof globalThis === "undefined" ||
typeof ReadableStream === "undefined" ||
typeof Promise.allSettled === "undefined")
typeof ReadableStream === "undefined"
) {
throw new Error(
"The browser/environment lacks native support for critical " +
"functionality used by the PDF.js library (e.g. `globalThis`, " +
"`ReadableStream`, and/or `Promise.allSettled`); " +
"please use an ES5-compatible build instead."
"functionality used by the PDF.js library (e.g. `ReadableStream`); " +
"please use an `es5`-build instead."
);
}
}