Merge pull request #12598 from Snuffleupagus/globalThis-check

Fail early, in modern `GENERIC` builds, if `globalThis` isn't available (PR 11799 follow-up, issue 12596)
This commit is contained in:
Tim van der Meij 2020-11-07 23:42:21 +01:00 committed by GitHub
commit 55f55f5859
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,13 +143,14 @@ class WorkerMessageHandler {
// `ReadableStream` and `Promise.allSettled`).
if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("SKIP_BABEL")) &&
(typeof ReadableStream === "undefined" ||
(typeof globalThis === "undefined" ||
typeof ReadableStream === "undefined" ||
typeof Promise.allSettled === "undefined")
) {
throw new Error(
"The browser/environment lacks native support for critical " +
"functionality used by the PDF.js library (e.g. " +
"`ReadableStream` and/or `Promise.allSettled`); " +
"functionality used by the PDF.js library (e.g. `globalThis`, " +
"`ReadableStream`, and/or `Promise.allSettled`); " +
"please use an ES5-compatible build instead."
);
}