From b5794bb26b76a0cc3c87b10979e5477514999095 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 15 Oct 2017 18:15:37 +0200 Subject: [PATCH] Simplify the check, and remove the warning, for the `nativeImageDecoderSupport` API parameter As discussed in PR 8982. --- src/display/api.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 0f2fdf01a..f8baabe32 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -223,13 +223,9 @@ function getDocument(src) { params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.ignoreErrors = params.stopAtErrors !== true; - params.nativeImageDecoderSupport = params.nativeImageDecoderSupport || - NativeImageDecoding.DECODE; - if (params.nativeImageDecoderSupport !== NativeImageDecoding.DECODE && - params.nativeImageDecoderSupport !== NativeImageDecoding.NONE && - params.nativeImageDecoderSupport !== NativeImageDecoding.DISPLAY) { - warn('Invalid parameter nativeImageDecoderSupport: ' + - 'need a state of enum {NativeImageDecoding}'); + const nativeImageDecoderValues = Object.values(NativeImageDecoding); + if (params.nativeImageDecoderSupport === undefined || + !nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) { params.nativeImageDecoderSupport = NativeImageDecoding.DECODE; }