Merge pull request #11112 from Snuffleupagus/TESTING-rm-version-warn

Remove the API/Worker version warning message in `TESTING` mode
This commit is contained in:
Tim van der Meij 2019-09-02 22:22:33 +02:00 committed by GitHub
commit c37a2c0408
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -109,13 +109,11 @@ var WorkerMessageHandler = {
var WorkerTasks = []; var WorkerTasks = [];
const verbosity = getVerbosityLevel(); const verbosity = getVerbosityLevel();
let apiVersion = docParams.apiVersion; const apiVersion = docParams.apiVersion;
let workerVersion = const workerVersion =
typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : null; typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('TESTING') ?
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('TESTING')) && PDFJSDev.eval('BUNDLE_VERSION') : null;
apiVersion === null) { if (apiVersion !== workerVersion) {
warn('Ignoring apiVersion/workerVersion check in TESTING builds.');
} else if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + throw new Error(`The API version "${apiVersion}" does not match ` +
`the Worker version "${workerVersion}".`); `the Worker version "${workerVersion}".`);
} }

View File

@ -395,8 +395,8 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
} }
return worker.messageHandler.sendWithPromise('GetDocRequest', { return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId, docId,
apiVersion: (typeof PDFJSDev !== 'undefined' ? apiVersion: typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('TESTING') ?
PDFJSDev.eval('BUNDLE_VERSION') : null), PDFJSDev.eval('BUNDLE_VERSION') : null,
source: { // Only send the required properties, and *not* the entire object. source: { // Only send the required properties, and *not* the entire object.
data: source.data, data: source.data,
url: source.url, url: source.url,