1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Fix the exception propagation when rejecting workerReadyCapability

Currently when an exception is thrown, we try to reject `workerReadyCapability` with multiple arguments in src/core/api.js. This obviously doesn't work, hence this patch changes that to instead reject with the exception object as is.
In src/core/worker.js the exception is currently (unncessarily) wrapped in an object, so this patch also simplifies that to directly send the exception object instead.
This commit is contained in:
Jonas Jenwald 2014-08-23 16:03:49 +02:00
parent b3be74d81c
commit ca027ebfdb
3 changed files with 40 additions and 40 deletions

View file

@ -672,24 +672,29 @@ var PDFView = {
self.load(pdfDocument, scale);
self.loading = false;
},
function getDocumentError(message, exception) {
function getDocumentError(exception) {
var name, message;
if (exception) {
name = exception.name;
message = exception.message;
}
var loadingErrorMessage = mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.');
if (exception && exception.name === 'InvalidPDFException') {
if (name === 'InvalidPDFException') {
// change error message also for other builds
loadingErrorMessage = mozL10n.get('invalid_file_error', null,
'Invalid or corrupted PDF file.');
'Invalid or corrupted PDF file.');
//#if B2G
// window.alert(loadingErrorMessage);
// return window.close();
//#endif
}
if (exception && exception.name === 'MissingPDFException') {
if (name === 'MissingPDFException') {
// special message for missing PDF's
loadingErrorMessage = mozL10n.get('missing_file_error', null,
'Missing PDF file.');
'Missing PDF file.');
//#if B2G
// window.alert(loadingErrorMessage);