mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-12 21:21:04 +02:00
Remove the Map.prototype.getOrInsertComputed polyfill from the scripting implementation (PR 21399 follow-up)
All unit- and integration-tests pass with this patch, and according to the QuickJS changelog this is supported now; note 3d5e064e9d/Changelog (L10) and https://github.com/tc39/proposal-upsert.
This commit is contained in:
parent
52a44a68be
commit
5f83408099
@ -31,20 +31,6 @@ function serializeError(error) {
|
||||
const makeArr = () => [];
|
||||
const makeMap = () => new Map();
|
||||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
// TODO: Remove this once `Map.prototype.getOrInsertComputed` is supported in
|
||||
// QuickJS.
|
||||
if (typeof Map.prototype.getOrInsertComputed !== "function") {
|
||||
// eslint-disable-next-line no-extend-native
|
||||
Map.prototype.getOrInsertComputed = function (key, callbackFn) {
|
||||
if (!this.has(key)) {
|
||||
this.set(key, callbackFn(key));
|
||||
}
|
||||
return this.get(key);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
FORMS_VERSION,
|
||||
makeArr,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user