mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-25 03:09:40 +00:00
Fix painful bug in eventlogging code
Change-Id: I3026aadcb28e7a8325137214512163558cccf2db
This commit is contained in:
parent
055ccb8c27
commit
3547f17960
|
@ -907,20 +907,20 @@
|
|||
* Signal the end of an event being profiled and send the
|
||||
* eventlogging message.
|
||||
* @param {number} id Should be the value returned from profileStart
|
||||
* @param {boolean} [includeTime] For testing, whether to include the time in the message. Time is zero otherwise.
|
||||
* @param {boolean} [fakeTime] For testing, whether to fake the time in the message. Time is zero if so.
|
||||
*/
|
||||
MMVP.profileEnd = function ( id, includeTime ) {
|
||||
MMVP.profileEnd = function ( id, fakeTime ) {
|
||||
var msg;
|
||||
|
||||
if ( profiling[id] ) {
|
||||
msg = profiling[id];
|
||||
msg.milliseconds = includeTime ? Date.now() - msg.start : 0;
|
||||
msg.milliseconds = Date.now() - msg.start;
|
||||
delete msg.start;
|
||||
|
||||
mw.log(
|
||||
mmvLogActions['profile-' + msg.action + '-end']
|
||||
.replace( /\$1/g, id )
|
||||
.replace( /\$2/g, msg.milliseconds )
|
||||
.replace( /\$2/g, fakeTime ? 0 : msg.milliseconds )
|
||||
);
|
||||
|
||||
if ( mw.eventLog ) {
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
assert.strictEqual( pid, i, 'nonce-style profile IDs come in order.' );
|
||||
|
||||
expectedMsg = test[2].replace( /\$1/g, i ).replace( /\$2/g, 0 );
|
||||
viewer.profileEnd( pid, false );
|
||||
viewer.profileEnd( pid, true );
|
||||
}
|
||||
|
||||
mw.log = backupLog;
|
||||
|
|
Loading…
Reference in a new issue