Merge pull request #12276 from Snuffleupagus/worker-ensure

Access the `XRef`/`Catalog` data correctly in the "GetStats"/"GetPageIndex" handlers in `src/core/worker.js`
This commit is contained in:
Tim van der Meij 2020-08-25 22:18:08 +02:00 committed by GitHub
commit 525cc733d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,10 +438,9 @@ class WorkerMessageHandler {
});
});
handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
var ref = Ref.get(data.ref.num, data.ref.gen);
var catalog = pdfManager.pdfDocument.catalog;
return catalog.getPageIndex(ref);
handler.on("GetPageIndex", function wphSetupGetPageIndex({ ref }) {
const pageRef = Ref.get(ref.num, ref.gen);
return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
});
handler.on("GetDestinations", function wphSetupGetDestinations(data) {
@ -507,7 +506,7 @@ class WorkerMessageHandler {
});
handler.on("GetStats", function wphSetupGetStats(data) {
return pdfManager.pdfDocument.xref.stats;
return pdfManager.ensureXRef("stats");
});
handler.on("GetAnnotations", function ({ pageIndex, intent }) {