mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Add polyfills to support iteration of Map
and Set
Without this, things such as e.g. `Metadata.getAll` is broken in IE11 (see PR 11596). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Browser_compatibility https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#Browser_compatibility
This commit is contained in:
parent
cd3f2d49e6
commit
4a76ab352c
1 changed files with 20 additions and 0 deletions
|
@ -281,6 +281,26 @@ if (
|
|||
globalThis.ReadableStream = require("web-streams-polyfill/dist/ponyfill.js").ReadableStream;
|
||||
})();
|
||||
|
||||
// We want to support Map iteration, but it doesn't seem possible to easily
|
||||
// test for that specifically; hence using a similarly unsupported property.
|
||||
// Support: IE11
|
||||
(function checkMapEntries() {
|
||||
if (globalThis.Map && globalThis.Map.prototype.entries) {
|
||||
return;
|
||||
}
|
||||
globalThis.Map = require("core-js/es/map/index.js");
|
||||
})();
|
||||
|
||||
// We want to support Set iteration, but it doesn't seem possible to easily
|
||||
// test for that specifically; hence using a similarly unsupported property.
|
||||
// Support: IE11
|
||||
(function checkSetEntries() {
|
||||
if (globalThis.Set && globalThis.Set.prototype.entries) {
|
||||
return;
|
||||
}
|
||||
globalThis.Set = require("core-js/es/set/index.js");
|
||||
})();
|
||||
|
||||
// Support: IE<11, Safari<8, Chrome<36
|
||||
(function checkWeakMap() {
|
||||
if (globalThis.WeakMap) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue