Merge pull request #20405 from calixteman/add_telemetry_tagged_pdf
Add telemetry for tagged pdfs (bug 1997134)
This commit is contained in:
commit
b20bd9061e
@ -267,6 +267,10 @@ class Catalog {
|
|||||||
return markInfo;
|
return markInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hasStructTree() {
|
||||||
|
return this.#catDict.has("StructTreeRoot");
|
||||||
|
}
|
||||||
|
|
||||||
get structTreeRoot() {
|
get structTreeRoot() {
|
||||||
let structTree = null;
|
let structTree = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -515,6 +515,7 @@ class WorkerMessageHandler {
|
|||||||
return Promise.all([
|
return Promise.all([
|
||||||
pdfManager.ensureDoc("documentInfo"),
|
pdfManager.ensureDoc("documentInfo"),
|
||||||
pdfManager.ensureCatalog("metadata"),
|
pdfManager.ensureCatalog("metadata"),
|
||||||
|
pdfManager.ensureCatalog("hasStructTree"),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -3077,6 +3077,7 @@ class WorkerTransport {
|
|||||||
metadata: results[1] ? new Metadata(results[1]) : null,
|
metadata: results[1] ? new Metadata(results[1]) : null,
|
||||||
contentDispositionFilename: this._fullReader?.filename ?? null,
|
contentDispositionFilename: this._fullReader?.filename ?? null,
|
||||||
contentLength: this._fullReader?.contentLength ?? null,
|
contentLength: this._fullReader?.contentLength ?? null,
|
||||||
|
hasStructTree: results[2],
|
||||||
}));
|
}));
|
||||||
this.#methodPromises.set(name, promise);
|
this.#methodPromises.set(name, promise);
|
||||||
return promise;
|
return promise;
|
||||||
|
|||||||
13
web/app.js
13
web/app.js
@ -1719,12 +1719,21 @@ const PDFViewerApplication = {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
async _initializeMetadata(pdfDocument) {
|
async _initializeMetadata(pdfDocument) {
|
||||||
const { info, metadata, contentDispositionFilename, contentLength } =
|
const {
|
||||||
await pdfDocument.getMetadata();
|
info,
|
||||||
|
metadata,
|
||||||
|
contentDispositionFilename,
|
||||||
|
contentLength,
|
||||||
|
hasStructTree,
|
||||||
|
} = await pdfDocument.getMetadata();
|
||||||
|
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
return; // The document was closed while the metadata resolved.
|
return; // The document was closed while the metadata resolved.
|
||||||
}
|
}
|
||||||
|
this.externalServices.reportTelemetry({
|
||||||
|
type: "taggedPDF",
|
||||||
|
data: hasStructTree,
|
||||||
|
});
|
||||||
this.documentInfo = info;
|
this.documentInfo = info;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this._contentDispositionFilename ??= contentDispositionFilename;
|
this._contentDispositionFilename ??= contentDispositionFilename;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user