Report "pageInfo" telemetry once, rather than for each rendered page
Reporting telemetry, in Firefox, includes using `JSON.stringify` on the data and then sending an event to the `PdfStreamConverter.jsm`-code. In that code the event is handled and `JSON.parse` is used to retrieve the data, and in the "pageInfo"-case we'll then proceed to ignore everything except *the first* such event; see https://searchfox.org/mozilla-central/rev/24fac1ad31fb9c6e9c4c767c6a7ff45d226078f3/toolkit/components/pdfjs/content/PdfStreamConverter.jsm#509-514 All-in-all, sending the "pageInfo" telemetry for each rendered page is thus unnecessary and this patch makes the viewer send it only *once* instead.
This commit is contained in:
parent
4ee906adf4
commit
8eed0b9145
13
web/app.js
13
web/app.js
@ -1372,7 +1372,12 @@ const PDFViewerApplication = {
|
|||||||
this._initializeAutoPrint(pdfDocument, openActionPromise);
|
this._initializeAutoPrint(pdfDocument, openActionPromise);
|
||||||
});
|
});
|
||||||
|
|
||||||
onePageRendered.then(() => {
|
onePageRendered.then(data => {
|
||||||
|
this.externalServices.reportTelemetry({
|
||||||
|
type: "pageInfo",
|
||||||
|
timestamp: data.timestamp,
|
||||||
|
});
|
||||||
|
|
||||||
pdfDocument.getOutline().then(outline => {
|
pdfDocument.getOutline().then(outline => {
|
||||||
if (pdfDocument !== this.pdfDocument) {
|
if (pdfDocument !== this.pdfDocument) {
|
||||||
return; // The document was closed while the outline resolved.
|
return; // The document was closed while the outline resolved.
|
||||||
@ -2315,7 +2320,7 @@ function webViewerResetPermissions() {
|
|||||||
appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
|
appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
function webViewerPageRendered({ pageNumber, timestamp, error }) {
|
function webViewerPageRendered({ pageNumber, error }) {
|
||||||
// If the page is still visible when it has finished rendering,
|
// If the page is still visible when it has finished rendering,
|
||||||
// ensure that the page number input loading indicator is hidden.
|
// ensure that the page number input loading indicator is hidden.
|
||||||
if (pageNumber === PDFViewerApplication.page) {
|
if (pageNumber === PDFViewerApplication.page) {
|
||||||
@ -2341,10 +2346,6 @@ function webViewerPageRendered({ pageNumber, timestamp, error }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFViewerApplication.externalServices.reportTelemetry({
|
|
||||||
type: "pageInfo",
|
|
||||||
timestamp,
|
|
||||||
});
|
|
||||||
// It is a good time to report stream and font types.
|
// It is a good time to report stream and font types.
|
||||||
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
|
PDFViewerApplication.pdfDocument.getStats().then(function (stats) {
|
||||||
PDFViewerApplication.externalServices.reportTelemetry({
|
PDFViewerApplication.externalServices.reportTelemetry({
|
||||||
|
@ -554,7 +554,7 @@ class BaseViewer {
|
|||||||
if (evt.cssTransform || this._onePageRenderedCapability.settled) {
|
if (evt.cssTransform || this._onePageRenderedCapability.settled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._onePageRenderedCapability.resolve();
|
this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });
|
||||||
|
|
||||||
this.eventBus._off("pagerendered", this._onAfterDraw);
|
this.eventBus._off("pagerendered", this._onAfterDraw);
|
||||||
this._onAfterDraw = null;
|
this._onAfterDraw = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user