r73649 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73648‎ | r73649 | r73650 >
Date:23:56, 23 September 2010
Author:dale
Status:deferred
Tags:
Comment:
preserve _this context in smil callback
Modified paths:
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -110,7 +110,7 @@
111111 loadFromString: function( smilXmlString ) {
112112 // Load the parsed string into the local "dom"
113113 this.$dom = $j( this.getXMLDomObject( smilXmlString ) );
114 - mw.log("Smil::loadFromString: loaded smil dom: " + this.$dom.length + "\n" + smilXmlString );
 114+ mw.log("Smil::loadFromString: loaded smil dom: " + this.$dom.children().length + "\n" + smilXmlString );
115115 },
116116 /**
117117 * Update the smil dom via an xmlString
@@ -298,7 +298,7 @@
299299 return 0;
300300 }
301301 if ( this.duration == null || forceRefresh === true ) {
302 - var orgDuration = this.duration
 302+ var orgDuration = this.duration;
303303 this.duration = this.getBody().getDuration( forceRefresh );
304304 // Trigger the duration change event:
305305 if( orgDuration != this.duration ){
@@ -404,7 +404,7 @@
405405 // Escape link output as to not include scirpt execution
406406 $j(link).attr('href',
407407 mw.escapeQuotesHTML( $j(link).attr('href') )
408 - )
 408+ );
409409 });
410410
411411 // Make every asset url absolute and restrict domain of assets
@@ -413,17 +413,17 @@
414414 if( $j(node).attr('src') ){
415415 $j(node).attr('src',
416416 _this.getAssetUrl( $j(node).attr('src') )
417 - )
 417+ );
418418 }
419419 if( $j(node).attr('data') ){
420420 $j(node).attr('data',
421421 _this.getAssetUrl( $j(node).attr('src') )
422 - )
 422+ );
423423 }
424 - // xxx don't know if we really need a form inside of smil.
 424+ // remove form action
425425 if( $j(node).attr('action') ){
426426 if( $j(node).attr('action').toLowerCase().indexOf('javascript') != -1 ){
427 - $j(node).attr('action')= null;
 427+ $j(node).attr('action', '');
428428 } else {
429429 $j(node).attr('action',
430430 _this.getAssetUrl( $j(node).attr('src') )
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
@@ -301,16 +301,17 @@
302302 * @param callback
303303 */
304304 getSmil: function( callback ){
 305+ var _this = this;
305306 if( !this.smil ) {
306307 // Create the Smil engine object
307308 this.smil = new mw.Smil( this );
308309
309310 // Load the smil
310311 this.smil.loadFromUrl( this.getSrc(), function(){
311 - callback( this.smil );
 312+ callback( _this.smil );
312313 });
313314 } else {
314 - callback( this.smil );
 315+ callback( _this.smil );
315316 }
316317 },
317318
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
@@ -187,7 +187,7 @@
188188 if( smilXml == '' ){
189189 smilXml = _this.getNewSmilXML();
190190 }
191 - _this.smilSource = _this.getDataUrl( smilXml );
 191+ _this.smilSource = _this.getDataUrl( smilXml );
192192 callback( _this.smilSource )
193193 })
194194 // Wait for server to return smil source
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
@@ -108,7 +108,7 @@
109109 mw.getTitleText( this.getApiUrl(), this.getTitleKey(), function( smilPage ){
110110 // Check for remote payload wrapper
111111 // XXX need to support multiple pages in single context
112 - _this.currentSequencePage = _this.parseSequencerPage( smilPage );
 112+ _this.currentSequencePage = _this.parseSequencerPage( smilPage );
113113 // Cache the latest serverSmil ( for local change checks )
114114 // ( save requests automatically respond with warnings on other user updates )
115115 if( _this.currentSequencePage.sequenceXML ){
@@ -118,8 +118,7 @@
119119 _this.serverSmilXml = '';
120120 }
121121
122 - // Cache the pre / post bits
123 -
 122+ // Cache the pre / post bits
124123 callback( _this.serverSmilXml );
125124 })
126125 },

Status & tagging log