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

Removes error()

This commit is contained in:
Yury Delendik 2017-06-28 13:51:31 -07:00
parent ac9802809c
commit d028c26210
24 changed files with 318 additions and 260 deletions

View file

@ -14,8 +14,8 @@
*/
import {
assert, bytesToString, error, isInt, PasswordException, PasswordResponses,
stringToBytes, utf8StringToString, warn
assert, bytesToString, FormatError, isInt, PasswordException,
PasswordResponses, stringToBytes, utf8StringToString, warn
} from '../shared/util';
import { isDict, isName, Name } from './primitives';
import { DecryptStream } from './stream';
@ -1858,14 +1858,14 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
function CipherTransformFactory(dict, fileId, password) {
var filter = dict.get('Filter');
if (!isName(filter, 'Standard')) {
error('unknown encryption method');
throw new FormatError('unknown encryption method');
}
this.dict = dict;
var algorithm = dict.get('V');
if (!isInt(algorithm) ||
(algorithm !== 1 && algorithm !== 2 && algorithm !== 4 &&
algorithm !== 5)) {
error('unsupported encryption algorithm');
throw new FormatError('unsupported encryption algorithm');
}
this.algorithm = algorithm;
var keyLength = dict.get('Length');
@ -1892,7 +1892,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
}
if (!isInt(keyLength) ||
keyLength < 40 || (keyLength % 8) !== 0) {
error('invalid key length');
throw new FormatError('invalid key length');
}
// prepare keys
@ -2023,7 +2023,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
return new AES256Cipher(key);
};
}
error('Unknown crypto method');
throw new FormatError('Unknown crypto method');
}
CipherTransformFactory.prototype = {