Change getDocumentError
in web/viewer.js to use instanceof
instead of the exception name
This commit is contained in:
parent
ca027ebfdb
commit
2701edc7c6
@ -342,6 +342,7 @@ var PasswordException = (function PasswordExceptionClosure() {
|
|||||||
|
|
||||||
return PasswordException;
|
return PasswordException;
|
||||||
})();
|
})();
|
||||||
|
PDFJS.PasswordException = PasswordException;
|
||||||
|
|
||||||
var UnknownErrorException = (function UnknownErrorExceptionClosure() {
|
var UnknownErrorException = (function UnknownErrorExceptionClosure() {
|
||||||
function UnknownErrorException(msg, details) {
|
function UnknownErrorException(msg, details) {
|
||||||
@ -355,6 +356,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() {
|
|||||||
|
|
||||||
return UnknownErrorException;
|
return UnknownErrorException;
|
||||||
})();
|
})();
|
||||||
|
PDFJS.UnknownErrorException = UnknownErrorException;
|
||||||
|
|
||||||
var InvalidPDFException = (function InvalidPDFExceptionClosure() {
|
var InvalidPDFException = (function InvalidPDFExceptionClosure() {
|
||||||
function InvalidPDFException(msg) {
|
function InvalidPDFException(msg) {
|
||||||
@ -367,6 +369,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() {
|
|||||||
|
|
||||||
return InvalidPDFException;
|
return InvalidPDFException;
|
||||||
})();
|
})();
|
||||||
|
PDFJS.InvalidPDFException = InvalidPDFException;
|
||||||
|
|
||||||
var MissingPDFException = (function MissingPDFExceptionClosure() {
|
var MissingPDFException = (function MissingPDFExceptionClosure() {
|
||||||
function MissingPDFException(msg) {
|
function MissingPDFException(msg) {
|
||||||
@ -379,6 +382,7 @@ var MissingPDFException = (function MissingPDFExceptionClosure() {
|
|||||||
|
|
||||||
return MissingPDFException;
|
return MissingPDFException;
|
||||||
})();
|
})();
|
||||||
|
PDFJS.MissingPDFException = MissingPDFException;
|
||||||
|
|
||||||
var NotImplementedException = (function NotImplementedExceptionClosure() {
|
var NotImplementedException = (function NotImplementedExceptionClosure() {
|
||||||
function NotImplementedException(msg) {
|
function NotImplementedException(msg) {
|
||||||
|
@ -673,15 +673,11 @@ var PDFView = {
|
|||||||
self.loading = false;
|
self.loading = false;
|
||||||
},
|
},
|
||||||
function getDocumentError(exception) {
|
function getDocumentError(exception) {
|
||||||
var name, message;
|
var message = exception && exception.message;
|
||||||
if (exception) {
|
|
||||||
name = exception.name;
|
|
||||||
message = exception.message;
|
|
||||||
}
|
|
||||||
var loadingErrorMessage = mozL10n.get('loading_error', null,
|
var loadingErrorMessage = mozL10n.get('loading_error', null,
|
||||||
'An error occurred while loading the PDF.');
|
'An error occurred while loading the PDF.');
|
||||||
|
|
||||||
if (name === 'InvalidPDFException') {
|
if (exception instanceof PDFJS.InvalidPDFException) {
|
||||||
// change error message also for other builds
|
// change error message also for other builds
|
||||||
loadingErrorMessage = mozL10n.get('invalid_file_error', null,
|
loadingErrorMessage = mozL10n.get('invalid_file_error', null,
|
||||||
'Invalid or corrupted PDF file.');
|
'Invalid or corrupted PDF file.');
|
||||||
@ -689,13 +685,10 @@ var PDFView = {
|
|||||||
// window.alert(loadingErrorMessage);
|
// window.alert(loadingErrorMessage);
|
||||||
// return window.close();
|
// return window.close();
|
||||||
//#endif
|
//#endif
|
||||||
}
|
} else if (exception instanceof PDFJS.MissingPDFException) {
|
||||||
|
|
||||||
if (name === 'MissingPDFException') {
|
|
||||||
// special message for missing PDF's
|
// special message for missing PDF's
|
||||||
loadingErrorMessage = mozL10n.get('missing_file_error', null,
|
loadingErrorMessage = mozL10n.get('missing_file_error', null,
|
||||||
'Missing PDF file.');
|
'Missing PDF file.');
|
||||||
|
|
||||||
//#if B2G
|
//#if B2G
|
||||||
// window.alert(loadingErrorMessage);
|
// window.alert(loadingErrorMessage);
|
||||||
// return window.close();
|
// return window.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user