Merge pull request #16122 from Snuffleupagus/rm-onUnsupportedFeature

[api-minor] Remove the deprecated `onUnsupportedFeature` functionality (PR 15758 follow-up)
This commit is contained in:
Jonas Jenwald 2023-03-08 12:16:27 +01:00 committed by GitHub
commit e5427ab11b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 5 additions and 201 deletions

View file

@ -28,7 +28,6 @@ import {
shadow,
stringToPDFString,
TextRenderingMode,
UNSUPPORTED_FEATURES,
Util,
warn,
} from "../shared/util.js";
@ -948,13 +947,6 @@ class PartialEvaluator {
return;
}
if (this.options.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error(s) in the TilingPattern -- sending unsupported feature
// notification and allow rendering to continue.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorTilingPattern,
});
}
warn(`handleTilingType - ignoring pattern: "${reason}".`);
return;
}
@ -996,13 +988,6 @@ class PartialEvaluator {
return translated;
})
.catch(reason => {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error in the font data -- sending unsupported feature
// notification.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontLoadType3,
});
}
return new TranslatedFont({
loadedName: "g_font_error",
font: new ErrorFont(`Type3 font load error: ${reason}`),
@ -1052,13 +1037,6 @@ class PartialEvaluator {
);
if (this.options.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Missing setFont operator before text rendering operator -- sending
// unsupported feature notification and allow rendering to continue.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontState,
});
}
warn(`ensureStateFont: "${reason}".`);
return;
}
@ -1216,12 +1194,6 @@ class PartialEvaluator {
warn(`${partialMsg}.`);
return errorFont();
}
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Font not found -- sending unsupported feature notification.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontMissing,
});
}
warn(`${partialMsg} -- attempting to fallback to a default font.`);
// Falling back to a default font to avoid completely broken rendering,
@ -1340,12 +1312,6 @@ class PartialEvaluator {
})
.catch(reason => {
// TODO fontCapability.reject?
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error in the font data -- sending unsupported feature notification.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontTranslate,
});
}
warn(`loadFont - translateFont failed: "${reason}".`);
fontCapability.resolve(
@ -1451,13 +1417,6 @@ class PartialEvaluator {
return null;
}
if (this.options.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error(s) in the ColorSpace -- sending unsupported feature
// notification and allow rendering to continue.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorColorSpace,
});
}
warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
return null;
}
@ -1479,7 +1438,6 @@ class PartialEvaluator {
shading,
this.xref,
resources,
this.handler,
this._pdfFunctionFactory,
localColorSpaceCache
);
@ -1842,16 +1800,6 @@ class PartialEvaluator {
return;
}
if (self.options.ignoreErrors) {
if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("GENERIC")
) {
// Error(s) in the XObject -- sending unsupported feature
// notification and allow rendering to continue.
self.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorXObject,
});
}
warn(`getOperatorList - ignoring XObject: "${reason}".`);
return;
}
@ -2166,16 +2114,6 @@ class PartialEvaluator {
return;
}
if (self.options.ignoreErrors) {
if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("GENERIC")
) {
// Error(s) in the ExtGState -- sending unsupported feature
// notification and allow parsing/rendering to continue.
self.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorExtGState,
});
}
warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
return;
}
@ -2223,14 +2161,6 @@ class PartialEvaluator {
return;
}
if (self.options.ignoreErrors) {
if (
typeof PDFJSDev === "undefined" ||
PDFJSDev.test("GENERIC")
) {
self.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorMarkedContent,
});
}
warn(
`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`
);
@ -2281,13 +2211,6 @@ class PartialEvaluator {
return;
}
if (this.options.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error(s) in the OperatorList -- sending unsupported feature
// notification and allow rendering to continue.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorOperatorList,
});
}
warn(
`getOperatorList - ignoring errors during "${task.name}" ` +
`task: "${reason}".`
@ -3778,13 +3701,6 @@ class PartialEvaluator {
return null;
}
if (this.options.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error in the ToUnicode data -- sending unsupported feature
// notification and allow font parsing to continue.
this.handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontToUnicode,
});
}
warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
return null;
}
@ -4358,13 +4274,6 @@ class PartialEvaluator {
]);
} catch (reason) {
if (evaluatorOptions.ignoreErrors) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
// Error in the font data -- sending unsupported feature
// notification and allow glyph path building to continue.
handler.send("UnsupportedFeature", {
featureId: UNSUPPORTED_FEATURES.errorFontBuildPath,
});
}
warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
return;
}