mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +02:00
Use proper access methods in Dict.merge, rather than modifying the _map field manually
This commit is contained in:
parent
bda7456724
commit
6c6bb19324
@ -236,7 +236,7 @@ class Dict {
|
||||
if (!(dict instanceof Dict)) {
|
||||
continue;
|
||||
}
|
||||
for (const [key, value] of dict._map) {
|
||||
for (const [key, value] of dict.getRawEntries()) {
|
||||
let property = properties.get(key);
|
||||
if (property === undefined) {
|
||||
property = [];
|
||||
@ -252,20 +252,18 @@ class Dict {
|
||||
}
|
||||
for (const [name, values] of properties) {
|
||||
if (values.length === 1 || !(values[0] instanceof Dict)) {
|
||||
mergedDict._map.set(name, values[0]);
|
||||
mergedDict.set(name, values[0]);
|
||||
continue;
|
||||
}
|
||||
const subDict = new Dict(xref);
|
||||
|
||||
for (const dict of values) {
|
||||
for (const [key, value] of dict._map) {
|
||||
if (!subDict._map.has(key)) {
|
||||
subDict._map.set(key, value);
|
||||
}
|
||||
for (const [key, value] of dict.getRawEntries()) {
|
||||
subDict.setIfNotExists(key, value);
|
||||
}
|
||||
}
|
||||
if (subDict.size > 0) {
|
||||
mergedDict._map.set(name, subDict);
|
||||
mergedDict.set(name, subDict);
|
||||
}
|
||||
}
|
||||
properties.clear();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user