mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Merge pull request #13234 from Snuffleupagus/hasJSActions-MissingDataException
[api-minor] Ensure that `PDFDocumentProxy.hasJSActions` won't fail if `MissingDataException`s are thrown during the associated worker-thread parsing
This commit is contained in:
commit
ebeb3f7999
3 changed files with 48 additions and 27 deletions
|
@ -523,7 +523,6 @@ class Page {
|
|||
this.pageDict,
|
||||
PageActionEventType
|
||||
);
|
||||
|
||||
return shadow(this, "jsActions", actions);
|
||||
}
|
||||
}
|
||||
|
@ -1189,19 +1188,28 @@ class PDFDocument {
|
|||
}
|
||||
|
||||
get hasJSActions() {
|
||||
return shadow(
|
||||
this,
|
||||
"hasJSActions",
|
||||
this.fieldObjects.then(fieldObjects => {
|
||||
return (
|
||||
(fieldObjects !== null &&
|
||||
Object.values(fieldObjects).some(fieldObject =>
|
||||
fieldObject.some(object => object.actions !== null)
|
||||
)) ||
|
||||
!!this.catalog.jsActions
|
||||
);
|
||||
})
|
||||
);
|
||||
const promise = this.pdfManager.ensure(this, "_parseHasJSActions");
|
||||
return shadow(this, "hasJSActions", promise);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
async _parseHasJSActions() {
|
||||
const [catalogJsActions, fieldObjects] = await Promise.all([
|
||||
this.pdfManager.ensureCatalog("jsActions"),
|
||||
this.pdfManager.ensure(this, "fieldObjects"),
|
||||
]);
|
||||
|
||||
if (catalogJsActions) {
|
||||
return true;
|
||||
}
|
||||
if (fieldObjects) {
|
||||
return Object.values(fieldObjects).some(fieldObject =>
|
||||
fieldObject.some(object => object.actions !== null)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
get calculationOrderIds() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue