mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Use a Map
, rather than an Object
, internally in the Catalog.openAction
getter (PR 11644 follow-up)
This provides a work-around to avoid having to conditionally try to initialize the `openAction`-object in multiple places. Given that `Object.fromEntries` doesn't seem to *guarantee* that a `null` prototype is used, we thus hack around that by using `Object.assign` with `Object.create(null)`.
This commit is contained in:
parent
ea4d88a330
commit
9fc7cdcc9d
2 changed files with 16 additions and 14 deletions
|
@ -585,6 +585,11 @@ function string32(value) {
|
|||
);
|
||||
}
|
||||
|
||||
// Ensures that the returned Object has a `null` prototype.
|
||||
function objectFromEntries(iterable) {
|
||||
return Object.assign(Object.create(null), Object.fromEntries(iterable));
|
||||
}
|
||||
|
||||
// Checks the endianness of the platform.
|
||||
function isLittleEndian() {
|
||||
const buffer8 = new Uint8Array(4);
|
||||
|
@ -1035,6 +1040,7 @@ export {
|
|||
isString,
|
||||
isSameOrigin,
|
||||
createValidAbsoluteUrl,
|
||||
objectFromEntries,
|
||||
IsLittleEndianCached,
|
||||
IsEvalSupportedCached,
|
||||
removeNullCharacters,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue