1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Replace the isInt helper function with the native Number.isInteger function

*Follow-up to PR 8643.*
This commit is contained in:
Jonas Jenwald 2017-09-01 16:52:50 +02:00
parent 066fea9c8b
commit 11408da340
12 changed files with 65 additions and 72 deletions

View file

@ -14,7 +14,7 @@
*/
import {
bytesToString, FormatError, isInt, PasswordException, PasswordResponses,
bytesToString, FormatError, PasswordException, PasswordResponses,
stringToBytes, utf8StringToString, warn
} from '../shared/util';
import { isDict, isName, Name } from './primitives';
@ -1862,9 +1862,9 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
}
this.dict = dict;
var algorithm = dict.get('V');
if (!isInt(algorithm) ||
if (!Number.isInteger(algorithm) ||
(algorithm !== 1 && algorithm !== 2 && algorithm !== 4 &&
algorithm !== 5)) {
algorithm !== 5)) {
throw new FormatError('unsupported encryption algorithm');
}
this.algorithm = algorithm;
@ -1890,7 +1890,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
}
}
}
if (!isInt(keyLength) ||
if (!Number.isInteger(keyLength) ||
keyLength < 40 || (keyLength % 8) !== 0) {
throw new FormatError('invalid key length');
}