mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Stop using the PRODUCTION
build-target in the JavaScript code
This *special* build-target is very old, and was introduced with the first pre-processor that only uses comments to enable/disable code. When the new pre-processor was added `PRODUCTION` effectively became redundant, at least in JavaScript code, since `typeof PDFJSDev === "undefined"` checks now do the same thing. This patch proposes that we remove `PRODUCTION` from the JavaScript code, since that simplifies the conditions and thus improves readability in many cases. *Please note:* There's not, nor has there ever been, any gulp-task that set `PRODUCTION = false` during building.
This commit is contained in:
parent
3e08eee511
commit
804aa896a7
29 changed files with 88 additions and 267 deletions
|
@ -797,10 +797,7 @@ class Annotation {
|
|||
* @param {Dict} borderStyle - The border style dictionary
|
||||
*/
|
||||
setBorderStyle(borderStyle) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(this.rectangle, "setRectangle must have been called previously.");
|
||||
}
|
||||
|
||||
|
@ -1062,8 +1059,7 @@ class Annotation {
|
|||
*/
|
||||
reset() {
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")) &&
|
||||
(typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) &&
|
||||
this.appearance &&
|
||||
!this._streams.includes(this.appearance)
|
||||
) {
|
||||
|
@ -1161,10 +1157,7 @@ class AnnotationBorderStyle {
|
|||
* @param {Array} rect - The annotation `Rect` entry.
|
||||
*/
|
||||
setWidth(width, rect = [0, 0, 0, 0]) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(
|
||||
Array.isArray(rect) && rect.length === 4,
|
||||
"A valid `rect` parameter must be provided."
|
||||
|
@ -2381,10 +2374,7 @@ class WidgetAnnotation extends Annotation {
|
|||
* @private
|
||||
*/
|
||||
_getSaveFieldResources(xref) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(
|
||||
this.data.defaultAppearanceData,
|
||||
"Expected `_defaultAppearanceData` to have been set."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue