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 = [];
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}".`);
}

View File

@ -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,