1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

Merge pull request #18990 from Snuffleupagus/ensure-structTree-serializable

Ensure that serializing of StructTree-data cannot fail during loading
This commit is contained in:
Jonas Jenwald 2024-11-02 15:17:10 +01:00 committed by GitHub
commit e5485108ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -707,7 +707,7 @@ class Page {
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
structTreeRoot,
]);
return structTree.serializable;
return this.pdfManager.ensure(structTree, "serializable");
}
/**

View file

@ -112,8 +112,14 @@ class StructTreeLayerBuilder {
}
async getAriaAttributes(annotationId) {
await this.render();
return this.#elementAttributes.get(annotationId);
try {
await this.render();
return this.#elementAttributes.get(annotationId);
} catch {
// If the structTree cannot be fetched, parsed, and/or rendered,
// ensure that e.g. the AnnotationLayer won't break completely.
}
return null;
}
hide() {