mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Avoid unnecessary parsing, in Page.GetStructTree
, when no structTree is available (PR 13221 follow-up)
It's obviously (a bit) more efficient to return early in `Page.getStructTree`, rather than trying to first "parse" an *empty* structTree-root. *Somehow I didn't think of this yesterday, but this feels like a much better solution overall; sorry about the churn here!*
This commit is contained in:
parent
0d2dd6c2fe
commit
9360c7cbdc
3 changed files with 10 additions and 14 deletions
|
@ -743,15 +743,9 @@ class WorkerMessageHandler {
|
|||
});
|
||||
|
||||
handler.on("GetStructTree", function wphGetStructTree(data) {
|
||||
const pageIndex = data.pageIndex;
|
||||
return pdfManager
|
||||
.getPage(pageIndex)
|
||||
.then(function (page) {
|
||||
return pdfManager.ensure(page, "getStructTree");
|
||||
})
|
||||
.then(function (structTree) {
|
||||
return structTree.serializable;
|
||||
});
|
||||
return pdfManager.getPage(data.pageIndex).then(function (page) {
|
||||
return pdfManager.ensure(page, "getStructTree");
|
||||
});
|
||||
});
|
||||
|
||||
handler.on("FontFallback", function (data) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue