Merge pull request #11799 from Snuffleupagus/allSettled
Fail early, in modern `GENERIC` builds, if certain required browser functionality is missing (PR 11771 follow-up)
This commit is contained in:
commit
71d16686e4
@ -140,14 +140,16 @@ var WorkerMessageHandler = {
|
|||||||
// Ensure that (primarily) Node.js users won't accidentally attempt to use
|
// Ensure that (primarily) Node.js users won't accidentally attempt to use
|
||||||
// a non-translated/non-polyfilled build of the library, since that would
|
// a non-translated/non-polyfilled build of the library, since that would
|
||||||
// quickly fail anyway because of missing functionality (such as e.g.
|
// quickly fail anyway because of missing functionality (such as e.g.
|
||||||
// `ReadableStream).
|
// `ReadableStream` and `Promise.allSettled`).
|
||||||
if (
|
if (
|
||||||
(typeof PDFJSDev === "undefined" || PDFJSDev.test("SKIP_BABEL")) &&
|
(typeof PDFJSDev === "undefined" || PDFJSDev.test("SKIP_BABEL")) &&
|
||||||
typeof ReadableStream === "undefined"
|
(typeof ReadableStream === "undefined" ||
|
||||||
|
typeof Promise.allSettled === "undefined")
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"The browser/environment lacks native support for critical " +
|
"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. " +
|
||||||
|
"`ReadableStream` and/or `Promise.allSettled`); " +
|
||||||
"please use an ES5-compatible build instead."
|
"please use an ES5-compatible build instead."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user