1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[api-minor] Remove the PDFDocumentProxy.stats getter (PR 15758 follow-up)

This was deprecated in PR 15758 and given that it's quite unlikely that any third-party users are relying on this functionality, since it was only ever added to support telemetry reporting in the Firefox PDF Viewer, it should hopefully be fine to remove this fairly quickly.

These changes reduce the bundle size of the Firefox PDF Viewer by 4.5 kB in total.
This commit is contained in:
Jonas Jenwald 2023-01-01 16:33:55 +01:00
parent 1e3e2defe4
commit 0c1fb4e740
10 changed files with 4 additions and 217 deletions

View file

@ -17,7 +17,6 @@ import {
AnnotationMode,
AnnotationType,
createPromiseCapability,
FontType,
ImageKind,
InvalidPDFException,
MissingPDFException,
@ -25,7 +24,6 @@ import {
PasswordException,
PasswordResponses,
PermissionFlag,
StreamType,
UnknownErrorException,
} from "../../src/shared/util.js";
import {
@ -1846,11 +1844,6 @@ describe("api", function () {
expect(downloadInfo).toEqual({ length: basicApiFileLength });
});
it("gets document stats", async function () {
const stats = pdfDocument.stats;
expect(stats).toEqual(null);
});
it("cleans up document resources", async function () {
await pdfDocument.cleanup();
@ -2761,24 +2754,6 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
await loadingTask.destroy();
});
it("gets document stats after parsing page", async function () {
await page.getOperatorList();
const stats = pdfDocument.stats;
const expectedStreamTypes = {
[StreamType.FLATE]: true,
};
const expectedFontTypes = {
[FontType.TYPE1STANDARD]: true,
[FontType.CIDFONTTYPE2]: true,
};
expect(stats).toEqual({
streamTypes: expectedStreamTypes,
fontTypes: expectedFontTypes,
});
});
it("gets page stats after parsing page, without `pdfBug` set", async function () {
await page.getOperatorList();
expect(page.stats).toEqual(null);

View file

@ -16,7 +16,6 @@
import { NullStream, StringStream } from "../../src/core/stream.js";
import { Page, PDFDocument } from "../../src/core/document.js";
import { assert } from "../../src/shared/util.js";
import { DocStats } from "../../src/core/core_utils.js";
import { isNodeJS } from "../../src/shared/is_node.js";
import { Ref } from "../../src/core/primitives.js";
@ -77,7 +76,6 @@ function buildGetDocumentParams(filename, options) {
class XRefMock {
constructor(array) {
this._map = Object.create(null);
this.stats = new DocStats({ send: () => {} });
this._newTemporaryRefNum = null;
this._newPersistentRefNum = null;
this.stream = new NullStream();