Skip to content

Commit

Permalink
Merge pull request #12598 from Snuffleupagus/globalThis-check
Browse files Browse the repository at this point in the history
Fail early, in modern `GENERIC` builds, if `globalThis` isn't available (PR 11799 follow-up, issue 12596)
  • Loading branch information
timvandermeij authored Nov 7, 2020
2 parents b068cdb + a03b383 commit 55f55f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
}
Expand Down

0 comments on commit 55f55f5

Please sign in to comment.