1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

[api-minor] Stop polyfilling structuredClone in legacy builds

Comparing the currently supported browsers/environments, see [the FAQ](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support) and the [MDN compatibility data](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility), the `structuredClone` polyfill is *only* needed in Google Chrome versions < 98. Because of some limitations in the core-js polyfill we're currently forced to special-case the `transfer` handling to prevent bugs, and it'd be nice to avoid that.

Note that `structuredClone`, with transfers, is only used in two spots:
 - The `LoopbackPort` class, which is only used with fake workers. Given that fake workers should *never* be used in browsers, breaking that edge-case in older Google Chrome versions seem fine.
 - The `AnnotationStorage` class, when Stamp-annotations have been added to the document. Given that Google Chrome isn't the main focus of development, breaking *part* of the editing-functionality in older Google Chrome versions should hopefully be acceptable.
This commit is contained in:
Jonas Jenwald 2023-10-07 16:30:27 +02:00
parent e6c3257175
commit 8bd3cc0313
3 changed files with 19 additions and 27 deletions

View file

@ -214,7 +214,12 @@ function createWebpackConfig(
: [
[
"@babel/preset-env",
{ corejs: "3.32.2", shippedProposals: true, useBuiltIns: "usage" },
{
corejs: "3.32.2",
exclude: ["web.structured-clone"],
shippedProposals: true,
useBuiltIns: "usage",
},
],
];
const babelPlugins = isModule