Only do client-side instrumentation on action=edit/action=submit

So we don't break the tests

Bug: T93119
Change-Id: Ib0545f581fd2a845b893a046ab7aa7161e27180e
This commit is contained in:
Alex Monk 2015-03-18 23:59:24 +00:00
parent 9d2092b25c
commit 4d54fa4471

View file

@ -550,29 +550,31 @@ if ( !context || typeof context === 'undefined' ) {
context.fn.trigger( 'resize', event );
} );
mw.wikiEditor.logEditEvent( 'ready', {
editingSessionId: $( '#editform input#editingStatsId' ).val()
} );
$( '#editform' ).submit( function () {
context.submitting = true;
} );
this.onUnloadFallback = window.onunload;
window.onunload = function () {
var fallbackResult;
if ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) {
mw.wikiEditor.logEditEvent( 'ready', {
editingSessionId: $( '#editform input#editingStatsId' ).val()
} );
$( '#editform' ).submit( function () {
context.submitting = true;
} );
this.onUnloadFallback = window.onunload;
window.onunload = function () {
var fallbackResult;
if ( this.onUnloadFallback ) {
fallbackResult = this.onUnloadFallback();
}
if ( this.onUnloadFallback ) {
fallbackResult = this.onUnloadFallback();
}
if ( !context.submitting ) {
mw.wikiEditor.logEditEvent( 'abort', {
editingSessionId: $( '#editform input#editingStatsId' ).val(),
// TODO: abort.type
} );
}
if ( !context.submitting ) {
mw.wikiEditor.logEditEvent( 'abort', {
editingSessionId: $( '#editform input#editingStatsId' ).val(),
// TODO: abort.type
} );
}
return fallbackResult;
};
return fallbackResult;
};
}
}
/* API Execution */