1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Display error messages on more problems.

This commit is contained in:
Brendan Dahl 2011-11-29 11:28:05 -08:00
parent 6dd706c0c3
commit b40af3555b
2 changed files with 59 additions and 28 deletions

View file

@ -39,11 +39,15 @@ function getPdf(arg, callback) {
if ('error' in params)
xhr.onerror = params.error || undefined;
xhr.onreadystatechange = function getPdfOnreadystatechange() {
if (xhr.readyState === 4 && xhr.status === xhr.expected) {
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
xhr.responseArrayBuffer || xhr.response);
callback(data);
xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
if (xhr.readyState === 4) {
if (xhr.status === xhr.expected) {
var data = (xhr.mozResponseArrayBuffer || xhr.mozResponse ||
xhr.responseArrayBuffer || xhr.response);
callback(data);
} else {
params.error(e);
}
}
};
xhr.send(null);