Access the Catalog
data correctly in the "GetPageIndex" handler in src/core/worker.js
Even though the code obviously works as-is, given that we have unit-tests for it, it still feels incorrect to just *assume* that the `Catalog`-instance has all of its properties immediately available. Especially when (almost) all of the other handlers, in `src/core/worker.js`, protect their data accesses with appropriate `pdfManager.ensure` calls.
This commit is contained in:
parent
2e6e2c3b41
commit
bd16c363ce
@ -438,10 +438,9 @@ class WorkerMessageHandler {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
|
handler.on("GetPageIndex", function wphSetupGetPageIndex({ ref }) {
|
||||||
var ref = Ref.get(data.ref.num, data.ref.gen);
|
const pageRef = Ref.get(ref.num, ref.gen);
|
||||||
var catalog = pdfManager.pdfDocument.catalog;
|
return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
|
||||||
return catalog.getPageIndex(ref);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
handler.on("GetDestinations", function wphSetupGetDestinations(data) {
|
handler.on("GetDestinations", function wphSetupGetDestinations(data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user