Support password and add the relevant l10n strings

This commit is contained in:
Jakob Miland 2012-05-14 20:45:07 +02:00
parent b7ea788b0c
commit 0a30d3961b
9 changed files with 122 additions and 39 deletions

View file

@ -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);
}
},