Limit base-class initialization checks to development and TESTING modes

We have a number of base-classes that are only intended to be extended, but never to be used directly. To help enforce this during development these base-class constructors will check for direct usage, however that code is obviously not needed in the actual builds.

*Note:* This patch reduces the size of the `gulp mozcentral` output by `~2.7` kilo-bytes, which isn't a lot but still cannot hurt.
This commit is contained in:
Jonas Jenwald 2024-08-12 11:59:13 +02:00
parent aa2337f934
commit aebb8534f3
16 changed files with 79 additions and 20 deletions

View file

@ -583,7 +583,9 @@ class AppOptions {
}
constructor() {
throw new Error("Cannot initialize AppOptions.");
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
throw new Error("Cannot initialize AppOptions.");
}
}
static get(name) {