Emit activation entry/exit traces at the appropriate times

Due to changes in the way VisualEditor is loaded, the trace.activate.{enter,exit}
events no longer enclose the entire VisualEditor initialization process. This
change ensures that trace.activate.enter is emitted as soon as the user clicks
on an edit link / tab and that the trace.activate.exit is not emitted until the
toolbar has been fully activated.

Change-Id: Ief798faa95a58898b9ae4dcbbbd30506c5dbd9a7
This commit is contained in:
Ori Livneh 2015-03-23 13:15:44 -07:00 committed by Alex Monk
parent 66f72a07be
commit 13292744b1
2 changed files with 4 additions and 2 deletions

View file

@ -424,6 +424,7 @@
return;
}
ve.track( 'trace.activate.enter' );
ve.track( 'mwedit.init', { type: 'page', mechanism: 'click' } );
if ( history.pushState && uri.query.veaction !== 'edit' ) {
@ -448,6 +449,7 @@
return;
}
ve.track( 'trace.activate.enter' );
ve.track( 'mwedit.init', { type: 'section', mechanism: 'click' } );
if ( history.pushState && uri.query.veaction !== 'edit' ) {
@ -538,6 +540,7 @@
if ( isViewPage && uri.query.veaction === 'edit' ) {
isSection = uri.query.vesection !== undefined;
ve.track( 'trace.activate.enter' );
ve.track( 'mwedit.init', { type: isSection ? 'section' : 'page', mechanism: 'url' } );
activateTarget();
}

View file

@ -188,6 +188,7 @@ ve.init.mw.ViewPageTarget.prototype.setupToolbar = function ( surface ) {
surface.getView().emit( 'position' );
surface.getContext().updateDimensions();
ve.track( 'trace.initializeToolbar.exit' );
ve.track( 'trace.activate.exit' );
}
} );
}
@ -277,7 +278,6 @@ ve.init.mw.ViewPageTarget.prototype.activate = function ( dataPromise ) {
pageTarget = this;
if ( !this.active && !this.activating ) {
ve.track( 'trace.activate.enter' );
this.activating = true;
this.activatingDeferred = $.Deferred();
this.toolbarSetupDeferred = $.Deferred();
@ -527,7 +527,6 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () {
this.activatingDeferred.resolve();
mw.hook( 've.activationComplete' ).fire();
ve.track( 'trace.activate.exit' );
};
/**