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:
commit
13f2426aab
@ -133,10 +133,14 @@ class 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.
|
// quickly fail anyway because of missing functionality.
|
||||||
if (typeof ReadableStream === "undefined") {
|
if (
|
||||||
|
typeof Path2D === "undefined" ||
|
||||||
|
typeof ReadableStream === "undefined"
|
||||||
|
) {
|
||||||
const partialMsg =
|
const partialMsg =
|
||||||
"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. `Path2D` and/or `ReadableStream`); ";
|
||||||
|
|
||||||
if (isNodeJS) {
|
if (isNodeJS) {
|
||||||
throw new Error(partialMsg + "please use a `legacy`-build instead.");
|
throw new Error(partialMsg + "please use a `legacy`-build instead.");
|
||||||
|
@ -36,7 +36,7 @@ import { isNodeJS } from "./is_node.js";
|
|||||||
polyfillPath2D(globalThis);
|
polyfillPath2D(globalThis);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Support: Node.js
|
// Support: Node.js<18.0.0
|
||||||
(function checkReadableStream() {
|
(function checkReadableStream() {
|
||||||
if (globalThis.ReadableStream || !isNodeJS) {
|
if (globalThis.ReadableStream || !isNodeJS) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user