Browse Source

PDF.js version 1.6.422 - See mozilla/pdf.js@aabfb7788ad140c424dd0b7823f35255d13f5225

master v1.6.422
Pdf Bot 8 years ago
parent
commit
f10886b82c
  1. 2
      bower.json
  2. 131
      build/pdf.combined.js
  3. 31
      build/pdf.js
  4. 6
      build/pdf.min.js
  5. 104
      build/pdf.worker.js
  6. 24
      build/pdf.worker.min.js
  7. 2
      package.json

2
bower.json

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

131
build/pdf.combined.js

@ -23,8 +23,8 @@ @@ -23,8 +23,8 @@
}
}(this, function (exports) {
'use strict';
var pdfjsVersion = '1.6.419';
var pdfjsBuild = '4e62562';
var pdfjsVersion = '1.6.422';
var pdfjsBuild = 'aabfb77';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {};
(function pdfjsWrapper() {
@ -47211,6 +47211,7 @@ @@ -47211,6 +47211,7 @@
this.fontLoader = new FontLoader(loadingTask.docId);
this.destroyed = false;
this.destroyCapability = null;
this._passwordCapability = null;
this.pageCache = [];
this.pagePromises = [];
this.downloadInfoCapability = createPromiseCapability();
@ -47223,6 +47224,9 @@ @@ -47223,6 +47224,9 @@
}
this.destroyed = true;
this.destroyCapability = createPromiseCapability();
if (this._passwordCapability) {
this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback'));
}
var waitOn = [];
this.pageCache.forEach(function (page) {
if (page) {
@ -47250,9 +47254,7 @@ @@ -47250,9 +47254,7 @@
},
setupMessageHandler: function WorkerTransport_setupMessageHandler() {
var messageHandler = this.messageHandler;
function updatePassword(password) {
messageHandler.send('UpdatePassword', password);
}
var loadingTask = this.loadingTask;
var pdfDataRangeTransport = this.pdfDataRangeTransport;
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
@ -47279,18 +47281,19 @@ @@ -47279,18 +47281,19 @@
this.pdfDocument = pdfDocument;
loadingTask._capability.resolve(pdfDocument);
}, this);
messageHandler.on('NeedPassword', function transportNeedPassword(exception) {
var loadingTask = this.loadingTask;
messageHandler.on('PasswordRequest', function transportPasswordRequest(exception) {
this._passwordCapability = createPromiseCapability();
if (loadingTask.onPassword) {
return loadingTask.onPassword(updatePassword, PasswordResponses.NEED_PASSWORD);
var updatePassword = function (password) {
this._passwordCapability.resolve({ password: password });
}.bind(this);
loadingTask.onPassword(updatePassword, exception.code);
} else {
this._passwordCapability.reject(new PasswordException(exception.message, exception.code));
}
loadingTask._capability.reject(new PasswordException(exception.message, exception.code));
return this._passwordCapability.promise;
}, this);
messageHandler.on('IncorrectPassword', function transportIncorrectPassword(exception) {
var loadingTask = this.loadingTask;
if (loadingTask.onPassword) {
return loadingTask.onPassword(updatePassword, PasswordResponses.INCORRECT_PASSWORD);
}
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
@ -49989,12 +49992,12 @@ @@ -49989,12 +49992,12 @@
return Catalog;
}();
var XRef = function XRefClosure() {
function XRef(stream, password) {
function XRef(stream, pdfManager) {
this.stream = stream;
this.pdfManager = pdfManager;
this.entries = [];
this.xrefstms = Object.create(null);
this.cache = [];
this.password = password;
this.stats = {
streamTypes: [],
fontTypes: []
@ -50015,11 +50018,11 @@ @@ -50015,11 +50018,11 @@
trailerDict.assignXref(this);
this.trailer = trailerDict;
var encrypt = trailerDict.get('Encrypt');
if (encrypt) {
if (isDict(encrypt)) {
var ids = trailerDict.get('ID');
var fileId = ids && ids.length ? ids[0] : '';
encrypt.suppressEncryption = true;
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.password);
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
}
if (!(this.root = trailerDict.get('Root'))) {
error('Invalid root reference');
@ -55552,21 +55555,19 @@ @@ -55552,21 +55555,19 @@
var PDFDocument = function PDFDocumentClosure() {
var FINGERPRINT_FIRST_BYTES = 1024;
var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
function PDFDocument(pdfManager, arg, password) {
function PDFDocument(pdfManager, arg) {
var stream;
if (isStream(arg)) {
init.call(this, pdfManager, arg, password);
stream = arg;
} else if (isArrayBuffer(arg)) {
init.call(this, pdfManager, new Stream(arg), password);
stream = new Stream(arg);
} else {
error('PDFDocument: Unknown argument type');
}
}
function init(pdfManager, stream, password) {
assert(stream.length > 0, 'stream must have data');
this.pdfManager = pdfManager;
this.stream = stream;
var xref = new XRef(this.stream, password, pdfManager);
this.xref = xref;
this.xref = new XRef(stream, pdfManager);
}
function find(stream, needle, limit, backwards) {
var pos = stream.pos;
@ -55799,6 +55800,9 @@ @@ -55799,6 +55800,9 @@
get docId() {
return this._docId;
},
get password() {
return this._password;
},
get docBaseUrl() {
var docBaseUrl = null;
if (this._docBaseUrl) {
@ -55842,14 +55846,7 @@ @@ -55842,14 +55846,7 @@
return new NotImplementedException();
},
updatePassword: function BasePdfManager_updatePassword(password) {
this.pdfDocument.xref.password = this.password = password;
if (this._passwordChangedCapability) {
this._passwordChangedCapability.resolve();
}
},
passwordChanged: function BasePdfManager_passwordChanged() {
this._passwordChangedCapability = createPromiseCapability();
return this._passwordChangedCapability.promise;
this._password = password;
},
terminate: function BasePdfManager_terminate() {
return new NotImplementedException();
@ -55860,10 +55857,11 @@ @@ -55860,10 +55857,11 @@
var LocalPdfManager = function LocalPdfManagerClosure() {
function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
this._docId = docId;
this._password = password;
this._docBaseUrl = docBaseUrl;
this.evaluatorOptions = evaluatorOptions;
var stream = new Stream(data);
this.pdfDocument = new PDFDocument(this, stream, password);
this.pdfDocument = new PDFDocument(this, stream);
this._loadedStreamCapability = createPromiseCapability();
this._loadedStreamCapability.resolve(stream);
}
@ -55902,6 +55900,7 @@ @@ -55902,6 +55900,7 @@
var NetworkPdfManager = function NetworkPdfManagerClosure() {
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
this._docId = docId;
this._password = args.password;
this._docBaseUrl = docBaseUrl;
this.msgHandler = args.msgHandler;
this.evaluatorOptions = evaluatorOptions;
@ -55913,7 +55912,7 @@ @@ -55913,7 +55912,7 @@
rangeChunkSize: args.rangeChunkSize
};
this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(), args.password);
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
}
Util.inherit(NetworkPdfManager, BasePdfManager, {
ensure: function NetworkPdfManager_ensure(obj, prop, args) {
@ -56415,18 +56414,23 @@ @@ -56415,18 +56414,23 @@
};
return pdfManagerCapability.promise;
}
var setupDoc = function (data) {
var onSuccess = function (doc) {
function setupDoc(data) {
function onSuccess(doc) {
ensureNotTerminated();
handler.send('GetDoc', { pdfInfo: doc });
};
var onFailure = function (e) {
if (e instanceof PasswordException) {
if (e.code === PasswordResponses.NEED_PASSWORD) {
handler.send('NeedPassword', e);
} else if (e.code === PasswordResponses.INCORRECT_PASSWORD) {
handler.send('IncorrectPassword', e);
}
function onFailure(e) {
if (e instanceof PasswordException) {
var task = new WorkerTask('PasswordException: response ' + e.code);
startWorkerTask(task);
handler.sendWithPromise('PasswordRequest', e).then(function (data) {
finishWorkerTask(task);
pdfManager.updatePassword(data.password);
pdfManagerReady();
}).catch(function (ex) {
finishWorkerTask(task);
handler.send('PasswordException', ex);
}.bind(null, e));
} else if (e instanceof InvalidPDFException) {
handler.send('InvalidPDF', e);
} else if (e instanceof MissingPDFException) {
@ -56436,7 +56440,22 @@ @@ -56436,7 +56440,22 @@
} else {
handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
}
};
}
function pdfManagerReady() {
ensureNotTerminated();
loadDocument(false).then(onSuccess, function loadFailure(ex) {
ensureNotTerminated();
if (!(ex instanceof XRefParseException)) {
onFailure(ex);
return;
}
pdfManager.requestLoadedStream();
pdfManager.onLoadedStream().then(function () {
ensureNotTerminated();
loadDocument(true).then(onSuccess, onFailure);
});
}, onFailure);
}
ensureNotTerminated();
var cMapOptions = {
url: data.cMapUrl === undefined ? null : data.cMapUrl,
@ -56458,25 +56477,8 @@ @@ -56458,25 +56477,8 @@
pdfManager.onLoadedStream().then(function (stream) {
handler.send('DataLoaded', { length: stream.bytes.byteLength });
});
}).then(function pdfManagerReady() {
ensureNotTerminated();
loadDocument(false).then(onSuccess, function loadFailure(ex) {
ensureNotTerminated();
if (!(ex instanceof XRefParseException)) {
if (ex instanceof PasswordException) {
pdfManager.passwordChanged().then(pdfManagerReady);
}
onFailure(ex);
return;
}).then(pdfManagerReady, onFailure);
}
pdfManager.requestLoadedStream();
pdfManager.onLoadedStream().then(function () {
ensureNotTerminated();
loadDocument(true).then(onSuccess, onFailure);
});
}, onFailure);
}, onFailure);
};
handler.on('GetPage', function wphSetupGetPage(data) {
return pdfManager.getPage(data.pageIndex).then(function (page) {
var rotatePromise = pdfManager.ensure(page, 'rotate');
@ -56536,9 +56538,6 @@ @@ -56536,9 +56538,6 @@
handler.on('GetStats', function wphSetupGetStats(data) {
return pdfManager.pdfDocument.xref.stats;
});
handler.on('UpdatePassword', function wphSetupUpdatePassword(data) {
pdfManager.updatePassword(data);
});
handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
return pdfManager.getPage(data.pageIndex).then(function (page) {
return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);

31
build/pdf.js

@ -23,8 +23,8 @@ @@ -23,8 +23,8 @@
}
}(this, function (exports) {
'use strict';
var pdfjsVersion = '1.6.419';
var pdfjsBuild = '4e62562';
var pdfjsVersion = '1.6.422';
var pdfjsBuild = 'aabfb77';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {};
(function pdfjsWrapper() {
@ -8352,6 +8352,7 @@ @@ -8352,6 +8352,7 @@
this.fontLoader = new FontLoader(loadingTask.docId);
this.destroyed = false;
this.destroyCapability = null;
this._passwordCapability = null;
this.pageCache = [];
this.pagePromises = [];
this.downloadInfoCapability = createPromiseCapability();
@ -8364,6 +8365,9 @@ @@ -8364,6 +8365,9 @@
}
this.destroyed = true;
this.destroyCapability = createPromiseCapability();
if (this._passwordCapability) {
this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback'));
}
var waitOn = [];
this.pageCache.forEach(function (page) {
if (page) {
@ -8391,9 +8395,7 @@ @@ -8391,9 +8395,7 @@
},
setupMessageHandler: function WorkerTransport_setupMessageHandler() {
var messageHandler = this.messageHandler;
function updatePassword(password) {
messageHandler.send('UpdatePassword', password);
}
var loadingTask = this.loadingTask;
var pdfDataRangeTransport = this.pdfDataRangeTransport;
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
@ -8420,18 +8422,19 @@ @@ -8420,18 +8422,19 @@
this.pdfDocument = pdfDocument;
loadingTask._capability.resolve(pdfDocument);
}, this);
messageHandler.on('NeedPassword', function transportNeedPassword(exception) {
var loadingTask = this.loadingTask;
messageHandler.on('PasswordRequest', function transportPasswordRequest(exception) {
this._passwordCapability = createPromiseCapability();
if (loadingTask.onPassword) {
return loadingTask.onPassword(updatePassword, PasswordResponses.NEED_PASSWORD);
var updatePassword = function (password) {
this._passwordCapability.resolve({ password: password });
}.bind(this);
loadingTask.onPassword(updatePassword, exception.code);
} else {
this._passwordCapability.reject(new PasswordException(exception.message, exception.code));
}
loadingTask._capability.reject(new PasswordException(exception.message, exception.code));
return this._passwordCapability.promise;
}, this);
messageHandler.on('IncorrectPassword', function transportIncorrectPassword(exception) {
var loadingTask = this.loadingTask;
if (loadingTask.onPassword) {
return loadingTask.onPassword(updatePassword, PasswordResponses.INCORRECT_PASSWORD);
}
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {

6
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

104
build/pdf.worker.js vendored

@ -23,8 +23,8 @@ @@ -23,8 +23,8 @@
}
}(this, function (exports) {
'use strict';
var pdfjsVersion = '1.6.419';
var pdfjsBuild = '4e62562';
var pdfjsVersion = '1.6.422';
var pdfjsBuild = 'aabfb77';
var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null;
var pdfjsLibs = {};
(function pdfjsWrapper() {
@ -43324,12 +43324,12 @@ @@ -43324,12 +43324,12 @@
return Catalog;
}();
var XRef = function XRefClosure() {
function XRef(stream, password) {
function XRef(stream, pdfManager) {
this.stream = stream;
this.pdfManager = pdfManager;
this.entries = [];
this.xrefstms = Object.create(null);
this.cache = [];
this.password = password;
this.stats = {
streamTypes: [],
fontTypes: []
@ -43350,11 +43350,11 @@ @@ -43350,11 +43350,11 @@
trailerDict.assignXref(this);
this.trailer = trailerDict;
var encrypt = trailerDict.get('Encrypt');
if (encrypt) {
if (isDict(encrypt)) {
var ids = trailerDict.get('ID');
var fileId = ids && ids.length ? ids[0] : '';
encrypt.suppressEncryption = true;
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.password);
this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
}
if (!(this.root = trailerDict.get('Root'))) {
error('Invalid root reference');
@ -48887,21 +48887,19 @@ @@ -48887,21 +48887,19 @@
var PDFDocument = function PDFDocumentClosure() {
var FINGERPRINT_FIRST_BYTES = 1024;
var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
function PDFDocument(pdfManager, arg, password) {
function PDFDocument(pdfManager, arg) {
var stream;
if (isStream(arg)) {
init.call(this, pdfManager, arg, password);
stream = arg;
} else if (isArrayBuffer(arg)) {
init.call(this, pdfManager, new Stream(arg), password);
stream = new Stream(arg);
} else {
error('PDFDocument: Unknown argument type');
}
}
function init(pdfManager, stream, password) {
assert(stream.length > 0, 'stream must have data');
this.pdfManager = pdfManager;
this.stream = stream;
var xref = new XRef(this.stream, password, pdfManager);
this.xref = xref;
this.xref = new XRef(stream, pdfManager);
}
function find(stream, needle, limit, backwards) {
var pos = stream.pos;
@ -49134,6 +49132,9 @@ @@ -49134,6 +49132,9 @@
get docId() {
return this._docId;
},
get password() {
return this._password;
},
get docBaseUrl() {
var docBaseUrl = null;
if (this._docBaseUrl) {
@ -49177,14 +49178,7 @@ @@ -49177,14 +49178,7 @@
return new NotImplementedException();
},
updatePassword: function BasePdfManager_updatePassword(password) {
this.pdfDocument.xref.password = this.password = password;
if (this._passwordChangedCapability) {
this._passwordChangedCapability.resolve();
}
},
passwordChanged: function BasePdfManager_passwordChanged() {
this._passwordChangedCapability = createPromiseCapability();
return this._passwordChangedCapability.promise;
this._password = password;
},
terminate: function BasePdfManager_terminate() {
return new NotImplementedException();
@ -49195,10 +49189,11 @@ @@ -49195,10 +49189,11 @@
var LocalPdfManager = function LocalPdfManagerClosure() {
function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
this._docId = docId;
this._password = password;
this._docBaseUrl = docBaseUrl;
this.evaluatorOptions = evaluatorOptions;
var stream = new Stream(data);
this.pdfDocument = new PDFDocument(this, stream, password);
this.pdfDocument = new PDFDocument(this, stream);
this._loadedStreamCapability = createPromiseCapability();
this._loadedStreamCapability.resolve(stream);
}
@ -49237,6 +49232,7 @@ @@ -49237,6 +49232,7 @@
var NetworkPdfManager = function NetworkPdfManagerClosure() {
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
this._docId = docId;
this._password = args.password;
this._docBaseUrl = docBaseUrl;
this.msgHandler = args.msgHandler;
this.evaluatorOptions = evaluatorOptions;
@ -49248,7 +49244,7 @@ @@ -49248,7 +49244,7 @@
rangeChunkSize: args.rangeChunkSize
};
this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params);
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream(), args.password);
this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
}
Util.inherit(NetworkPdfManager, BasePdfManager, {
ensure: function NetworkPdfManager_ensure(obj, prop, args) {
@ -49750,18 +49746,23 @@ @@ -49750,18 +49746,23 @@
};
return pdfManagerCapability.promise;
}
var setupDoc = function (data) {
var onSuccess = function (doc) {
function setupDoc(data) {
function onSuccess(doc) {
ensureNotTerminated();
handler.send('GetDoc', { pdfInfo: doc });
};
var onFailure = function (e) {
if (e instanceof PasswordException) {
if (e.code === PasswordResponses.NEED_PASSWORD) {
handler.send('NeedPassword', e);
} else if (e.code === PasswordResponses.INCORRECT_PASSWORD) {
handler.send('IncorrectPassword', e);
}
function onFailure(e) {
if (e instanceof PasswordException) {
var task = new WorkerTask('PasswordException: response ' + e.code);
startWorkerTask(task);
handler.sendWithPromise('PasswordRequest', e).then(function (data) {
finishWorkerTask(task);
pdfManager.updatePassword(data.password);
pdfManagerReady();
}).catch(function (ex) {
finishWorkerTask(task);
handler.send('PasswordException', ex);
}.bind(null, e));
} else if (e instanceof InvalidPDFException) {
handler.send('InvalidPDF', e);
} else if (e instanceof MissingPDFException) {
@ -49771,7 +49772,22 @@ @@ -49771,7 +49772,22 @@
} else {
handler.send('UnknownError', new UnknownErrorException(e.message, e.toString()));
}
};
}
function pdfManagerReady() {
ensureNotTerminated();
loadDocument(false).then(onSuccess, function loadFailure(ex) {
ensureNotTerminated();
if (!(ex instanceof XRefParseException)) {
onFailure(ex);
return;
}
pdfManager.requestLoadedStream();
pdfManager.onLoadedStream().then(function () {
ensureNotTerminated();
loadDocument(true).then(onSuccess, onFailure);
});
}, onFailure);
}
ensureNotTerminated();
var cMapOptions = {
url: data.cMapUrl === undefined ? null : data.cMapUrl,
@ -49793,25 +49809,8 @@ @@ -49793,25 +49809,8 @@
pdfManager.onLoadedStream().then(function (stream) {
handler.send('DataLoaded', { length: stream.bytes.byteLength });
});
}).then(function pdfManagerReady() {
ensureNotTerminated();
loadDocument(false).then(onSuccess, function loadFailure(ex) {
ensureNotTerminated();
if (!(ex instanceof XRefParseException)) {
if (ex instanceof PasswordException) {
pdfManager.passwordChanged().then(pdfManagerReady);
}
onFailure(ex);
return;
}).then(pdfManagerReady, onFailure);
}
pdfManager.requestLoadedStream();
pdfManager.onLoadedStream().then(function () {
ensureNotTerminated();
loadDocument(true).then(onSuccess, onFailure);
});
}, onFailure);
}, onFailure);
};
handler.on('GetPage', function wphSetupGetPage(data) {
return pdfManager.getPage(data.pageIndex).then(function (page) {
var rotatePromise = pdfManager.ensure(page, 'rotate');
@ -49871,9 +49870,6 @@ @@ -49871,9 +49870,6 @@
handler.on('GetStats', function wphSetupGetStats(data) {
return pdfManager.pdfDocument.xref.stats;
});
handler.on('UpdatePassword', function wphSetupUpdatePassword(data) {
pdfManager.updatePassword(data);
});
handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
return pdfManager.getPage(data.pageIndex).then(function (page) {
return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);

24
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

2
package.json

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

Loading…
Cancel
Save