Browse Source

PDF.js version 2.0.288 - See mozilla/pdf.js@f0216484bcb09d50730101d74a227bd0dcd44a87

master v2.0.288
pdfjsbot 7 years ago
parent
commit
a66228d4dd
  1. 2
      bower.json
  2. 357
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 355
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 2
      build/pdf.min.js
  7. 6
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 2
      build/pdf.worker.min.js
  10. 2
      lib/core/worker.js
  11. 6
      lib/display/api.js
  12. 168
      lib/display/content_disposition.js
  13. 4
      lib/display/global.js
  14. 8
      lib/display/network_utils.js
  15. 4
      lib/pdf.js
  16. 4
      lib/pdf.worker.js
  17. 36
      lib/test/unit/network_utils_spec.js
  18. 2
      package.json

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.285",
"version": "2.0.288",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

357
build/pdf.combined.js

@ -2706,8 +2706,8 @@ if (typeof __g == 'number') __g = global; @@ -2706,8 +2706,8 @@ if (typeof __g == 'number') __g = global;
var global = __w_pdfjs_require__(5);
var core = __w_pdfjs_require__(7);
var hide = __w_pdfjs_require__(13);
var redefine = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var redefine = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(11);
var PROTOTYPE = 'prototype';
var $export = function $export(type, name, source) {
var IS_FORCED = type & $export.F;
@ -2782,6 +2782,72 @@ module.exports = function (it, key) { @@ -2782,6 +2782,72 @@ module.exports = function (it, key) {
"use strict";
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var SRC = __w_pdfjs_require__(25)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(7).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(18);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 12 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -3288,72 +3354,6 @@ exports.SimpleXMLParser = SimpleXMLParser; @@ -3288,72 +3354,6 @@ exports.SimpleXMLParser = SimpleXMLParser;
exports.StatTimer = StatTimer;
exports.DummyStatTimer = DummyStatTimer;
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var SRC = __w_pdfjs_require__(25)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(7).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 12 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(18);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __w_pdfjs_require__) {
@ -4516,7 +4516,7 @@ module.exports = function (it, tag, stat) { @@ -4516,7 +4516,7 @@ module.exports = function (it, tag, stat) {
"use strict";
var ctx = __w_pdfjs_require__(12);
var ctx = __w_pdfjs_require__(11);
var call = __w_pdfjs_require__(106);
var isArrayIter = __w_pdfjs_require__(107);
var anObject = __w_pdfjs_require__(8);
@ -5697,7 +5697,7 @@ module.exports.f = function (C) { @@ -5697,7 +5697,7 @@ module.exports.f = function (C) {
"use strict";
var redefine = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(10);
module.exports = function (target, src, safe) {
for (var key in src) {
redefine(target, key, src[key], safe);
@ -10929,7 +10929,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo @@ -10929,7 +10929,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _content_disposition = __w_pdfjs_require__(161);
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
@ -10966,9 +10966,9 @@ function validateRangeRequestCapabilities(_ref) { @@ -10966,9 +10966,9 @@ function validateRangeRequestCapabilities(_ref) {
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
if (/\.pdf$/i.test(filename)) {
return filename;
}
}
return null;
@ -11094,7 +11094,7 @@ var classof = __w_pdfjs_require__(38); @@ -11094,7 +11094,7 @@ var classof = __w_pdfjs_require__(38);
var test = {};
test[__w_pdfjs_require__(4)('toStringTag')] = 'z';
if (test + '' != '[object z]') {
__w_pdfjs_require__(11)(Object.prototype, 'toString', function toString() {
__w_pdfjs_require__(10)(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
@ -11108,7 +11108,7 @@ if (test + '' != '[object z]') { @@ -11108,7 +11108,7 @@ if (test + '' != '[object z]') {
var LIBRARY = __w_pdfjs_require__(56);
var $export = __w_pdfjs_require__(6);
var redefine = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(10);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var Iterators = __w_pdfjs_require__(21);
@ -11209,7 +11209,7 @@ module.exports = document && document.documentElement; @@ -11209,7 +11209,7 @@ module.exports = document && document.documentElement;
var $iterators = __w_pdfjs_require__(103);
var getKeys = __w_pdfjs_require__(26);
var redefine = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(10);
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var Iterators = __w_pdfjs_require__(21);
@ -11289,7 +11289,7 @@ module.exports = function (O, D) { @@ -11289,7 +11289,7 @@ module.exports = function (O, D) {
"use strict";
var ctx = __w_pdfjs_require__(12);
var ctx = __w_pdfjs_require__(11);
var invoke = __w_pdfjs_require__(109);
var html = __w_pdfjs_require__(57);
var cel = __w_pdfjs_require__(30);
@ -11447,7 +11447,7 @@ module.exports = function (exec, skipClosing) { @@ -11447,7 +11447,7 @@ module.exports = function (exec, skipClosing) {
"use strict";
var ctx = __w_pdfjs_require__(12);
var ctx = __w_pdfjs_require__(11);
var IObject = __w_pdfjs_require__(32);
var toObject = __w_pdfjs_require__(39);
var toLength = __w_pdfjs_require__(34);
@ -11520,7 +11520,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -11520,7 +11520,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
var _font_loader = __w_pdfjs_require__(133);
@ -11641,7 +11641,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -11641,7 +11641,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.285';
var apiVersion = '2.0.288';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -12936,8 +12936,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -12936,8 +12936,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.285';
exports.build = build = '97466465';
exports.version = version = '2.0.288';
exports.build = build = 'f0216484';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -12965,7 +12965,7 @@ var _createClass = function () { function defineProperties(target, props) { for @@ -12965,7 +12965,7 @@ var _createClass = function () { function defineProperties(target, props) { for
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -24121,7 +24121,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec @@ -24121,7 +24121,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
var _util = __w_pdfjs_require__(0);
@ -25144,7 +25144,7 @@ exports.renderTextLayer = undefined; @@ -25144,7 +25144,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -25695,7 +25695,7 @@ exports.SVGGraphics = undefined; @@ -25695,7 +25695,7 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
var _is_node = __w_pdfjs_require__(24);
@ -26734,14 +26734,14 @@ exports.SVGGraphics = SVGGraphics; @@ -26734,14 +26734,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.285';
var pdfjsBuild = '97466465';
var pdfjsVersion = '2.0.288';
var pdfjsBuild = 'f0216484';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(132);
var pdfjsDisplayAPI = __w_pdfjs_require__(66);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(78);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(77);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(10);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(12);
var pdfjsDisplaySVG = __w_pdfjs_require__(79);
{
var isNodeJS = __w_pdfjs_require__(24);
@ -26751,12 +26751,12 @@ var pdfjsDisplaySVG = __w_pdfjs_require__(79); @@ -26751,12 +26751,12 @@ var pdfjsDisplaySVG = __w_pdfjs_require__(79);
return new PDFNodeStream(params);
});
} else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') {
var PDFFetchStream = __w_pdfjs_require__(161).PDFFetchStream;
var PDFFetchStream = __w_pdfjs_require__(162).PDFFetchStream;
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
return new PDFFetchStream(params);
});
} else {
var PDFNetworkStream = __w_pdfjs_require__(162).PDFNetworkStream;
var PDFNetworkStream = __w_pdfjs_require__(163).PDFNetworkStream;
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
return new PDFNetworkStream(params);
});
@ -27903,7 +27903,7 @@ module.exports = function (done, value) { @@ -27903,7 +27903,7 @@ module.exports = function (done, value) {
var LIBRARY = __w_pdfjs_require__(56);
var global = __w_pdfjs_require__(5);
var ctx = __w_pdfjs_require__(12);
var ctx = __w_pdfjs_require__(11);
var classof = __w_pdfjs_require__(38);
var $export = __w_pdfjs_require__(6);
var isObject = __w_pdfjs_require__(3);
@ -28392,7 +28392,7 @@ module.exports = __w_pdfjs_require__(7).WeakMap; @@ -28392,7 +28392,7 @@ module.exports = __w_pdfjs_require__(7).WeakMap;
var each = __w_pdfjs_require__(64)(0);
var redefine = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(10);
var meta = __w_pdfjs_require__(43);
var assign = __w_pdfjs_require__(119);
var weak = __w_pdfjs_require__(121);
@ -28633,7 +28633,7 @@ module.exports = { @@ -28633,7 +28633,7 @@ module.exports = {
var global = __w_pdfjs_require__(5);
var $export = __w_pdfjs_require__(6);
var redefine = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(10);
var redefineAll = __w_pdfjs_require__(42);
var meta = __w_pdfjs_require__(43);
var forOf = __w_pdfjs_require__(28);
@ -28746,7 +28746,7 @@ var check = function check(O, proto) { @@ -28746,7 +28746,7 @@ var check = function check(O, proto) {
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
try {
set = __w_pdfjs_require__(12)(Function.call, __w_pdfjs_require__(125).f(Object.prototype, '__proto__').set, 2);
set = __w_pdfjs_require__(11)(Function.call, __w_pdfjs_require__(125).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) {
@ -28831,7 +28831,7 @@ __w_pdfjs_require__(129)('WeakMap'); @@ -28831,7 +28831,7 @@ __w_pdfjs_require__(129)('WeakMap');
var $export = __w_pdfjs_require__(6);
var aFunction = __w_pdfjs_require__(18);
var ctx = __w_pdfjs_require__(12);
var ctx = __w_pdfjs_require__(11);
var forOf = __w_pdfjs_require__(28);
module.exports = function (COLLECTION) {
$export($export.S, COLLECTION, {
@ -31913,7 +31913,7 @@ Object.defineProperty(exports, "__esModule", { @@ -31913,7 +31913,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(12);
var _util = __w_pdfjs_require__(0);
@ -31938,8 +31938,8 @@ if (!_global_scope2.default.PDFJS) { @@ -31938,8 +31938,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.285';
PDFJS.build = '97466465';
PDFJS.version = '2.0.288';
PDFJS.build = 'f0216484';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -35310,7 +35310,7 @@ var WorkerMessageHandler = { @@ -35310,7 +35310,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.285';
var workerVersion = '2.0.288';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}
@ -52944,6 +52944,159 @@ exports.PDFNodeStream = PDFNodeStream; @@ -52944,6 +52944,159 @@ exports.PDFNodeStream = PDFNodeStream;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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"); } }; }();
function getFilenameFromContentDispositionHeader(contentDisposition) {
var needsEncodingFixup = true;
var tmp = /(?:^|;)\s*filename\*\s*=\s*([^;\s]+)/i.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var filename = rfc2616unquote(tmp);
filename = unescape(filename);
filename = rfc5987decode(filename);
filename = rfc2047decode(filename);
return fixupEncoding(filename);
}
tmp = rfc2231getparam(contentDisposition);
if (tmp) {
var _filename = rfc2047decode(tmp);
return fixupEncoding(_filename);
}
tmp = /(?:^|;)\s*filename\s*=\s*([^;\s]+)/.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var _filename2 = rfc2616unquote(tmp);
_filename2 = rfc2047decode(_filename2);
return fixupEncoding(_filename2);
}
function textdecode(encoding, value) {
if (encoding) {
if (!/^[^\x00-\xFF]+$/.test(value)) {
return value;
}
try {
var decoder = new TextDecoder(encoding, { fatal: true });
var bytes = new Array(value.length);
for (var i = 0; i < value.length; ++i) {
bytes[i] = value.charCodeAt(0);
}
value = decoder.decode(new Uint8Array(bytes));
needsEncodingFixup = false;
} catch (e) {
if (/^utf-?8$/i.test(encoding)) {
value = decodeURIComponent(escape(value));
needsEncodingFixup = false;
}
}
}
return value;
}
function fixupEncoding(value) {
if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
return textdecode('utf-8', value);
}
return value;
}
function rfc2231getparam(contentDisposition) {
var matches = [],
match = void 0;
var iter = /(?:^|;)\s*filename\*((?!0\d)\d+)(\*?)\s*=\s*([^;\s]+)/ig;
while ((match = iter.exec(contentDisposition)) !== null) {
var _match = match,
_match2 = _slicedToArray(_match, 4),
n = _match2[1],
quot = _match2[2],
part = _match2[3];
n = parseInt(n, 10);
if (n in matches) {
if (n === 0) {
break;
}
continue;
}
matches[n] = [quot, part];
}
var parts = [];
for (var _n = 0; _n < matches.length; ++_n) {
if (!(_n in matches)) {
break;
}
var _matches$_n = _slicedToArray(matches[_n], 2),
_quot = _matches$_n[0],
_part = _matches$_n[1];
_part = rfc2616unquote(_part);
if (_quot) {
_part = unescape(_part);
if (_n === 0) {
_part = rfc5987decode(_part);
}
}
parts.push(_part);
}
return parts.join('');
}
function rfc2616unquote(value) {
if (value.charAt(0) === '"') {
var parts = value.slice(1).split('\\"');
for (var i = 0; i < parts.length; ++i) {
var quotindex = parts[i].indexOf('"');
if (quotindex !== -1) {
parts[i] = parts[i].slice(0, quotindex);
parts.length = i + 1;
}
parts[i] = parts[i].replace(/\\(.)/g, '$1');
}
value = parts.join('"');
}
return value;
}
function rfc5987decode(extvalue) {
var encodingend = extvalue.indexOf('\'');
if (encodingend === -1) {
return extvalue;
}
var encoding = extvalue.slice(0, encodingend);
var langvalue = extvalue.slice(encodingend + 1);
var value = langvalue.replace(/^[^']*'/, '');
return textdecode(encoding, value);
}
function rfc2047decode(value) {
if (value.slice(0, 2) !== '=?' || /[\x00-\x19\x80-\xff]/.test(value)) {
return value;
}
return value.replace(/=\?([\w\-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) {
if (encoding === 'q' || encoding === 'Q') {
text = text.replace(/_/g, ' ');
text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
return textdecode(charset, text);
}
try {
return atob(text);
} catch (e) {
return text;
}
});
}
return '';
}
exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
/***/ }),
/* 162 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -53217,7 +53370,7 @@ var PDFFetchStreamRangeReader = function () { @@ -53217,7 +53370,7 @@ var PDFFetchStreamRangeReader = function () {
exports.PDFFetchStream = PDFFetchStream;
/***/ }),
/* 162 */
/* 163 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

355
build/pdf.js

@ -1465,8 +1465,8 @@ if (typeof __g == 'number') __g = global; @@ -1465,8 +1465,8 @@ if (typeof __g == 'number') __g = global;
var global = __w_pdfjs_require__(3);
var core = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(8);
var ctx = __w_pdfjs_require__(9);
var PROTOTYPE = 'prototype';
var $export = function $export(type, name, source) {
var IS_FORCED = type & $export.F;
@ -1541,6 +1541,72 @@ module.exports = function (it, key) { @@ -1541,6 +1541,72 @@ module.exports = function (it, key) {
"use strict";
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var SRC = __w_pdfjs_require__(20)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(5).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 9 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(16);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -2047,72 +2113,6 @@ exports.SimpleXMLParser = SimpleXMLParser; @@ -2047,72 +2113,6 @@ exports.SimpleXMLParser = SimpleXMLParser;
exports.StatTimer = StatTimer;
exports.DummyStatTimer = DummyStatTimer;
/***/ }),
/* 9 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var SRC = __w_pdfjs_require__(20)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(5).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(16);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
@ -2287,7 +2287,7 @@ module.exports = function (it, tag, stat) { @@ -2287,7 +2287,7 @@ module.exports = function (it, tag, stat) {
"use strict";
var ctx = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(9);
var call = __w_pdfjs_require__(89);
var isArrayIter = __w_pdfjs_require__(90);
var anObject = __w_pdfjs_require__(6);
@ -2506,7 +2506,7 @@ module.exports.f = function (C) { @@ -2506,7 +2506,7 @@ module.exports.f = function (C) {
"use strict";
var redefine = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(8);
module.exports = function (target, src, safe) {
for (var key in src) {
redefine(target, key, src[key], safe);
@ -2584,7 +2584,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo @@ -2584,7 +2584,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _content_disposition = __w_pdfjs_require__(122);
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
@ -2621,9 +2621,9 @@ function validateRangeRequestCapabilities(_ref) { @@ -2621,9 +2621,9 @@ function validateRangeRequestCapabilities(_ref) {
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
if (/\.pdf$/i.test(filename)) {
return filename;
}
}
return null;
@ -2749,7 +2749,7 @@ var classof = __w_pdfjs_require__(33); @@ -2749,7 +2749,7 @@ var classof = __w_pdfjs_require__(33);
var test = {};
test[__w_pdfjs_require__(2)('toStringTag')] = 'z';
if (test + '' != '[object z]') {
__w_pdfjs_require__(9)(Object.prototype, 'toString', function toString() {
__w_pdfjs_require__(8)(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
@ -2763,7 +2763,7 @@ if (test + '' != '[object z]') { @@ -2763,7 +2763,7 @@ if (test + '' != '[object z]') {
var LIBRARY = __w_pdfjs_require__(48);
var $export = __w_pdfjs_require__(4);
var redefine = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(8);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var Iterators = __w_pdfjs_require__(19);
@ -2864,7 +2864,7 @@ module.exports = document && document.documentElement; @@ -2864,7 +2864,7 @@ module.exports = document && document.documentElement;
var $iterators = __w_pdfjs_require__(86);
var getKeys = __w_pdfjs_require__(21);
var redefine = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(8);
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var Iterators = __w_pdfjs_require__(19);
@ -2944,7 +2944,7 @@ module.exports = function (O, D) { @@ -2944,7 +2944,7 @@ module.exports = function (O, D) {
"use strict";
var ctx = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(9);
var invoke = __w_pdfjs_require__(92);
var html = __w_pdfjs_require__(49);
var cel = __w_pdfjs_require__(25);
@ -3102,7 +3102,7 @@ module.exports = function (exec, skipClosing) { @@ -3102,7 +3102,7 @@ module.exports = function (exec, skipClosing) {
"use strict";
var ctx = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(9);
var IObject = __w_pdfjs_require__(27);
var toObject = __w_pdfjs_require__(34);
var toLength = __w_pdfjs_require__(29);
@ -3175,7 +3175,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -3175,7 +3175,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
var _font_loader = __w_pdfjs_require__(116);
@ -3321,7 +3321,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -3321,7 +3321,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.285';
var apiVersion = '2.0.288';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -4697,8 +4697,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -4697,8 +4697,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.285';
exports.build = build = '97466465';
exports.version = version = '2.0.288';
exports.build = build = 'f0216484';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4726,7 +4726,7 @@ var _createClass = function () { function defineProperties(target, props) { for @@ -4726,7 +4726,7 @@ var _createClass = function () { function defineProperties(target, props) { for
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -4842,7 +4842,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec @@ -4842,7 +4842,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
var _util = __w_pdfjs_require__(0);
@ -5865,7 +5865,7 @@ exports.renderTextLayer = undefined; @@ -5865,7 +5865,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -6417,7 +6417,7 @@ exports.SVGGraphics = undefined; @@ -6417,7 +6417,7 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
var _is_node = __w_pdfjs_require__(24);
@ -7456,14 +7456,14 @@ exports.SVGGraphics = SVGGraphics; @@ -7456,14 +7456,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.285';
var pdfjsBuild = '97466465';
var pdfjsVersion = '2.0.288';
var pdfjsBuild = 'f0216484';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(115);
var pdfjsDisplayAPI = __w_pdfjs_require__(58);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(61);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(60);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(8);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(10);
var pdfjsDisplaySVG = __w_pdfjs_require__(62);
{
var isNodeJS = __w_pdfjs_require__(24);
@ -7473,12 +7473,12 @@ var pdfjsDisplaySVG = __w_pdfjs_require__(62); @@ -7473,12 +7473,12 @@ var pdfjsDisplaySVG = __w_pdfjs_require__(62);
return new PDFNodeStream(params);
});
} else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') {
var PDFFetchStream = __w_pdfjs_require__(122).PDFFetchStream;
var PDFFetchStream = __w_pdfjs_require__(123).PDFFetchStream;
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
return new PDFFetchStream(params);
});
} else {
var PDFNetworkStream = __w_pdfjs_require__(123).PDFNetworkStream;
var PDFNetworkStream = __w_pdfjs_require__(124).PDFNetworkStream;
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
return new PDFNetworkStream(params);
});
@ -8625,7 +8625,7 @@ module.exports = function (done, value) { @@ -8625,7 +8625,7 @@ module.exports = function (done, value) {
var LIBRARY = __w_pdfjs_require__(48);
var global = __w_pdfjs_require__(3);
var ctx = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(9);
var classof = __w_pdfjs_require__(33);
var $export = __w_pdfjs_require__(4);
var isObject = __w_pdfjs_require__(1);
@ -9114,7 +9114,7 @@ module.exports = __w_pdfjs_require__(5).WeakMap; @@ -9114,7 +9114,7 @@ module.exports = __w_pdfjs_require__(5).WeakMap;
var each = __w_pdfjs_require__(56)(0);
var redefine = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(8);
var meta = __w_pdfjs_require__(38);
var assign = __w_pdfjs_require__(102);
var weak = __w_pdfjs_require__(104);
@ -9355,7 +9355,7 @@ module.exports = { @@ -9355,7 +9355,7 @@ module.exports = {
var global = __w_pdfjs_require__(3);
var $export = __w_pdfjs_require__(4);
var redefine = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(8);
var redefineAll = __w_pdfjs_require__(37);
var meta = __w_pdfjs_require__(38);
var forOf = __w_pdfjs_require__(23);
@ -9468,7 +9468,7 @@ var check = function check(O, proto) { @@ -9468,7 +9468,7 @@ var check = function check(O, proto) {
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
try {
set = __w_pdfjs_require__(10)(Function.call, __w_pdfjs_require__(108).f(Object.prototype, '__proto__').set, 2);
set = __w_pdfjs_require__(9)(Function.call, __w_pdfjs_require__(108).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) {
@ -9553,7 +9553,7 @@ __w_pdfjs_require__(112)('WeakMap'); @@ -9553,7 +9553,7 @@ __w_pdfjs_require__(112)('WeakMap');
var $export = __w_pdfjs_require__(4);
var aFunction = __w_pdfjs_require__(16);
var ctx = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(9);
var forOf = __w_pdfjs_require__(23);
module.exports = function (COLLECTION) {
$export($export.S, COLLECTION, {
@ -12635,7 +12635,7 @@ Object.defineProperty(exports, "__esModule", { @@ -12635,7 +12635,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = __w_pdfjs_require__(8);
var _dom_utils = __w_pdfjs_require__(10);
var _util = __w_pdfjs_require__(0);
@ -12660,8 +12660,8 @@ if (!_global_scope2.default.PDFJS) { @@ -12660,8 +12660,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.285';
PDFJS.build = '97466465';
PDFJS.version = '2.0.288';
PDFJS.build = 'f0216484';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -16278,6 +16278,159 @@ exports.PDFNodeStream = PDFNodeStream; @@ -16278,6 +16278,159 @@ exports.PDFNodeStream = PDFNodeStream;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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"); } }; }();
function getFilenameFromContentDispositionHeader(contentDisposition) {
var needsEncodingFixup = true;
var tmp = /(?:^|;)\s*filename\*\s*=\s*([^;\s]+)/i.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var filename = rfc2616unquote(tmp);
filename = unescape(filename);
filename = rfc5987decode(filename);
filename = rfc2047decode(filename);
return fixupEncoding(filename);
}
tmp = rfc2231getparam(contentDisposition);
if (tmp) {
var _filename = rfc2047decode(tmp);
return fixupEncoding(_filename);
}
tmp = /(?:^|;)\s*filename\s*=\s*([^;\s]+)/.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var _filename2 = rfc2616unquote(tmp);
_filename2 = rfc2047decode(_filename2);
return fixupEncoding(_filename2);
}
function textdecode(encoding, value) {
if (encoding) {
if (!/^[^\x00-\xFF]+$/.test(value)) {
return value;
}
try {
var decoder = new TextDecoder(encoding, { fatal: true });
var bytes = new Array(value.length);
for (var i = 0; i < value.length; ++i) {
bytes[i] = value.charCodeAt(0);
}
value = decoder.decode(new Uint8Array(bytes));
needsEncodingFixup = false;
} catch (e) {
if (/^utf-?8$/i.test(encoding)) {
value = decodeURIComponent(escape(value));
needsEncodingFixup = false;
}
}
}
return value;
}
function fixupEncoding(value) {
if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
return textdecode('utf-8', value);
}
return value;
}
function rfc2231getparam(contentDisposition) {
var matches = [],
match = void 0;
var iter = /(?:^|;)\s*filename\*((?!0\d)\d+)(\*?)\s*=\s*([^;\s]+)/ig;
while ((match = iter.exec(contentDisposition)) !== null) {
var _match = match,
_match2 = _slicedToArray(_match, 4),
n = _match2[1],
quot = _match2[2],
part = _match2[3];
n = parseInt(n, 10);
if (n in matches) {
if (n === 0) {
break;
}
continue;
}
matches[n] = [quot, part];
}
var parts = [];
for (var _n = 0; _n < matches.length; ++_n) {
if (!(_n in matches)) {
break;
}
var _matches$_n = _slicedToArray(matches[_n], 2),
_quot = _matches$_n[0],
_part = _matches$_n[1];
_part = rfc2616unquote(_part);
if (_quot) {
_part = unescape(_part);
if (_n === 0) {
_part = rfc5987decode(_part);
}
}
parts.push(_part);
}
return parts.join('');
}
function rfc2616unquote(value) {
if (value.charAt(0) === '"') {
var parts = value.slice(1).split('\\"');
for (var i = 0; i < parts.length; ++i) {
var quotindex = parts[i].indexOf('"');
if (quotindex !== -1) {
parts[i] = parts[i].slice(0, quotindex);
parts.length = i + 1;
}
parts[i] = parts[i].replace(/\\(.)/g, '$1');
}
value = parts.join('"');
}
return value;
}
function rfc5987decode(extvalue) {
var encodingend = extvalue.indexOf('\'');
if (encodingend === -1) {
return extvalue;
}
var encoding = extvalue.slice(0, encodingend);
var langvalue = extvalue.slice(encodingend + 1);
var value = langvalue.replace(/^[^']*'/, '');
return textdecode(encoding, value);
}
function rfc2047decode(value) {
if (value.slice(0, 2) !== '=?' || /[\x00-\x19\x80-\xff]/.test(value)) {
return value;
}
return value.replace(/=\?([\w\-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) {
if (encoding === 'q' || encoding === 'Q') {
text = text.replace(/_/g, ' ');
text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
return textdecode(charset, text);
}
try {
return atob(text);
} catch (e) {
return text;
}
});
}
return '';
}
exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;
/***/ }),
/* 123 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -16551,7 +16704,7 @@ var PDFFetchStreamRangeReader = function () { @@ -16551,7 +16704,7 @@ var PDFFetchStreamRangeReader = function () {
exports.PDFFetchStream = PDFFetchStream;
/***/ }),
/* 123 */
/* 124 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

6
build/pdf.worker.js vendored

@ -21955,8 +21955,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -21955,8 +21955,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.285';
var pdfjsBuild = '97466465';
var pdfjsVersion = '2.0.288';
var pdfjsBuild = 'f0216484';
var pdfjsCoreWorker = __w_pdfjs_require__(73);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22169,7 +22169,7 @@ var WorkerMessageHandler = { @@ -22169,7 +22169,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.285';
var workerVersion = '2.0.288';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

2
lib/core/worker.js

@ -223,7 +223,7 @@ var WorkerMessageHandler = { @@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.285';
var workerVersion = '2.0.288';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

6
lib/display/api.js

@ -178,7 +178,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -178,7 +178,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.285';
var apiVersion = '2.0.288';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -1554,8 +1554,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -1554,8 +1554,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.285';
exports.build = build = '97466465';
exports.version = version = '2.0.288';
exports.build = build = 'f0216484';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

168
lib/display/content_disposition.js

@ -0,0 +1,168 @@ @@ -0,0 +1,168 @@
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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"); } }; }();
function getFilenameFromContentDispositionHeader(contentDisposition) {
var needsEncodingFixup = true;
var tmp = /(?:^|;)\s*filename\*\s*=\s*([^;\s]+)/i.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var filename = rfc2616unquote(tmp);
filename = unescape(filename);
filename = rfc5987decode(filename);
filename = rfc2047decode(filename);
return fixupEncoding(filename);
}
tmp = rfc2231getparam(contentDisposition);
if (tmp) {
var _filename = rfc2047decode(tmp);
return fixupEncoding(_filename);
}
tmp = /(?:^|;)\s*filename\s*=\s*([^;\s]+)/.exec(contentDisposition);
if (tmp) {
tmp = tmp[1];
var _filename2 = rfc2616unquote(tmp);
_filename2 = rfc2047decode(_filename2);
return fixupEncoding(_filename2);
}
function textdecode(encoding, value) {
if (encoding) {
if (!/^[^\x00-\xFF]+$/.test(value)) {
return value;
}
try {
var decoder = new TextDecoder(encoding, { fatal: true });
var bytes = new Array(value.length);
for (var i = 0; i < value.length; ++i) {
bytes[i] = value.charCodeAt(0);
}
value = decoder.decode(new Uint8Array(bytes));
needsEncodingFixup = false;
} catch (e) {
if (/^utf-?8$/i.test(encoding)) {
value = decodeURIComponent(escape(value));
needsEncodingFixup = false;
}
}
}
return value;
}
function fixupEncoding(value) {
if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
return textdecode('utf-8', value);
}
return value;
}
function rfc2231getparam(contentDisposition) {
var matches = [],
match = void 0;
var iter = /(?:^|;)\s*filename\*((?!0\d)\d+)(\*?)\s*=\s*([^;\s]+)/ig;
while ((match = iter.exec(contentDisposition)) !== null) {
var _match = match,
_match2 = _slicedToArray(_match, 4),
n = _match2[1],
quot = _match2[2],
part = _match2[3];
n = parseInt(n, 10);
if (n in matches) {
if (n === 0) {
break;
}
continue;
}
matches[n] = [quot, part];
}
var parts = [];
for (var _n = 0; _n < matches.length; ++_n) {
if (!(_n in matches)) {
break;
}
var _matches$_n = _slicedToArray(matches[_n], 2),
_quot = _matches$_n[0],
_part = _matches$_n[1];
_part = rfc2616unquote(_part);
if (_quot) {
_part = unescape(_part);
if (_n === 0) {
_part = rfc5987decode(_part);
}
}
parts.push(_part);
}
return parts.join('');
}
function rfc2616unquote(value) {
if (value.charAt(0) === '"') {
var parts = value.slice(1).split('\\"');
for (var i = 0; i < parts.length; ++i) {
var quotindex = parts[i].indexOf('"');
if (quotindex !== -1) {
parts[i] = parts[i].slice(0, quotindex);
parts.length = i + 1;
}
parts[i] = parts[i].replace(/\\(.)/g, '$1');
}
value = parts.join('"');
}
return value;
}
function rfc5987decode(extvalue) {
var encodingend = extvalue.indexOf('\'');
if (encodingend === -1) {
return extvalue;
}
var encoding = extvalue.slice(0, encodingend);
var langvalue = extvalue.slice(encodingend + 1);
var value = langvalue.replace(/^[^']*'/, '');
return textdecode(encoding, value);
}
function rfc2047decode(value) {
if (value.slice(0, 2) !== '=?' || /[\x00-\x19\x80-\xff]/.test(value)) {
return value;
}
return value.replace(/=\?([\w\-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) {
if (encoding === 'q' || encoding === 'Q') {
text = text.replace(/_/g, ' ');
text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) {
return String.fromCharCode(parseInt(hex, 16));
});
return textdecode(charset, text);
}
try {
return atob(text);
} catch (e) {
return text;
}
});
}
return '';
}
exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader;

4
lib/display/global.js

@ -51,8 +51,8 @@ if (!_global_scope2.default.PDFJS) { @@ -51,8 +51,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.285';
PDFJS.build = '97466465';
PDFJS.version = '2.0.288';
PDFJS.build = 'f0216484';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

8
lib/display/network_utils.js

@ -28,7 +28,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo @@ -28,7 +28,7 @@ exports.validateResponseStatus = exports.validateRangeRequestCapabilities = expo
var _util = require('../shared/util');
var _dom_utils = require('./dom_utils');
var _content_disposition = require('./content_disposition');
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
@ -65,9 +65,9 @@ function validateRangeRequestCapabilities(_ref) { @@ -65,9 +65,9 @@ function validateRangeRequestCapabilities(_ref) {
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
var filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition);
if (/\.pdf$/i.test(filename)) {
return filename;
}
}
return null;

4
lib/pdf.js

@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
*/
'use strict';
var pdfjsVersion = '2.0.285';
var pdfjsBuild = '97466465';
var pdfjsVersion = '2.0.288';
var pdfjsBuild = 'f0216484';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
*/
'use strict';
var pdfjsVersion = '2.0.285';
var pdfjsBuild = '97466465';
var pdfjsVersion = '2.0.288';
var pdfjsBuild = 'f0216484';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

36
lib/test/unit/network_utils_spec.js

@ -163,23 +163,45 @@ describe('network_utils', function () { @@ -163,23 +163,45 @@ describe('network_utils', function () {
return 'attachment; filename="filename.pdf"';
}
})).toEqual('filename.pdf');
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename=filename.pdf';
}
})).toEqual('filename.pdf');
});
it('returns null when content disposition is form-data', function () {
it('gets the filename from the response header (RFC 6266)', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data';
return 'attachment; filename*=filename.pdf';
}
})).toBeNull();
})).toEqual('filename.pdf');
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data; name="filename.pdf"';
return 'attachment; filename*=\'\'filename.pdf';
}
})).toBeNull();
})).toEqual('filename.pdf');
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename*=utf-8\'\'filename.pdf';
}
})).toEqual('filename.pdf');
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename=no.pdf; filename*=utf-8\'\'filename.pdf';
}
})).toEqual('filename.pdf');
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data; name="filename.pdf"; filename="file.pdf"';
return 'attachment; filename*=utf-8\'\'filename.pdf; filename=no.pdf';
}
})).toEqual('file.pdf');
})).toEqual('filename.pdf');
});
it('gets the filename from the response header (RFC 2231)', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename*0=filename; filename*1=.pdf';
}
})).toEqual('filename.pdf');
});
it('only extracts filename with pdf extension', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.285",
"version": "2.0.288",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

Loading…
Cancel
Save