Exclude lineEndings, in Annotation-data, in MOZCENTRAL builds (PR 14899 follow-up)

This was added in PR 14899, over a year ago, however it's still completely unused in the PDF.js library/viewer. In hindsight I think that it was a mistake to add unused functionality, and the issue should probably have been WONTFIXed instead, however we probably can't just remove it now.
Thanks to the pre-processor, we can at least exclude this code in the *built-in* Firefox PDF Viewer.
This commit is contained in:
Jonas Jenwald 2023-08-21 10:07:25 +02:00
parent a7d829155b
commit cd181eb746

View File

@ -848,6 +848,9 @@ class Annotation {
* @param {Array} lineEndings - The line endings array.
*/
setLineEndings(lineEndings) {
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
throw new Error("Not implemented: setLineEndings");
}
this.lineEndings = ["None", "None"]; // The default values.
if (Array.isArray(lineEndings) && lineEndings.length === 2) {
@ -3937,8 +3940,10 @@ class LineAnnotation extends MarkupAnnotation {
const lineCoordinates = dict.getArray("L");
this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
this.setLineEndings(dict.getArray("LE"));
this.data.lineEndings = this.lineEndings;
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
this.setLineEndings(dict.getArray("LE"));
this.data.lineEndings = this.lineEndings;
}
if (!this.appearance) {
// The default stroke color is black.
@ -4112,7 +4117,10 @@ class PolylineAnnotation extends MarkupAnnotation {
this.data.hasOwnCanvas = this.data.noRotate;
this.data.vertices = [];
if (!(this instanceof PolygonAnnotation)) {
if (
(typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) &&
!(this instanceof PolygonAnnotation)
) {
// Only meaningful for polyline annotations.
this.setLineEndings(dict.getArray("LE"));
this.data.lineEndings = this.lineEndings;