mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-23 16:35:47 +02:00
Remove unneeded check in the "GetAnnotationsByType" worker-thread handler
Given that the Promise returned by the `PDFDocument.prototype.getPage` method *always* resolves with a `Page` instance, checking that the page is defined isn't necessary; note 3a09329113/src/core/document.js (L1702-L1723)
Furthermore the `Page.prototype.collectAnnotationsByType` method is asynchronous, and thus it always returns a Promise, hence it's "pointless" to fallback to return an empty Array.
This commit is contained in:
parent
3a09329113
commit
d9e4cc5f65
@ -510,20 +510,17 @@ class WorkerMessageHandler {
|
|||||||
startWorkerTask(task);
|
startWorkerTask(task);
|
||||||
}
|
}
|
||||||
pagePromises.push(
|
pagePromises.push(
|
||||||
pdfManager.getPage(i).then(async page => {
|
pdfManager
|
||||||
if (!page) {
|
.getPage(i)
|
||||||
return [];
|
.then(page =>
|
||||||
}
|
|
||||||
return (
|
|
||||||
page.collectAnnotationsByType(
|
page.collectAnnotationsByType(
|
||||||
handler,
|
handler,
|
||||||
task,
|
task,
|
||||||
types,
|
types,
|
||||||
annotationPromises,
|
annotationPromises,
|
||||||
annotationGlobals
|
annotationGlobals
|
||||||
) || []
|
)
|
||||||
);
|
)
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await Promise.all(pagePromises);
|
await Promise.all(pagePromises);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user