@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License .
* limitations under the License .
* /
* /
/ * g l o b a l s C a n v a s G r a p h i c s , c o m b i n e U r l , c r e a t e S c r a t c h C a n v a s , e r r o r ,
/ * g l o b a l s P D F J S , i s A r r a y B u f f e r , e r r o r , c o m b i n e U r l , c r e a t e P r o m i s e C a p a b i l i t y ,
FontLoad er, globalScope , info , isArrayBuffer , loadJpegStream ,
StatTim er, globalScope , MessageHandler , info , FontLoader , Util , warn ,
MessageHandler , PDFJS , Promise , StatTimer , war n,
PasswordResponses , PasswordException , InvalidPDFExceptio n,
PasswordResponses , Util , loadScript , createPromiseCapability ,
MissingPDFException , UnknownErrorException , FontFace , loadJpegStream ,
FontFace * /
createScratchCanvas , Promise , CanvasGraphics * /
'use strict' ;
'use strict' ;
@ -865,36 +865,40 @@ var WorkerTransport = (function WorkerTransportClosure() {
this . workerReadyCapability . resolve ( pdfDocument ) ;
this . workerReadyCapability . resolve ( pdfDocument ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'NeedPassword' , function transportPassword ( data ) {
messageHandler . on ( 'NeedPassword' ,
function transportNeedPassword ( exception ) {
if ( this . passwordCallback ) {
if ( this . passwordCallback ) {
return this . passwordCallback ( updatePassword ,
return this . passwordCallback ( updatePassword ,
PasswordResponses . NEED _PASSWORD ) ;
PasswordResponses . NEED _PASSWORD ) ;
}
}
this . workerReadyCapability . reject ( data . exception . message ,
this . workerReadyCapability . reject (
data . exception ) ;
new PasswordException ( exception . message , exception . code ) ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'IncorrectPassword' , function transportBadPass ( data ) {
messageHandler . on ( 'IncorrectPassword' ,
function transportIncorrectPassword ( exception ) {
if ( this . passwordCallback ) {
if ( this . passwordCallback ) {
return this . passwordCallback ( updatePassword ,
return this . passwordCallback ( updatePassword ,
PasswordResponses . INCORRECT _PASSWORD ) ;
PasswordResponses . INCORRECT _PASSWORD ) ;
}
}
this . workerReadyCapability . reject ( data . exception . message ,
this . workerReadyCapability . reject (
data . exception ) ;
new PasswordException ( exception . message , exception . code ) ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'InvalidPDF' , function transportInvalidPDF ( data ) {
messageHandler . on ( 'InvalidPDF' , function transportInvalidPDF ( exception ) {
this . workerReadyCapability . reject ( data . exception . name , data . exception ) ;
this . workerReadyCapability . reject (
new InvalidPDFException ( exception . message ) ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'MissingPDF' , function transportMissingPDF ( data ) {
messageHandler . on ( 'MissingPDF' , function transportMissingPDF ( exception ) {
this . workerReadyCapability . reject ( data . exception . message ,
this . workerReadyCapability . reject (
data . exception ) ;
new MissingPDFException ( exception . message ) ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'UnknownError' , function transportUnknownError ( data ) {
messageHandler . on ( 'UnknownError' ,
this . workerReadyCapability . reject ( data . exception . message ,
function transportUnknownError ( exception ) {
data . exception ) ;
this . workerReadyCapability . reject (
new UnknownErrorException ( exception . message , exception . details ) ) ;
} , this ) ;
} , this ) ;
messageHandler . on ( 'DataLoaded' , function transportPage ( data ) {
messageHandler . on ( 'DataLoaded' , function transportPage ( data ) {