mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +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
|
@ -698,10 +698,7 @@ const EMPTY_FINGERPRINT =
|
|||
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
|
||||
function find(stream, signature, limit = 1024, backwards = false) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(limit > 0, 'The "limit" must be a positive integer.');
|
||||
}
|
||||
const signatureLength = signature.length;
|
||||
|
@ -755,10 +752,7 @@ function find(stream, signature, limit = 1024, backwards = false) {
|
|||
*/
|
||||
class PDFDocument {
|
||||
constructor(pdfManager, stream) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(
|
||||
stream instanceof BaseStream,
|
||||
'PDFDocument: Invalid "stream" argument.'
|
||||
|
@ -1419,10 +1413,7 @@ class PDFDocument {
|
|||
|
||||
async _getLinearizationPage(pageIndex) {
|
||||
const { catalog, linearization, xref } = this;
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(
|
||||
linearization && linearization.pageFirst === pageIndex,
|
||||
"_getLinearizationPage - invalid pageIndex argument."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue