|
@@ -3403,7 +3403,9 @@ var DOMCanvasFactory = function () {
|
|
|
_createClass(DOMCanvasFactory, [{
|
|
|
key: 'create',
|
|
|
value: function create(width, height) {
|
|
|
- (0, _util.assert)(width > 0 && height > 0, 'invalid canvas size');
|
|
|
+ if (width <= 0 || height <= 0) {
|
|
|
+ throw new Error('invalid canvas size');
|
|
|
+ }
|
|
|
var canvas = document.createElement('canvas');
|
|
|
var context = canvas.getContext('2d');
|
|
|
canvas.width = width;
|
|
@@ -3416,15 +3418,21 @@ var DOMCanvasFactory = function () {
|
|
|
}, {
|
|
|
key: 'reset',
|
|
|
value: function reset(canvasAndContext, width, height) {
|
|
|
- (0, _util.assert)(canvasAndContext.canvas, 'canvas is not specified');
|
|
|
- (0, _util.assert)(width > 0 && height > 0, 'invalid canvas size');
|
|
|
+ if (!canvasAndContext.canvas) {
|
|
|
+ throw new Error('canvas is not specified');
|
|
|
+ }
|
|
|
+ if (width <= 0 || height <= 0) {
|
|
|
+ throw new Error('invalid canvas size');
|
|
|
+ }
|
|
|
canvasAndContext.canvas.width = width;
|
|
|
canvasAndContext.canvas.height = height;
|
|
|
}
|
|
|
}, {
|
|
|
key: 'destroy',
|
|
|
value: function destroy(canvasAndContext) {
|
|
|
- (0, _util.assert)(canvasAndContext.canvas, 'canvas is not specified');
|
|
|
+ if (!canvasAndContext.canvas) {
|
|
|
+ throw new Error('canvas is not specified');
|
|
|
+ }
|
|
|
canvasAndContext.canvas.width = 0;
|
|
|
canvasAndContext.canvas.height = 0;
|
|
|
canvasAndContext.canvas = null;
|
|
@@ -13116,8 +13124,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
|
|
|
}();
|
|
|
var version, build;
|
|
|
{
|
|
|
- exports.version = version = '1.8.562';
|
|
|
- exports.build = build = '7ded895d';
|
|
|
+ exports.version = version = '1.8.564';
|
|
|
+ exports.build = build = 'e7cddcce';
|
|
|
}
|
|
|
exports.getDocument = getDocument;
|
|
|
exports.LoopbackPort = LoopbackPort;
|
|
@@ -15846,7 +15854,9 @@ var CFFParser = function CFFParserClosure() {
|
|
|
default:
|
|
|
throw new _util.FormatError('parseFDSelect: Unknown format "' + format + '".');
|
|
|
}
|
|
|
- (0, _util.assert)(fdSelect.length === length, 'parseFDSelect: Invalid font data.');
|
|
|
+ if (fdSelect.length !== length) {
|
|
|
+ throw new _util.FormatError('parseFDSelect: Invalid font data.');
|
|
|
+ }
|
|
|
return new CFFFDSelect(fdSelect, rawBytes);
|
|
|
}
|
|
|
};
|
|
@@ -16275,8 +16285,10 @@ var CFFCompiler = function CFFCompilerClosure() {
|
|
|
compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
|
|
|
for (var i = 0, ii = dicts.length; i < ii; ++i) {
|
|
|
var fontDict = dicts[i];
|
|
|
- (0, _util.assert)(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.');
|
|
|
var privateDict = fontDict.privateDict;
|
|
|
+ if (!privateDict || !fontDict.hasName('Private')) {
|
|
|
+ throw new _util.FormatError('There must be a private dictionary.');
|
|
|
+ }
|
|
|
var privateDictTracker = new CFFOffsetTracker();
|
|
|
var privateDictData = this.compileDict(privateDict, privateDictTracker);
|
|
|
var outputLength = output.length;
|
|
@@ -16481,9 +16493,13 @@ var ChunkedStream = function ChunkedStreamClosure() {
|
|
|
},
|
|
|
onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) {
|
|
|
var end = begin + chunk.byteLength;
|
|
|
- (0, _util.assert)(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin);
|
|
|
+ if (begin % this.chunkSize !== 0) {
|
|
|
+ throw new Error('Bad begin offset: ' + begin);
|
|
|
+ }
|
|
|
var length = this.bytes.length;
|
|
|
- (0, _util.assert)(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end);
|
|
|
+ if (end % this.chunkSize !== 0 && end !== length) {
|
|
|
+ throw new Error('Bad end offset: ' + end);
|
|
|
+ }
|
|
|
this.bytes.set(new Uint8Array(chunk), begin);
|
|
|
var chunkSize = this.chunkSize;
|
|
|
var beginChunk = Math.floor(begin / chunkSize);
|
|
@@ -18439,7 +18455,9 @@ var CipherTransformFactory = function CipherTransformFactoryClosure() {
|
|
|
return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
|
|
|
}
|
|
|
function buildCipherConstructor(cf, name, num, gen, key) {
|
|
|
- (0, _util.assert)((0, _primitives.isName)(name), 'Invalid crypt filter name.');
|
|
|
+ if (!(0, _primitives.isName)(name)) {
|
|
|
+ throw new _util.FormatError('Invalid crypt filter name.');
|
|
|
+ }
|
|
|
var cryptFilter = cf.get(name.name);
|
|
|
var cfm;
|
|
|
if (cryptFilter !== null && cryptFilter !== undefined) {
|
|
@@ -19056,7 +19074,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
var fontRef,
|
|
|
xref = this.xref;
|
|
|
if (font) {
|
|
|
- (0, _util.assert)((0, _primitives.isRef)(font));
|
|
|
+ if (!(0, _primitives.isRef)(font)) {
|
|
|
+ throw new Error('The "font" object should be a reference.');
|
|
|
+ }
|
|
|
fontRef = font;
|
|
|
} else {
|
|
|
var fontRes = resources.get('Font');
|
|
@@ -19192,7 +19212,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
|
|
|
resources = resources || _primitives.Dict.empty;
|
|
|
initialState = initialState || new EvalState();
|
|
|
- (0, _util.assert)(operatorList, 'getOperatorList: missing "operatorList" parameter');
|
|
|
+ if (!operatorList) {
|
|
|
+ throw new Error('getOperatorList: missing "operatorList" parameter');
|
|
|
+ }
|
|
|
var self = this;
|
|
|
var xref = this.xref;
|
|
|
var imageCache = Object.create(null);
|
|
@@ -19247,9 +19269,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
}
|
|
|
var xobj = xobjs.get(name);
|
|
|
if (xobj) {
|
|
|
- (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream');
|
|
|
+ if (!(0, _primitives.isStream)(xobj)) {
|
|
|
+ throw new _util.FormatError('XObject should be a stream');
|
|
|
+ }
|
|
|
var type = xobj.dict.get('Subtype');
|
|
|
- (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype');
|
|
|
+ if (!(0, _primitives.isName)(type)) {
|
|
|
+ throw new _util.FormatError('XObject should have a Name subtype');
|
|
|
+ }
|
|
|
if (type.name === 'Form') {
|
|
|
stateManager.save();
|
|
|
next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
|
|
@@ -19386,9 +19412,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
break;
|
|
|
case _util.OPS.shadingFill:
|
|
|
var shadingRes = resources.get('Shading');
|
|
|
- (0, _util.assert)(shadingRes, 'No shading resource found');
|
|
|
+ if (!shadingRes) {
|
|
|
+ throw new _util.FormatError('No shading resource found');
|
|
|
+ }
|
|
|
var shading = shadingRes.get(args[0].name);
|
|
|
- (0, _util.assert)(shading, 'No shading object found');
|
|
|
+ if (!shading) {
|
|
|
+ throw new _util.FormatError('No shading object found');
|
|
|
+ }
|
|
|
var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler);
|
|
|
var patternIR = shadingFill.getIR();
|
|
|
args = [patternIR];
|
|
@@ -19862,10 +19892,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
if (!xobj) {
|
|
|
break;
|
|
|
}
|
|
|
- (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream');
|
|
|
+ if (!(0, _primitives.isStream)(xobj)) {
|
|
|
+ throw new _util.FormatError('XObject should be a stream');
|
|
|
+ }
|
|
|
type = xobj.dict.get('Subtype');
|
|
|
|
|
|
- (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype');
|
|
|
+ if (!(0, _primitives.isName)(type)) {
|
|
|
+ throw new _util.FormatError('XObject should have a Name subtype');
|
|
|
+ }
|
|
|
if (type.name !== 'Form') {
|
|
|
skipEmptyXObjs[name] = true;
|
|
|
break;
|
|
@@ -20120,7 +20154,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
var cMap = properties.cMap;
|
|
|
toUnicode = [];
|
|
|
cMap.forEach(function (charcode, cid) {
|
|
|
- (0, _util.assert)(cid <= 0xffff, 'Max size of CID is 65,535');
|
|
|
+ if (cid > 0xffff) {
|
|
|
+ throw new _util.FormatError('Max size of CID is 65,535');
|
|
|
+ }
|
|
|
var ucs2 = ucs2CMap.lookup(cid);
|
|
|
if (ucs2) {
|
|
|
toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
|
|
@@ -20325,15 +20361,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
|
|
|
var baseDict = dict;
|
|
|
var type = dict.get('Subtype');
|
|
|
- (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype');
|
|
|
+ if (!(0, _primitives.isName)(type)) {
|
|
|
+ throw new _util.FormatError('invalid font Subtype');
|
|
|
+ }
|
|
|
var composite = false;
|
|
|
var uint8array;
|
|
|
if (type.name === 'Type0') {
|
|
|
var df = dict.get('DescendantFonts');
|
|
|
- (0, _util.assert)(df, 'Descendant fonts are not specified');
|
|
|
+ if (!df) {
|
|
|
+ throw new _util.FormatError('Descendant fonts are not specified');
|
|
|
+ }
|
|
|
dict = (0, _util.isArray)(df) ? this.xref.fetchIfRef(df[0]) : df;
|
|
|
type = dict.get('Subtype');
|
|
|
- (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype');
|
|
|
+ if (!(0, _primitives.isName)(type)) {
|
|
|
+ throw new _util.FormatError('invalid font Subtype');
|
|
|
+ }
|
|
|
composite = true;
|
|
|
}
|
|
|
var descriptor = dict.get('FontDescriptor');
|
|
@@ -20407,7 +20449,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
descriptor.set('FontBBox', dict.getArray('FontBBox'));
|
|
|
} else {
|
|
|
var baseFontName = dict.get('BaseFont');
|
|
|
- (0, _util.assert)((0, _primitives.isName)(baseFontName), 'Base font is not specified');
|
|
|
+ if (!(0, _primitives.isName)(baseFontName)) {
|
|
|
+ throw new _util.FormatError('Base font is not specified');
|
|
|
+ }
|
|
|
baseFontName = baseFontName.name.replace(/[,_]/g, '-');
|
|
|
var metrics = this.getBaseFontMetrics(baseFontName);
|
|
|
var fontNameWoStyle = baseFontName.split('-')[0];
|
|
@@ -20448,7 +20492,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
|
}
|
|
|
}
|
|
|
fontName = fontName || baseFont;
|
|
|
- (0, _util.assert)((0, _primitives.isName)(fontName), 'invalid font name');
|
|
|
+ if (!(0, _primitives.isName)(fontName)) {
|
|
|
+ throw new _util.FormatError('invalid font name');
|
|
|
+ }
|
|
|
var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
|
|
|
if (fontFile) {
|
|
|
if (fontFile.dict) {
|
|
@@ -20533,7 +20579,9 @@ var TranslatedFont = function TranslatedFontClosure() {
|
|
|
this.sent = true;
|
|
|
},
|
|
|
loadType3Data: function loadType3Data(evaluator, resources, parentOperatorList, task) {
|
|
|
- (0, _util.assert)(this.font.isType3Font);
|
|
|
+ if (!this.font.isType3Font) {
|
|
|
+ throw new Error('Must be a Type3 font.');
|
|
|
+ }
|
|
|
if (this.type3Loaded) {
|
|
|
return this.type3Loaded;
|
|
|
}
|
|
@@ -21246,7 +21294,9 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
|
|
|
args = [];
|
|
|
}
|
|
|
args.push(obj);
|
|
|
- (0, _util.assert)(args.length <= 33, 'Too many arguments');
|
|
|
+ if (args.length > 33) {
|
|
|
+ throw new _util.FormatError('Too many arguments');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -23543,7 +23593,9 @@ var Catalog = function CatalogClosure() {
|
|
|
this.pdfManager = pdfManager;
|
|
|
this.xref = xref;
|
|
|
this.catDict = xref.getCatalogObj();
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(this.catDict), 'catalog object is not a dictionary');
|
|
|
+ if (!(0, _primitives.isDict)(this.catDict)) {
|
|
|
+ throw new _util.FormatError('catalog object is not a dictionary');
|
|
|
+ }
|
|
|
this.fontCache = new _primitives.RefSetCache();
|
|
|
this.builtInCMapCache = Object.create(null);
|
|
|
this.pageKidsCountCache = new _primitives.RefSetCache();
|
|
@@ -23577,7 +23629,9 @@ var Catalog = function CatalogClosure() {
|
|
|
},
|
|
|
get toplevelPagesDict() {
|
|
|
var pagesObj = this.catDict.get('Pages');
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(pagesObj), 'invalid top-level pages dictionary');
|
|
|
+ if (!(0, _primitives.isDict)(pagesObj)) {
|
|
|
+ throw new _util.FormatError('invalid top-level pages dictionary');
|
|
|
+ }
|
|
|
return (0, _util.shadow)(this, 'toplevelPagesDict', pagesObj);
|
|
|
},
|
|
|
get documentOutline() {
|
|
@@ -23616,7 +23670,9 @@ var Catalog = function CatalogClosure() {
|
|
|
if (outlineDict === null) {
|
|
|
continue;
|
|
|
}
|
|
|
- (0, _util.assert)(outlineDict.has('Title'), 'Invalid outline item');
|
|
|
+ if (!outlineDict.has('Title')) {
|
|
|
+ throw new _util.FormatError('Invalid outline item');
|
|
|
+ }
|
|
|
var data = {
|
|
|
url: null,
|
|
|
dest: null
|
|
@@ -23667,7 +23723,9 @@ var Catalog = function CatalogClosure() {
|
|
|
},
|
|
|
get numPages() {
|
|
|
var obj = this.toplevelPagesDict.get('Count');
|
|
|
- (0, _util.assert)((0, _util.isInt)(obj), 'page count in top level pages object is not an integer');
|
|
|
+ if (!(0, _util.isInt)(obj)) {
|
|
|
+ throw new _util.FormatError('page count in top level pages object is not an integer');
|
|
|
+ }
|
|
|
return (0, _util.shadow)(this, 'numPages', obj);
|
|
|
},
|
|
|
get destinations() {
|
|
@@ -23755,17 +23813,27 @@ var Catalog = function CatalogClosure() {
|
|
|
for (var i = 0, ii = this.numPages; i < ii; i++) {
|
|
|
if (i in nums) {
|
|
|
var labelDict = nums[i];
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(labelDict), 'The PageLabel is not a dictionary.');
|
|
|
+ if (!(0, _primitives.isDict)(labelDict)) {
|
|
|
+ throw new _util.FormatError('The PageLabel is not a dictionary.');
|
|
|
+ }
|
|
|
var type = labelDict.get('Type');
|
|
|
- (0, _util.assert)(!type || (0, _primitives.isName)(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.');
|
|
|
+ if (type && !(0, _primitives.isName)(type, 'PageLabel')) {
|
|
|
+ throw new _util.FormatError('Invalid type in PageLabel dictionary.');
|
|
|
+ }
|
|
|
var s = labelDict.get('S');
|
|
|
- (0, _util.assert)(!s || (0, _primitives.isName)(s), 'Invalid style in PageLabel dictionary.');
|
|
|
+ if (s && !(0, _primitives.isName)(s)) {
|
|
|
+ throw new _util.FormatError('Invalid style in PageLabel dictionary.');
|
|
|
+ }
|
|
|
style = s ? s.name : null;
|
|
|
var p = labelDict.get('P');
|
|
|
- (0, _util.assert)(!p || (0, _util.isString)(p), 'Invalid prefix in PageLabel dictionary.');
|
|
|
+ if (p && !(0, _util.isString)(p)) {
|
|
|
+ throw new _util.FormatError('Invalid prefix in PageLabel dictionary.');
|
|
|
+ }
|
|
|
prefix = p ? (0, _util.stringToPDFString)(p) : '';
|
|
|
var st = labelDict.get('St');
|
|
|
- (0, _util.assert)(!st || (0, _util.isInt)(st) && st >= 1, 'Invalid start in PageLabel dictionary.');
|
|
|
+ if (st && !((0, _util.isInt)(st) && st >= 1)) {
|
|
|
+ throw new _util.FormatError('Invalid start in PageLabel dictionary.');
|
|
|
+ }
|
|
|
currentIndex = st || 1;
|
|
|
}
|
|
|
switch (style) {
|
|
@@ -23791,7 +23859,9 @@ var Catalog = function CatalogClosure() {
|
|
|
currentLabel = charBuf.join('');
|
|
|
break;
|
|
|
default:
|
|
|
- (0, _util.assert)(!style, 'Invalid style "' + style + '" in PageLabel dictionary.');
|
|
|
+ if (style) {
|
|
|
+ throw new _util.FormatError('Invalid style "' + style + '" in PageLabel dictionary.');
|
|
|
+ }
|
|
|
}
|
|
|
pageLabels[i] = prefix + currentLabel;
|
|
|
currentLabel = '';
|
|
@@ -23926,7 +23996,10 @@ var Catalog = function CatalogClosure() {
|
|
|
}, capability.reject);
|
|
|
return;
|
|
|
}
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(currentNode), 'page dictionary kid reference points to wrong type of object');
|
|
|
+ if (!(0, _primitives.isDict)(currentNode)) {
|
|
|
+ capability.reject(new _util.FormatError('page dictionary kid reference points to wrong type of object'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
count = currentNode.get('Count');
|
|
|
var objId = currentNode.objId;
|
|
|
if (objId && !pageKidsCountCache.has(objId)) {
|
|
@@ -23937,12 +24010,15 @@ var Catalog = function CatalogClosure() {
|
|
|
continue;
|
|
|
}
|
|
|
var kids = currentNode.get('Kids');
|
|
|
- (0, _util.assert)((0, _util.isArray)(kids), 'page dictionary kids object is not an array');
|
|
|
+ if (!(0, _util.isArray)(kids)) {
|
|
|
+ capability.reject(new _util.FormatError('page dictionary kids object is not an array'));
|
|
|
+ return;
|
|
|
+ }
|
|
|
for (var last = kids.length - 1; last >= 0; last--) {
|
|
|
nodesToVisit.push(kids[last]);
|
|
|
}
|
|
|
}
|
|
|
- capability.reject('Page index ' + pageIndex + ' not found.');
|
|
|
+ capability.reject(new Error('Page index ' + pageIndex + ' not found.'));
|
|
|
}
|
|
|
next();
|
|
|
return capability.promise;
|
|
@@ -23954,19 +24030,23 @@ var Catalog = function CatalogClosure() {
|
|
|
var parentRef;
|
|
|
return xref.fetchAsync(kidRef).then(function (node) {
|
|
|
if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, 'Page') && !((0, _primitives.isDict)(node) && !node.has('Type') && node.has('Contents'))) {
|
|
|
- throw new Error('The reference does not point to a /Page Dict.');
|
|
|
+ throw new _util.FormatError('The reference does not point to a /Page Dict.');
|
|
|
}
|
|
|
if (!node) {
|
|
|
return null;
|
|
|
}
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(node), 'node must be a Dict.');
|
|
|
+ if (!(0, _primitives.isDict)(node)) {
|
|
|
+ throw new _util.FormatError('node must be a Dict.');
|
|
|
+ }
|
|
|
parentRef = node.getRaw('Parent');
|
|
|
return node.getAsync('Parent');
|
|
|
}).then(function (parent) {
|
|
|
if (!parent) {
|
|
|
return null;
|
|
|
}
|
|
|
- (0, _util.assert)((0, _primitives.isDict)(parent), 'parent must be a Dict.');
|
|
|
+ if (!(0, _primitives.isDict)(parent)) {
|
|
|
+ throw new _util.FormatError('parent must be a Dict.');
|
|
|
+ }
|
|
|
return parent.getAsync('Kids');
|
|
|
}).then(function (kids) {
|
|
|
if (!kids) {
|
|
@@ -23976,7 +24056,9 @@ var Catalog = function CatalogClosure() {
|
|
|
var found = false;
|
|
|
for (var i = 0; i < kids.length; i++) {
|
|
|
var kid = kids[i];
|
|
|
- (0, _util.assert)((0, _primitives.isRef)(kid), 'kid must be a Ref.');
|
|
|
+ if (!(0, _primitives.isRef)(kid)) {
|
|
|
+ throw new _util.FormatError('kid must be a Ref.');
|
|
|
+ }
|
|
|
if (kid.num === kidRef.num) {
|
|
|
found = true;
|
|
|
break;
|
|
@@ -24519,7 +24601,9 @@ var XRef = function XRefClosure() {
|
|
|
return this.fetch(obj, suppressEncryption);
|
|
|
},
|
|
|
fetch: function XRef_fetch(ref, suppressEncryption) {
|
|
|
- (0, _util.assert)((0, _primitives.isRef)(ref), 'ref object is not a reference');
|
|
|
+ if (!(0, _primitives.isRef)(ref)) {
|
|
|
+ throw new Error('ref object is not a reference');
|
|
|
+ }
|
|
|
var num = ref.num;
|
|
|
if (num in this.cache) {
|
|
|
var cacheEntry = this.cache[num];
|
|
@@ -24675,7 +24759,9 @@ var NameOrNumberTree = function NameOrNumberTreeClosure() {
|
|
|
var kids = obj.get('Kids');
|
|
|
for (i = 0, n = kids.length; i < n; i++) {
|
|
|
var kid = kids[i];
|
|
|
- (0, _util.assert)(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.');
|
|
|
+ if (processed.has(kid)) {
|
|
|
+ throw new _util.FormatError('Duplicate entry in "' + this._type + '" tree.');
|
|
|
+ }
|
|
|
queue.push(kid);
|
|
|
processed.put(kid);
|
|
|
}
|
|
@@ -27819,7 +27905,9 @@ var WorkerMessageHandler = {
|
|
|
if (source.chunkedViewerLoading) {
|
|
|
pdfStream = new PDFWorkerStream(source, handler);
|
|
|
} else {
|
|
|
- (0, _util.assert)(PDFNetworkStream, './network module is not loaded');
|
|
|
+ if (!PDFNetworkStream) {
|
|
|
+ throw new Error('./network module is not loaded');
|
|
|
+ }
|
|
|
pdfStream = new PDFNetworkStream(data);
|
|
|
}
|
|
|
} catch (ex) {
|
|
@@ -28627,8 +28715,8 @@ if (!_util.globalScope.PDFJS) {
|
|
|
}
|
|
|
var PDFJS = _util.globalScope.PDFJS;
|
|
|
{
|
|
|
- PDFJS.version = '1.8.562';
|
|
|
- PDFJS.build = '7ded895d';
|
|
|
+ PDFJS.version = '1.8.564';
|
|
|
+ PDFJS.build = 'e7cddcce';
|
|
|
}
|
|
|
PDFJS.pdfBug = false;
|
|
|
if (PDFJS.verbosity !== undefined) {
|
|
@@ -32995,7 +33083,9 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
|
|
|
}
|
|
|
var sequence = !!(b & 0x10);
|
|
|
var dataSize = b & 15;
|
|
|
- (0, _util.assert)(dataSize + 1 <= MAX_NUM_SIZE);
|
|
|
+ if (dataSize + 1 > MAX_NUM_SIZE) {
|
|
|
+ throw new Error('processBinaryCMap: Invalid dataSize.');
|
|
|
+ }
|
|
|
var ucs2DataSize = 1;
|
|
|
var subitemsCount = stream.readNumber();
|
|
|
var i;
|
|
@@ -33336,7 +33426,9 @@ var CMapFactory = function CMapFactoryClosure() {
|
|
|
if (BUILT_IN_CMAPS.indexOf(name) === -1) {
|
|
|
return Promise.reject(new Error('Unknown CMap name: ' + name));
|
|
|
}
|
|
|
- (0, _util.assert)(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.');
|
|
|
+ if (!fetchBuiltInCMap) {
|
|
|
+ return Promise.reject(new Error('Built-in CMap parameters are not provided.'));
|
|
|
+ }
|
|
|
return fetchBuiltInCMap(name).then(function (data) {
|
|
|
var cMapData = data.cMapData,
|
|
|
compressionType = data.compressionType;
|
|
@@ -33346,9 +33438,11 @@ var CMapFactory = function CMapFactoryClosure() {
|
|
|
return extendCMap(cMap, fetchBuiltInCMap, useCMap);
|
|
|
});
|
|
|
}
|
|
|
- (0, _util.assert)(compressionType === _util.CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.');
|
|
|
- var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
|
|
|
- return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
|
|
|
+ if (compressionType === _util.CMapCompressionType.NONE) {
|
|
|
+ var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
|
|
|
+ return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
|
|
|
+ }
|
|
|
+ return Promise.reject(new Error('TODO: Only BINARY/NONE CMap compression is currently supported.'));
|
|
|
});
|
|
|
}
|
|
|
return {
|
|
@@ -33390,12 +33484,12 @@ exports.PDFDocument = exports.Page = undefined;
|
|
|
|
|
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
|
|
|
|
-var _util = __w_pdfjs_require__(0);
|
|
|
-
|
|
|
var _obj = __w_pdfjs_require__(19);
|
|
|
|
|
|
var _primitives = __w_pdfjs_require__(1);
|
|
|
|
|
|
+var _util = __w_pdfjs_require__(0);
|
|
|
+
|
|
|
var _stream = __w_pdfjs_require__(2);
|
|
|
|
|
|
var _evaluator = __w_pdfjs_require__(17);
|
|
@@ -33683,7 +33777,9 @@ var PDFDocument = function PDFDocumentClosure() {
|
|
|
} else {
|
|
|
throw new Error('PDFDocument: Unknown argument type');
|
|
|
}
|
|
|
- (0, _util.assert)(stream.length > 0, 'stream must have data');
|
|
|
+ if (stream.length <= 0) {
|
|
|
+ throw new Error('PDFDocument: stream must have data');
|
|
|
+ }
|
|
|
this.pdfManager = pdfManager;
|
|
|
this.stream = stream;
|
|
|
this.xref = new _obj.XRef(stream, pdfManager);
|
|
@@ -36331,7 +36427,9 @@ var Font = function FontClosure() {
|
|
|
var cidToGidMap = properties.cidToGidMap || [];
|
|
|
var isCidToGidMapEmpty = cidToGidMap.length === 0;
|
|
|
properties.cMap.forEach(function (charCode, cid) {
|
|
|
- (0, _util.assert)(cid <= 0xffff, 'Max size of CID is 65,535');
|
|
|
+ if (cid > 0xffff) {
|
|
|
+ throw new _util.FormatError('Max size of CID is 65,535');
|
|
|
+ }
|
|
|
var glyphId = -1;
|
|
|
if (isCidToGidMapEmpty) {
|
|
|
glyphId = cid;
|
|
@@ -43388,7 +43486,9 @@ Shadings.Mesh = function MeshClosure() {
|
|
|
var coord = reader.readCoordinate();
|
|
|
var color = reader.readComponents();
|
|
|
if (verticesLeft === 0) {
|
|
|
- (0, _util.assert)(0 <= f && f <= 2, 'Unknown type4 flag');
|
|
|
+ if (!(0 <= f && f <= 2)) {
|
|
|
+ throw new _util.FormatError('Unknown type4 flag');
|
|
|
+ }
|
|
|
switch (f) {
|
|
|
case 0:
|
|
|
verticesLeft = 3;
|
|
@@ -43535,7 +43635,9 @@ Shadings.Mesh = function MeshClosure() {
|
|
|
var cs = new Int32Array(4);
|
|
|
while (reader.hasData) {
|
|
|
var f = reader.readFlag();
|
|
|
- (0, _util.assert)(0 <= f && f <= 3, 'Unknown type6 flag');
|
|
|
+ if (!(0 <= f && f <= 3)) {
|
|
|
+ throw new _util.FormatError('Unknown type6 flag');
|
|
|
+ }
|
|
|
var i, ii;
|
|
|
var pi = coords.length;
|
|
|
for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
|
|
@@ -43651,7 +43753,9 @@ Shadings.Mesh = function MeshClosure() {
|
|
|
var cs = new Int32Array(4);
|
|
|
while (reader.hasData) {
|
|
|
var f = reader.readFlag();
|
|
|
- (0, _util.assert)(0 <= f && f <= 3, 'Unknown type7 flag');
|
|
|
+ if (!(0 <= f && f <= 3)) {
|
|
|
+ throw new _util.FormatError('Unknown type7 flag');
|
|
|
+ }
|
|
|
var i, ii;
|
|
|
var pi = coords.length;
|
|
|
for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
|
|
@@ -43814,7 +43918,9 @@ Shadings.Mesh = function MeshClosure() {
|
|
|
}
|
|
|
}
|
|
|
function Mesh(stream, matrix, xref, res) {
|
|
|
- (0, _util.assert)((0, _primitives.isStream)(stream), 'Mesh data is not a stream');
|
|
|
+ if (!(0, _primitives.isStream)(stream)) {
|
|
|
+ throw new _util.FormatError('Mesh data is not a stream');
|
|
|
+ }
|
|
|
var dict = stream.dict;
|
|
|
this.matrix = matrix;
|
|
|
this.shadingType = dict.get('ShadingType');
|
|
@@ -43846,7 +43952,9 @@ Shadings.Mesh = function MeshClosure() {
|
|
|
break;
|
|
|
case ShadingType.LATTICE_FORM_MESH:
|
|
|
var verticesPerRow = dict.get('VerticesPerRow') | 0;
|
|
|
- (0, _util.assert)(verticesPerRow >= 2, 'Invalid VerticesPerRow');
|
|
|
+ if (verticesPerRow < 2) {
|
|
|
+ throw new _util.FormatError('Invalid VerticesPerRow');
|
|
|
+ }
|
|
|
decodeType5Shading(this, reader, verticesPerRow);
|
|
|
break;
|
|
|
case ShadingType.COONS_PATCH_MESH:
|
|
@@ -46228,7 +46336,9 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
|
|
|
if (group.matrix) {
|
|
|
currentCtx.transform.apply(currentCtx, group.matrix);
|
|
|
}
|
|
|
- (0, _util.assert)(group.bbox, 'Bounding box is required.');
|
|
|
+ if (!group.bbox) {
|
|
|
+ throw new Error('Bounding box is required.');
|
|
|
+ }
|
|
|
var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform);
|
|
|
var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
|
|
|
bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
|
|
@@ -47256,8 +47366,8 @@ exports.TilingPattern = TilingPattern;
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
-var pdfjsVersion = '1.8.562';
|
|
|
-var pdfjsBuild = '7ded895d';
|
|
|
+var pdfjsVersion = '1.8.564';
|
|
|
+var pdfjsBuild = 'e7cddcce';
|
|
|
var pdfjsSharedUtil = __w_pdfjs_require__(0);
|
|
|
var pdfjsDisplayGlobal = __w_pdfjs_require__(25);
|
|
|
var pdfjsDisplayAPI = __w_pdfjs_require__(10);
|