Browse Source

PDF.js version 2.0.363 - See mozilla/pdf.js@2e780d4e2b6974613f001ba4cfd2c35739c56b03

master v2.0.363
pdfjsbot 7 years ago
parent
commit
7799807be5
  1. 2
      bower.json
  2. 14
      build/pdf.js
  3. 2
      build/pdf.js.map
  4. 2
      build/pdf.min.js
  5. 58
      build/pdf.worker.js
  6. 2
      build/pdf.worker.js.map
  7. 2
      build/pdf.worker.min.js
  8. 52
      lib/core/parser.js
  9. 2
      lib/core/worker.js
  10. 6
      lib/display/api.js
  11. 4
      lib/display/global.js
  12. 4
      lib/pdf.js
  13. 4
      lib/pdf.worker.js
  14. 2
      package.json

2
bower.json

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

14
build/pdf.js

@ -3299,7 +3299,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -3299,7 +3299,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.361';
var apiVersion = '2.0.363';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -4698,8 +4698,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -4698,8 +4698,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.361';
exports.build = build = 'df0836b9';
exports.version = version = '2.0.363';
exports.build = build = '2e780d4e';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -7457,8 +7457,8 @@ exports.SVGGraphics = SVGGraphics; @@ -7457,8 +7457,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.361';
var pdfjsBuild = 'df0836b9';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(120);
var pdfjsDisplayAPI = __w_pdfjs_require__(58);
@ -12743,8 +12743,8 @@ if (!_global_scope2.default.PDFJS) { @@ -12743,8 +12743,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.361';
PDFJS.build = 'df0836b9';
PDFJS.version = '2.0.363';
PDFJS.build = '2e780d4e';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

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

58
build/pdf.worker.js vendored

@ -4035,6 +4035,20 @@ var _jpeg_stream = __w_pdfjs_require__(41); @@ -4035,6 +4035,20 @@ var _jpeg_stream = __w_pdfjs_require__(41);
var _jpx_stream = __w_pdfjs_require__(138);
var MAX_LENGTH_TO_CACHE = 1000;
var MAX_ADLER32_LENGTH = 5552;
function computeAdler32(bytes) {
var bytesLength = bytes.length;
if (bytesLength >= MAX_ADLER32_LENGTH) {
throw new Error('computeAdler32: The input is too large.');
}
var a = 1,
b = 0;
for (var i = 0; i < bytesLength; ++i) {
a += bytes[i] & 0xFF;
b += a;
}
return b % 65521 << 16 | a % 65521;
}
var Parser = function ParserClosure() {
function Parser(lexer, allowStreams, xref, recoveryMode) {
this.lexer = lexer;
@ -4324,7 +4338,8 @@ var Parser = function ParserClosure() { @@ -4324,7 +4338,8 @@ var Parser = function ParserClosure() {
makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
var lexer = this.lexer;
var stream = lexer.stream;
var dict = new _primitives.Dict(this.xref);
var dict = new _primitives.Dict(this.xref),
dictLength = void 0;
while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) {
if (!(0, _primitives.isName)(this.buf1)) {
throw new _util.FormatError('Dictionary key must be a name object');
@ -4336,6 +4351,9 @@ var Parser = function ParserClosure() { @@ -4336,6 +4351,9 @@ var Parser = function ParserClosure() {
}
dict.set(key, this.getObj(cipherTransform));
}
if (lexer.beginInlineImagePos !== -1) {
dictLength = stream.pos - lexer.beginInlineImagePos;
}
var filter = dict.get('Filter', 'F'),
filterName;
if ((0, _primitives.isName)(filter)) {
@ -4347,9 +4365,7 @@ var Parser = function ParserClosure() { @@ -4347,9 +4365,7 @@ var Parser = function ParserClosure() {
}
}
var startPos = stream.pos,
length,
i,
ii;
length = void 0;
if (filterName === 'DCTDecode' || filterName === 'DCT') {
length = this.findDCTDecodeInlineStreamEnd(stream);
} else if (filterName === 'ASCII85Decode' || filterName === 'A85') {
@ -4360,18 +4376,16 @@ var Parser = function ParserClosure() { @@ -4360,18 +4376,16 @@ var Parser = function ParserClosure() {
length = this.findDefaultInlineStreamEnd(stream);
}
var imageStream = stream.makeSubStream(startPos, length, dict);
var adler32;
if (length < MAX_LENGTH_TO_CACHE) {
var cacheKey = void 0;
if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
var imageBytes = imageStream.getBytes();
imageStream.reset();
var a = 1;
var b = 0;
for (i = 0, ii = imageBytes.length; i < ii; ++i) {
a += imageBytes[i] & 0xff;
b += a;
}
adler32 = b % 65521 << 16 | a % 65521;
var cacheEntry = this.imageCache[adler32];
var initialStreamPos = stream.pos;
stream.pos = lexer.beginInlineImagePos;
var dictBytes = stream.getBytes(dictLength);
stream.pos = initialStreamPos;
cacheKey = computeAdler32(imageBytes) + '_' + computeAdler32(dictBytes);
var cacheEntry = this.imageCache[cacheKey];
if (cacheEntry !== undefined) {
this.buf2 = _primitives.Cmd.get('EI');
this.shift();
@ -4384,9 +4398,9 @@ var Parser = function ParserClosure() { @@ -4384,9 +4398,9 @@ var Parser = function ParserClosure() {
}
imageStream = this.filter(imageStream, dict, length);
imageStream.dict = dict;
if (adler32 !== undefined) {
imageStream.cacheKey = 'inline_' + length + '_' + adler32;
this.imageCache[adler32] = imageStream;
if (cacheKey !== undefined) {
imageStream.cacheKey = 'inline_' + length + '_' + cacheKey;
this.imageCache[cacheKey] = imageStream;
}
this.buf2 = _primitives.Cmd.get('EI');
this.shift();
@ -4559,6 +4573,7 @@ var Lexer = function LexerClosure() { @@ -4559,6 +4573,7 @@ var Lexer = function LexerClosure() {
this.nextChar();
this.strBuf = [];
this.knownCommands = knownCommands;
this.beginInlineImagePos = -1;
}
var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function toHexDigit(ch) {
@ -4913,6 +4928,9 @@ var Lexer = function LexerClosure() { @@ -4913,6 +4928,9 @@ var Lexer = function LexerClosure() {
if (str === 'null') {
return null;
}
if (str === 'BI') {
this.beginInlineImagePos = this.stream.pos;
}
return _primitives.Cmd.get(str);
},
skipToNextLine: function Lexer_skipToNextLine() {
@ -22295,8 +22313,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -22295,8 +22313,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.361';
var pdfjsBuild = 'df0836b9';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22509,7 +22527,7 @@ var WorkerMessageHandler = { @@ -22509,7 +22527,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.361';
var workerVersion = '2.0.363';
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

52
lib/core/parser.js

@ -41,6 +41,20 @@ var _jpeg_stream = require('./jpeg_stream'); @@ -41,6 +41,20 @@ var _jpeg_stream = require('./jpeg_stream');
var _jpx_stream = require('./jpx_stream');
var MAX_LENGTH_TO_CACHE = 1000;
var MAX_ADLER32_LENGTH = 5552;
function computeAdler32(bytes) {
var bytesLength = bytes.length;
if (bytesLength >= MAX_ADLER32_LENGTH) {
throw new Error('computeAdler32: The input is too large.');
}
var a = 1,
b = 0;
for (var i = 0; i < bytesLength; ++i) {
a += bytes[i] & 0xFF;
b += a;
}
return b % 65521 << 16 | a % 65521;
}
var Parser = function ParserClosure() {
function Parser(lexer, allowStreams, xref, recoveryMode) {
this.lexer = lexer;
@ -330,7 +344,8 @@ var Parser = function ParserClosure() { @@ -330,7 +344,8 @@ var Parser = function ParserClosure() {
makeInlineImage: function Parser_makeInlineImage(cipherTransform) {
var lexer = this.lexer;
var stream = lexer.stream;
var dict = new _primitives.Dict(this.xref);
var dict = new _primitives.Dict(this.xref),
dictLength = void 0;
while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) {
if (!(0, _primitives.isName)(this.buf1)) {
throw new _util.FormatError('Dictionary key must be a name object');
@ -342,6 +357,9 @@ var Parser = function ParserClosure() { @@ -342,6 +357,9 @@ var Parser = function ParserClosure() {
}
dict.set(key, this.getObj(cipherTransform));
}
if (lexer.beginInlineImagePos !== -1) {
dictLength = stream.pos - lexer.beginInlineImagePos;
}
var filter = dict.get('Filter', 'F'),
filterName;
if ((0, _primitives.isName)(filter)) {
@ -353,9 +371,7 @@ var Parser = function ParserClosure() { @@ -353,9 +371,7 @@ var Parser = function ParserClosure() {
}
}
var startPos = stream.pos,
length,
i,
ii;
length = void 0;
if (filterName === 'DCTDecode' || filterName === 'DCT') {
length = this.findDCTDecodeInlineStreamEnd(stream);
} else if (filterName === 'ASCII85Decode' || filterName === 'A85') {
@ -366,18 +382,16 @@ var Parser = function ParserClosure() { @@ -366,18 +382,16 @@ var Parser = function ParserClosure() {
length = this.findDefaultInlineStreamEnd(stream);
}
var imageStream = stream.makeSubStream(startPos, length, dict);
var adler32;
if (length < MAX_LENGTH_TO_CACHE) {
var cacheKey = void 0;
if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
var imageBytes = imageStream.getBytes();
imageStream.reset();
var a = 1;
var b = 0;
for (i = 0, ii = imageBytes.length; i < ii; ++i) {
a += imageBytes[i] & 0xff;
b += a;
}
adler32 = b % 65521 << 16 | a % 65521;
var cacheEntry = this.imageCache[adler32];
var initialStreamPos = stream.pos;
stream.pos = lexer.beginInlineImagePos;
var dictBytes = stream.getBytes(dictLength);
stream.pos = initialStreamPos;
cacheKey = computeAdler32(imageBytes) + '_' + computeAdler32(dictBytes);
var cacheEntry = this.imageCache[cacheKey];
if (cacheEntry !== undefined) {
this.buf2 = _primitives.Cmd.get('EI');
this.shift();
@ -390,9 +404,9 @@ var Parser = function ParserClosure() { @@ -390,9 +404,9 @@ var Parser = function ParserClosure() {
}
imageStream = this.filter(imageStream, dict, length);
imageStream.dict = dict;
if (adler32 !== undefined) {
imageStream.cacheKey = 'inline_' + length + '_' + adler32;
this.imageCache[adler32] = imageStream;
if (cacheKey !== undefined) {
imageStream.cacheKey = 'inline_' + length + '_' + cacheKey;
this.imageCache[cacheKey] = imageStream;
}
this.buf2 = _primitives.Cmd.get('EI');
this.shift();
@ -565,6 +579,7 @@ var Lexer = function LexerClosure() { @@ -565,6 +579,7 @@ var Lexer = function LexerClosure() {
this.nextChar();
this.strBuf = [];
this.knownCommands = knownCommands;
this.beginInlineImagePos = -1;
}
var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
function toHexDigit(ch) {
@ -919,6 +934,9 @@ var Lexer = function LexerClosure() { @@ -919,6 +934,9 @@ var Lexer = function LexerClosure() {
if (str === 'null') {
return null;
}
if (str === 'BI') {
this.beginInlineImagePos = this.stream.pos;
}
return _primitives.Cmd.get(str);
},
skipToNextLine: function Lexer_skipToNextLine() {

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.361';
var workerVersion = '2.0.363';
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.361';
var apiVersion = '2.0.363';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -1577,8 +1577,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -1577,8 +1577,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.361';
exports.build = build = 'df0836b9';
exports.version = version = '2.0.363';
exports.build = build = '2e780d4e';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

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.361';
PDFJS.build = 'df0836b9';
PDFJS.version = '2.0.363';
PDFJS.build = '2e780d4e';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
*/
'use strict';
var pdfjsVersion = '2.0.361';
var pdfjsBuild = 'df0836b9';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
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.361';
var pdfjsBuild = 'df0836b9';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

2
package.json

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

Loading…
Cancel
Save