Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardUpload.js |
— | — | @@ -586,21 +586,23 @@ |
587 | 587 | |
588 | 588 | /** |
589 | 589 | * Get the upload handler per browser capabilities |
| 590 | + * @return upload handler object |
590 | 591 | */ |
591 | 592 | getUploadHandler: function(){ |
592 | | - if( !this.uploadHandler ){ |
| 593 | + if( !this.uploadHandler ) { |
| 594 | + var constructor; // must be the name of a function in 'mw' namespace |
593 | 595 | if( mw.UploadWizard.config[ 'enableFirefogg' ] && typeof( Firefogg ) != 'undefined' ) { |
594 | | - mw.log("mw.UploadWizard::getUploadHandler> FirefoggHandler"); |
595 | | - this.uploadHandler = new mw.FirefoggHandler( this, this.api ); |
| 596 | + constructor = 'FirefoggHandler'; |
596 | 597 | } else if( mw.UploadWizard.config[ 'enableFormData' ] && mw.fileApi.isSliceAvailable()) { |
597 | | - mw.log("mw.UploadWizard::getUploadHandler> ApiUploadFormDataHandler"); |
598 | | - this.uploadHandler = new mw.ApiUploadFormDataHandler( this, this.api ); |
| 598 | + constructor = 'ApiUploadFormDataHandler'; |
599 | 599 | } else { |
600 | | - // By default use the apiUploadHandler |
601 | | - mw.log("mw.UploadWizard::getUploadHandler> ApiUploadHandler"); |
602 | | - this.uploadHandler = new mw.ApiUploadHandler( this, this.api ); |
| 600 | + constructor = 'ApiUploadHandler'; |
603 | 601 | } |
604 | | - } |
| 602 | + this.uploadHandler = new mw[constructor]( this, this.api ); |
| 603 | + if ( mw.UploadWizard.config.debug ) { |
| 604 | + mw.log( 'mw.UploadWizard::getUploadHandler> ' + constructor ); |
| 605 | + } |
| 606 | + } |
605 | 607 | return this.uploadHandler; |
606 | 608 | }, |
607 | 609 | |