Merge "Filter DOM load/save deferreds through ve.track callback"

This commit is contained in:
jenkins-bot 2013-10-28 18:14:15 +00:00 committed by Gerrit Code Review
commit 18eb08dc6b

View file

@ -539,18 +539,18 @@ ve.init.mw.Target.prototype.load = function () {
'timeout': 100000,
'cache': 'false'
} )
.then( function ( data, status, jqxhr ) {
ve.track( 'performance.domLoad', {
'bytes': $.byteLength( jqxhr.responseText ),
'duration': ve.now() - start,
'cacheHit': /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) ),
'parsoid': jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
} );
return jqxhr;
} )
.done( ve.bind( ve.init.mw.Target.onLoad, this ) )
.fail( ve.bind( ve.init.mw.Target.onLoadError, this ) );
this.loading.done( function ( data, status, jqxhr ) {
ve.track( 'performance.domLoad', {
'bytes': $.byteLength( jqxhr.responseText ),
'duration': ve.now() - start,
'cacheHit': /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) ),
'parsoid': jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
} );
} );
return true;
};
@ -598,17 +598,17 @@ ve.init.mw.Target.prototype.save = function ( doc, options ) {
// Wait up to 100 seconds before giving up
'timeout': 100000
} )
.then( function ( data, status, jqxhr ) {
ve.track( 'performance.domSave', {
'bytes': $.byteLength( jqxhr.responseText ),
'duration': ve.now() - start,
'parsoid': jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
} );
return jqxhr;
} )
.done( ve.bind( ve.init.mw.Target.onSave, this ) )
.fail( ve.bind( ve.init.mw.Target.onSaveError, this ) );
this.saving.done( function ( data, status, jqxhr ) {
ve.track( 'performance.domSave', {
'bytes': $.byteLength( jqxhr.responseText ),
'duration': ve.now() - start,
'parsoid': jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
} );
} );
return true;
};