r61723 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61722‎ | r61723 | r61724 >
Date:17:48, 30 January 2010
Author:dale
Status:deferred
Tags:
Comment:
bug 22320 ~ IE seems to error out when you update the "action" of a form. But when put it into a try catch it proceeds happy. ~who knows~
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/mw.BaseUploadInterface.js
@@ -179,7 +179,6 @@
180180
181181 // FIXME: move this to configuration and avoid this API request
182182 mw.getJSON( _this.api_url, { 'action' : 'paraminfo', 'modules' : 'upload' }, function( data ) {
183 - debugger;
184183 if ( typeof data.paraminfo == 'undefined'
185184 || typeof data.paraminfo.modules == 'undefined' )
186185 {
@@ -250,7 +249,11 @@
251250 var $form = $j( this.form_selector );
252251
253252 // Set the form action
254 - $form.attr('action', _this.api_url);
 253+ try{
 254+ $form.attr('action', _this.api_url);
 255+ }catch(e){
 256+ mw.log("IE for some reason error's out when you change the action")
 257+ }
255258
256259 // Add API action
257260 if ( $form.find( "[name='action']" ).length == 0 ){
@@ -304,32 +307,35 @@
305308 $j( '#upProgressDialog' ).html(
306309 mw.loading_spinner()
307310 );
308 -
 311+
309312 // Add the iframe
310313 _this.iframeId = 'f_' + ( $j( 'iframe' ).length + 1 );
311 - $j( "body" ).append( '<iframe src="javascript:false;" id="' + _this.iframeId + '" ' +
312 - 'name="' + _this.iframeId + '" style="display:none;" ></iframe>' );
 314+ $j( "body" ).append(
 315+ $j('<iframe />')
 316+ .attr({
 317+ 'src':'javascript:false;',
 318+ 'id':_this.iframeId,
 319+ 'name': _this.iframeId
 320+ })
 321+ .css('display', 'none')
 322+ );
313323
 324+
314325 // Set the form target to the iframe
315326 $form.attr( 'target', _this.iframeId );
 327+
316328
317329 // Set up the completion callback
318330 $j( '#' + _this.iframeId ).load( function() {
319331 _this.processIframeResult( $j( this ).get( 0 ) );
320 - });
321 -
322 - // Set the action to the API URL:
323 - $form.attr( 'action', _this.api_url );
324 -
325 - mw.log( 'Do iframe form submit of: ' + $form.attr( 'target' ) + ' to: ' + $form.attr('action') );
326 - mw.log( ' destName:' + $form.find( "[name='filename']" ).val() );
327 - mw.log( ' content:' + $form.find( "[name='comment']" ).val() );
328 -
 332+ });
 333+
329334 // Do post override
330335 _this.form_post_override = true;
331336
332337 // Reset the done with action flag
333338 _this.action_done = false;
 339+ mw.log("about to submit form:");
334340 $form.submit();
335341 },
336342
@@ -978,17 +984,26 @@
979985 // Add the wpDestFile-warning row
980986 if ( $j( '#wpDestFile-warning' ).length == 0 ) {
981987 $j( '#mw-htmlform-options tr:last' )
982 - .after( '<tr><td></td><td id="wpDestFile-warning"></td></tr>' );
 988+ .after(
 989+ $j('<tr />' )
 990+ .append( '<td />' )
 991+ .append( '<td />' )
 992+ .attr('id', 'wpDestFile-warning')
 993+ );
983994 }
984 -
 995+ mw.log( 'past dest');
985996 // Remove any existing warning
986997 $j( opt.warn_target ).empty();
987 -
 998+ mw.log( 'past remove warn:: ' + _this.selector);
988999 // Show the AJAX spinner
989 - $j( _this.selector )
990 - .append( '<img id="mw-spinner-wpDestFile" ' +
991 - 'src ="' + stylepath + '/common/images/spinner.gif" />' );
992 -
 1000+ $j( _this.selector ).after(
 1001+ $j('<img />')
 1002+ .attr({
 1003+ 'id' : "mw-spinner-wpDestFile",
 1004+ 'src' : stylepath + '/common/images/spinner.gif'
 1005+ })
 1006+ );
 1007+ mw.log("added spiner");
9931008 var request = {
9941009 'titles': 'File:' + $j( _this.selector ).val(),
9951010 'prop': 'imageinfo',

Status & tagging log