mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +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:
parent
1e3e2defe4
commit
0c1fb4e740
10 changed files with 4 additions and 217 deletions
|
@ -17,9 +17,7 @@ import {
|
|||
AnnotationEditorPrefix,
|
||||
assert,
|
||||
BaseException,
|
||||
FontType,
|
||||
objectSize,
|
||||
StreamType,
|
||||
stringToPDFString,
|
||||
warn,
|
||||
} from "../shared/util.js";
|
||||
|
@ -82,55 +80,6 @@ class XRefParseException extends BaseException {
|
|||
}
|
||||
}
|
||||
|
||||
class DocStats {
|
||||
constructor(handler) {
|
||||
this._handler = handler;
|
||||
|
||||
this._streamTypes = new Set();
|
||||
this._fontTypes = new Set();
|
||||
}
|
||||
|
||||
_send() {
|
||||
const streamTypes = Object.create(null),
|
||||
fontTypes = Object.create(null);
|
||||
for (const type of this._streamTypes) {
|
||||
streamTypes[type] = true;
|
||||
}
|
||||
for (const type of this._fontTypes) {
|
||||
fontTypes[type] = true;
|
||||
}
|
||||
this._handler.send("DocStats", { streamTypes, fontTypes });
|
||||
}
|
||||
|
||||
addStreamType(type) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
assert(StreamType[type] === type, 'addStreamType: Invalid "type" value.');
|
||||
}
|
||||
if (this._streamTypes.has(type)) {
|
||||
return;
|
||||
}
|
||||
this._streamTypes.add(type);
|
||||
this._send();
|
||||
}
|
||||
|
||||
addFontType(type) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
assert(FontType[type] === type, 'addFontType: Invalid "type" value.');
|
||||
}
|
||||
if (this._fontTypes.has(type)) {
|
||||
return;
|
||||
}
|
||||
this._fontTypes.add(type);
|
||||
this._send();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of an inheritable property.
|
||||
*
|
||||
|
@ -631,7 +580,6 @@ function getRotationMatrix(rotation, width, height) {
|
|||
|
||||
export {
|
||||
collectActions,
|
||||
DocStats,
|
||||
encodeToXmlString,
|
||||
escapePDFName,
|
||||
escapeString,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue