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:
commit
e5485108ec
2 changed files with 9 additions and 3 deletions
|
@ -707,7 +707,7 @@ class Page {
|
|||
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
|
||||
structTreeRoot,
|
||||
]);
|
||||
return structTree.serializable;
|
||||
return this.pdfManager.ensure(structTree, "serializable");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue