Simplify the check, and remove the warning, for the nativeImageDecoderSupport API parameter

As discussed in PR 8982.
This commit is contained in:
Jonas Jenwald 2017-10-15 18:15:37 +02:00
parent bcb29063c1
commit b5794bb26b

View File

@ -223,13 +223,9 @@ function getDocument(src) {
params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
params.ignoreErrors = params.stopAtErrors !== true; params.ignoreErrors = params.stopAtErrors !== true;
params.nativeImageDecoderSupport = params.nativeImageDecoderSupport || const nativeImageDecoderValues = Object.values(NativeImageDecoding);
NativeImageDecoding.DECODE; if (params.nativeImageDecoderSupport === undefined ||
if (params.nativeImageDecoderSupport !== NativeImageDecoding.DECODE && !nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) {
params.nativeImageDecoderSupport !== NativeImageDecoding.NONE &&
params.nativeImageDecoderSupport !== NativeImageDecoding.DISPLAY) {
warn('Invalid parameter nativeImageDecoderSupport: ' +
'need a state of enum {NativeImageDecoding}');
params.nativeImageDecoderSupport = NativeImageDecoding.DECODE; params.nativeImageDecoderSupport = NativeImageDecoding.DECODE;
} }