mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Refactor the password
handling so that it's stored in the PdfManager
s, instead of in the XRef
We're already passing in a, currently unused, `PdfManager` instance when initializing the `XRef`. To avoid having to pass a single `password` parameter around, we could thus simply get the `password` through the `PdfManager` instance instead.
This commit is contained in:
parent
27513cd23b
commit
14b8523314
3 changed files with 19 additions and 16 deletions
|
@ -370,22 +370,20 @@ var PDFDocument = (function PDFDocumentClosure() {
|
|||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue