Skip to content

Commit

Permalink
Merge pull request mozilla#12276 from Snuffleupagus/worker-ensure
Browse files Browse the repository at this point in the history
Access the `XRef`/`Catalog` data correctly in the "GetStats"/"GetPageIndex" handlers in `src/core/worker.js`
  • Loading branch information
timvandermeij authored Aug 25, 2020
2 parents 34cec29 + bd16c36 commit 525cc73
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 }) {
Expand Down

0 comments on commit 525cc73

Please sign in to comment.