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
@ -707,7 +707,7 @@ class Page {
|
|||||||
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
|
const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [
|
||||||
structTreeRoot,
|
structTreeRoot,
|
||||||
]);
|
]);
|
||||||
return structTree.serializable;
|
return this.pdfManager.ensure(structTree, "serializable");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -112,8 +112,14 @@ class StructTreeLayerBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAriaAttributes(annotationId) {
|
async getAriaAttributes(annotationId) {
|
||||||
await this.render();
|
try {
|
||||||
return this.#elementAttributes.get(annotationId);
|
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() {
|
hide() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user