mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Support password and add the relevant l10n strings
This commit is contained in:
parent
b7ea788b0c
commit
0a30d3961b
9 changed files with 122 additions and 39 deletions
14
src/util.js
14
src/util.js
|
@ -58,6 +58,14 @@ function shadow(obj, prop, value) {
|
|||
return value;
|
||||
}
|
||||
|
||||
function PasswordException(msg, code) {
|
||||
this.name = 'PasswordException';
|
||||
this.message = msg;
|
||||
this.code = code;
|
||||
}
|
||||
PasswordException.prototype = new Error();
|
||||
PasswordException.constructor = PasswordException;
|
||||
|
||||
function bytesToString(bytes) {
|
||||
var str = '';
|
||||
var length = bytes.length;
|
||||
|
@ -456,7 +464,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||
}
|
||||
|
||||
this.isResolved = true;
|
||||
this.data = data || null;
|
||||
this.data = (typeof data !== 'undefined') ? data : null;
|
||||
var callbacks = this.callbacks;
|
||||
|
||||
for (var i = 0, ii = callbacks.length; i < ii; i++) {
|
||||
|
@ -471,7 +479,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||
}
|
||||
},
|
||||
|
||||
reject: function Promise_reject(reason) {
|
||||
reject: function Promise_reject(reason, exception) {
|
||||
if (this.isRejected) {
|
||||
error('A Promise can be rejected only once ' + this.name);
|
||||
}
|
||||
|
@ -484,7 +492,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() {
|
|||
var errbacks = this.errbacks;
|
||||
|
||||
for (var i = 0, ii = errbacks.length; i < ii; i++) {
|
||||
errbacks[i].call(null, reason);
|
||||
errbacks[i].call(null, reason, exception);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue