[GeckoView] Avoid unused outline, attachments, and layers fetching
Currently there's no UI for this functionality in the GV-viewer, however we still call the API methods. This potentially leads to a bunch of worker-thread parsing, for PDF documents with these features, despite the result being completely unused. Given that mobile devices are usually more resource constrained than desktop/laptop computers, not to mentioned battery life, we can avoid doing work that'll just be ignored anyway.
This commit is contained in:
parent
05d821e680
commit
0cf4fbd471
46
web/app.js
46
web/app.js
@ -1336,26 +1336,32 @@ const PDFViewerApplication = {
|
|||||||
timestamp: data.timestamp,
|
timestamp: data.timestamp,
|
||||||
});
|
});
|
||||||
|
|
||||||
pdfDocument.getOutline().then(outline => {
|
if (this.pdfOutlineViewer) {
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
pdfDocument.getOutline().then(outline => {
|
||||||
return; // The document was closed while the outline resolved.
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
}
|
return; // The document was closed while the outline resolved.
|
||||||
this.pdfOutlineViewer?.render({ outline, pdfDocument });
|
}
|
||||||
});
|
this.pdfOutlineViewer.render({ outline, pdfDocument });
|
||||||
pdfDocument.getAttachments().then(attachments => {
|
});
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
}
|
||||||
return; // The document was closed while the attachments resolved.
|
if (this.pdfAttachmentViewer) {
|
||||||
}
|
pdfDocument.getAttachments().then(attachments => {
|
||||||
this.pdfAttachmentViewer?.render({ attachments });
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
});
|
return; // The document was closed while the attachments resolved.
|
||||||
// Ensure that the layers accurately reflects the current state in the
|
}
|
||||||
// viewer itself, rather than the default state provided by the API.
|
this.pdfAttachmentViewer.render({ attachments });
|
||||||
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
|
});
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
}
|
||||||
return; // The document was closed while the layers resolved.
|
if (this.pdfLayerViewer) {
|
||||||
}
|
// Ensure that the layers accurately reflects the current state in the
|
||||||
this.pdfLayerViewer?.render({ optionalContentConfig, pdfDocument });
|
// viewer itself, rather than the default state provided by the API.
|
||||||
});
|
pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {
|
||||||
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
|
return; // The document was closed while the layers resolved.
|
||||||
|
}
|
||||||
|
this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._initializePageLabels(pdfDocument);
|
this._initializePageLabels(pdfDocument);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user