From 229f6f34d1aff09c27e8d5a5b902069abb72ce05 Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Sun, 1 Sep 2019 16:43:58 +0200
Subject: [PATCH] Remove the API/Worker version warning message in `TESTING`
 mode

The warning messages turn out to be more annoying than helpful when looking at the `console` during tests, so let's just remove them.
---
 src/core/worker.js | 12 +++++-------
 src/display/api.js |  4 ++--
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/core/worker.js b/src/core/worker.js
index 6c74352b3..4da105f89 100644
--- a/src/core/worker.js
+++ b/src/core/worker.js
@@ -109,13 +109,11 @@ var WorkerMessageHandler = {
     var WorkerTasks = [];
     const verbosity = getVerbosityLevel();
 
-    let apiVersion = docParams.apiVersion;
-    let workerVersion =
-      typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : null;
-    if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('TESTING')) &&
-        apiVersion === null) {
-      warn('Ignoring apiVersion/workerVersion check in TESTING builds.');
-    } else if (apiVersion !== workerVersion) {
+    const apiVersion = docParams.apiVersion;
+    const workerVersion =
+      typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('TESTING') ?
+      PDFJSDev.eval('BUNDLE_VERSION') : null;
+    if (apiVersion !== workerVersion) {
       throw new Error(`The API version "${apiVersion}" does not match ` +
                       `the Worker version "${workerVersion}".`);
     }
diff --git a/src/display/api.js b/src/display/api.js
index 03f7d101c..a964d52ff 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -395,8 +395,8 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
   }
   return worker.messageHandler.sendWithPromise('GetDocRequest', {
     docId,
-    apiVersion: (typeof PDFJSDev !== 'undefined' ?
-                 PDFJSDev.eval('BUNDLE_VERSION') : null),
+    apiVersion: typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('TESTING') ?
+                PDFJSDev.eval('BUNDLE_VERSION') : null,
     source: { // Only send the required properties, and *not* the entire object.
       data: source.data,
       url: source.url,