From 835d8294d8324452855b36e11f138857ceaea459 Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Mon, 22 Sep 2014 16:34:59 -0500 Subject: [PATCH] PDF.js version 1.0.780 --- bower.json | 2 +- build/pdf.combined.js | 102 +++++++++++++++++++++++++----------------- build/pdf.js | 65 ++++++++++++++++++--------- build/pdf.worker.js | 60 +++++++++++++++---------- package.json | 2 +- 5 files changed, 145 insertions(+), 86 deletions(-) diff --git a/bower.json b/bower.json index a08e81a22..66926b263 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.0.774", + "version": "1.0.780", "keywords": [ "Mozilla", "pdf", diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 668d321d4..d10d2244b 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.774'; -PDFJS.build = 'e096669'; +PDFJS.version = '1.0.780'; +PDFJS.build = 'ffb613b'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -373,6 +373,7 @@ var PasswordException = (function PasswordExceptionClosure() { return PasswordException; })(); +PDFJS.PasswordException = PasswordException; var UnknownErrorException = (function UnknownErrorExceptionClosure() { function UnknownErrorException(msg, details) { @@ -386,6 +387,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() { return UnknownErrorException; })(); +PDFJS.UnknownErrorException = UnknownErrorException; var InvalidPDFException = (function InvalidPDFExceptionClosure() { function InvalidPDFException(msg) { @@ -398,6 +400,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() { return InvalidPDFException; })(); +PDFJS.InvalidPDFException = InvalidPDFException; var MissingPDFException = (function MissingPDFExceptionClosure() { function MissingPDFException(msg) { @@ -410,6 +413,22 @@ var MissingPDFException = (function MissingPDFExceptionClosure() { return MissingPDFException; })(); +PDFJS.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = + (function UnexpectedResponseExceptionClosure() { + function UnexpectedResponseException(msg, status) { + this.name = 'UnexpectedResponseException'; + this.message = msg; + this.status = status; + } + + UnexpectedResponseException.prototype = new Error(); + UnexpectedResponseException.constructor = UnexpectedResponseException; + + return UnexpectedResponseException; +})(); +PDFJS.UnexpectedResponseException = UnexpectedResponseException; var NotImplementedException = (function NotImplementedExceptionClosure() { function NotImplementedException(msg) { @@ -2380,36 +2399,46 @@ var WorkerTransport = (function WorkerTransportClosure() { this.workerReadyCapability.resolve(pdfDocument); }, this); - messageHandler.on('NeedPassword', function transportPassword(data) { + messageHandler.on('NeedPassword', + function transportNeedPassword(exception) { if (this.passwordCallback) { return this.passwordCallback(updatePassword, PasswordResponses.NEED_PASSWORD); } - this.workerReadyCapability.reject(data.exception.message, - data.exception); + this.workerReadyCapability.reject( + new PasswordException(exception.message, exception.code)); }, this); - messageHandler.on('IncorrectPassword', function transportBadPass(data) { + messageHandler.on('IncorrectPassword', + function transportIncorrectPassword(exception) { if (this.passwordCallback) { return this.passwordCallback(updatePassword, PasswordResponses.INCORRECT_PASSWORD); } - this.workerReadyCapability.reject(data.exception.message, - data.exception); + this.workerReadyCapability.reject( + new PasswordException(exception.message, exception.code)); + }, this); + + messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { + this.workerReadyCapability.reject( + new InvalidPDFException(exception.message)); }, this); - messageHandler.on('InvalidPDF', function transportInvalidPDF(data) { - this.workerReadyCapability.reject(data.exception.name, data.exception); + messageHandler.on('MissingPDF', function transportMissingPDF(exception) { + this.workerReadyCapability.reject( + new MissingPDFException(exception.message)); }, this); - messageHandler.on('MissingPDF', function transportMissingPDF(data) { - this.workerReadyCapability.reject(data.exception.message, - data.exception); + messageHandler.on('UnexpectedResponse', + function transportUnexpectedResponse(exception) { + this.workerReadyCapability.reject( + new UnexpectedResponseException(exception.message, exception.status)); }, this); - messageHandler.on('UnknownError', function transportUnknownError(data) { - this.workerReadyCapability.reject(data.exception.message, - data.exception); + messageHandler.on('UnknownError', + function transportUnknownError(exception) { + this.workerReadyCapability.reject( + new UnknownErrorException(exception.message, exception.details)); }, this); messageHandler.on('DataLoaded', function transportPage(data) { @@ -2505,10 +2534,6 @@ var WorkerTransport = (function WorkerTransportClosure() { } }, this); - messageHandler.on('DocError', function transportDocError(data) { - this.workerReadyCapability.reject(data); - }, this); - messageHandler.on('PageError', function transportError(data) { var page = this.pageCache[data.pageNum - 1]; var intentState = page.intentStates[data.intent]; @@ -39422,14 +39447,16 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { }, onError: function onError(status) { + var exception; if (status === 404) { - var exception = new MissingPDFException('Missing PDF "' + - source.url + '".'); - handler.send('MissingPDF', { exception: exception }); + exception = new MissingPDFException('Missing PDF "' + + source.url + '".'); + handler.send('MissingPDF', exception); } else { - handler.send('DocError', 'Unexpected server response (' + - status + ') while retrieving PDF "' + - source.url + '".'); + exception = new UnexpectedResponseException( + 'Unexpected server response (' + status + + ') while retrieving PDF "' + source.url + '".', status); + handler.send('UnexpectedResponse', exception); } }, @@ -39481,26 +39508,19 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { var onFailure = function(e) { if (e instanceof PasswordException) { if (e.code === PasswordResponses.NEED_PASSWORD) { - handler.send('NeedPassword', { - exception: e - }); + handler.send('NeedPassword', e); } else if (e.code === PasswordResponses.INCORRECT_PASSWORD) { - handler.send('IncorrectPassword', { - exception: e - }); + handler.send('IncorrectPassword', e); } } else if (e instanceof InvalidPDFException) { - handler.send('InvalidPDF', { - exception: e - }); + handler.send('InvalidPDF', e); } else if (e instanceof MissingPDFException) { - handler.send('MissingPDF', { - exception: e - }); + handler.send('MissingPDF', e); + } else if (e instanceof UnexpectedResponseException) { + handler.send('UnexpectedResponse', e); } else { - handler.send('UnknownError', { - exception: new UnknownErrorException(e.message, e.toString()) - }); + handler.send('UnknownError', + new UnknownErrorException(e.message, e.toString())); } }; diff --git a/build/pdf.js b/build/pdf.js index f0f866fca..99719ac1b 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.774'; -PDFJS.build = 'e096669'; +PDFJS.version = '1.0.780'; +PDFJS.build = 'ffb613b'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -373,6 +373,7 @@ var PasswordException = (function PasswordExceptionClosure() { return PasswordException; })(); +PDFJS.PasswordException = PasswordException; var UnknownErrorException = (function UnknownErrorExceptionClosure() { function UnknownErrorException(msg, details) { @@ -386,6 +387,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() { return UnknownErrorException; })(); +PDFJS.UnknownErrorException = UnknownErrorException; var InvalidPDFException = (function InvalidPDFExceptionClosure() { function InvalidPDFException(msg) { @@ -398,6 +400,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() { return InvalidPDFException; })(); +PDFJS.InvalidPDFException = InvalidPDFException; var MissingPDFException = (function MissingPDFExceptionClosure() { function MissingPDFException(msg) { @@ -410,6 +413,22 @@ var MissingPDFException = (function MissingPDFExceptionClosure() { return MissingPDFException; })(); +PDFJS.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = + (function UnexpectedResponseExceptionClosure() { + function UnexpectedResponseException(msg, status) { + this.name = 'UnexpectedResponseException'; + this.message = msg; + this.status = status; + } + + UnexpectedResponseException.prototype = new Error(); + UnexpectedResponseException.constructor = UnexpectedResponseException; + + return UnexpectedResponseException; +})(); +PDFJS.UnexpectedResponseException = UnexpectedResponseException; var NotImplementedException = (function NotImplementedExceptionClosure() { function NotImplementedException(msg) { @@ -2424,36 +2443,46 @@ var WorkerTransport = (function WorkerTransportClosure() { this.workerReadyCapability.resolve(pdfDocument); }, this); - messageHandler.on('NeedPassword', function transportPassword(data) { + messageHandler.on('NeedPassword', + function transportNeedPassword(exception) { if (this.passwordCallback) { return this.passwordCallback(updatePassword, PasswordResponses.NEED_PASSWORD); } - this.workerReadyCapability.reject(data.exception.message, - data.exception); + this.workerReadyCapability.reject( + new PasswordException(exception.message, exception.code)); }, this); - messageHandler.on('IncorrectPassword', function transportBadPass(data) { + messageHandler.on('IncorrectPassword', + function transportIncorrectPassword(exception) { if (this.passwordCallback) { return this.passwordCallback(updatePassword, PasswordResponses.INCORRECT_PASSWORD); } - this.workerReadyCapability.reject(data.exception.message, - data.exception); + this.workerReadyCapability.reject( + new PasswordException(exception.message, exception.code)); + }, this); + + messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { + this.workerReadyCapability.reject( + new InvalidPDFException(exception.message)); }, this); - messageHandler.on('InvalidPDF', function transportInvalidPDF(data) { - this.workerReadyCapability.reject(data.exception.name, data.exception); + messageHandler.on('MissingPDF', function transportMissingPDF(exception) { + this.workerReadyCapability.reject( + new MissingPDFException(exception.message)); }, this); - messageHandler.on('MissingPDF', function transportMissingPDF(data) { - this.workerReadyCapability.reject(data.exception.message, - data.exception); + messageHandler.on('UnexpectedResponse', + function transportUnexpectedResponse(exception) { + this.workerReadyCapability.reject( + new UnexpectedResponseException(exception.message, exception.status)); }, this); - messageHandler.on('UnknownError', function transportUnknownError(data) { - this.workerReadyCapability.reject(data.exception.message, - data.exception); + messageHandler.on('UnknownError', + function transportUnknownError(exception) { + this.workerReadyCapability.reject( + new UnknownErrorException(exception.message, exception.details)); }, this); messageHandler.on('DataLoaded', function transportPage(data) { @@ -2549,10 +2578,6 @@ var WorkerTransport = (function WorkerTransportClosure() { } }, this); - messageHandler.on('DocError', function transportDocError(data) { - this.workerReadyCapability.reject(data); - }, this); - messageHandler.on('PageError', function transportError(data) { var page = this.pageCache[data.pageNum - 1]; var intentState = page.intentStates[data.intent]; diff --git a/build/pdf.worker.js b/build/pdf.worker.js index 75a6a8320..7df64ef17 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -22,8 +22,8 @@ if (typeof PDFJS === 'undefined') { (typeof window !== 'undefined' ? window : this).PDFJS = {}; } -PDFJS.version = '1.0.774'; -PDFJS.build = 'e096669'; +PDFJS.version = '1.0.780'; +PDFJS.build = 'ffb613b'; (function pdfjsWrapper() { // Use strict in our context only - users might not want it @@ -373,6 +373,7 @@ var PasswordException = (function PasswordExceptionClosure() { return PasswordException; })(); +PDFJS.PasswordException = PasswordException; var UnknownErrorException = (function UnknownErrorExceptionClosure() { function UnknownErrorException(msg, details) { @@ -386,6 +387,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() { return UnknownErrorException; })(); +PDFJS.UnknownErrorException = UnknownErrorException; var InvalidPDFException = (function InvalidPDFExceptionClosure() { function InvalidPDFException(msg) { @@ -398,6 +400,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() { return InvalidPDFException; })(); +PDFJS.InvalidPDFException = InvalidPDFException; var MissingPDFException = (function MissingPDFExceptionClosure() { function MissingPDFException(msg) { @@ -410,6 +413,22 @@ var MissingPDFException = (function MissingPDFExceptionClosure() { return MissingPDFException; })(); +PDFJS.MissingPDFException = MissingPDFException; + +var UnexpectedResponseException = + (function UnexpectedResponseExceptionClosure() { + function UnexpectedResponseException(msg, status) { + this.name = 'UnexpectedResponseException'; + this.message = msg; + this.status = status; + } + + UnexpectedResponseException.prototype = new Error(); + UnexpectedResponseException.constructor = UnexpectedResponseException; + + return UnexpectedResponseException; +})(); +PDFJS.UnexpectedResponseException = UnexpectedResponseException; var NotImplementedException = (function NotImplementedExceptionClosure() { function NotImplementedException(msg) { @@ -33387,14 +33406,16 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { }, onError: function onError(status) { + var exception; if (status === 404) { - var exception = new MissingPDFException('Missing PDF "' + - source.url + '".'); - handler.send('MissingPDF', { exception: exception }); + exception = new MissingPDFException('Missing PDF "' + + source.url + '".'); + handler.send('MissingPDF', exception); } else { - handler.send('DocError', 'Unexpected server response (' + - status + ') while retrieving PDF "' + - source.url + '".'); + exception = new UnexpectedResponseException( + 'Unexpected server response (' + status + + ') while retrieving PDF "' + source.url + '".', status); + handler.send('UnexpectedResponse', exception); } }, @@ -33446,26 +33467,19 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = { var onFailure = function(e) { if (e instanceof PasswordException) { if (e.code === PasswordResponses.NEED_PASSWORD) { - handler.send('NeedPassword', { - exception: e - }); + handler.send('NeedPassword', e); } else if (e.code === PasswordResponses.INCORRECT_PASSWORD) { - handler.send('IncorrectPassword', { - exception: e - }); + handler.send('IncorrectPassword', e); } } else if (e instanceof InvalidPDFException) { - handler.send('InvalidPDF', { - exception: e - }); + handler.send('InvalidPDF', e); } else if (e instanceof MissingPDFException) { - handler.send('MissingPDF', { - exception: e - }); + handler.send('MissingPDF', e); + } else if (e instanceof UnexpectedResponseException) { + handler.send('UnexpectedResponse', e); } else { - handler.send('UnknownError', { - exception: new UnknownErrorException(e.message, e.toString()) - }); + handler.send('UnknownError', + new UnknownErrorException(e.message, e.toString())); } }; diff --git a/package.json b/package.json index 265f65748..df7b18726 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.0.774", + "version": "1.0.780", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ "Mozilla",