From 3547f179607c1d70de779b8b5d82d8ee76df74a6 Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Tue, 7 Jan 2014 16:22:18 -0800 Subject: [PATCH] Fix painful bug in eventlogging code Change-Id: I3026aadcb28e7a8325137214512163558cccf2db --- resources/ext.multimediaViewer/ext.multimediaViewer.js | 8 ++++---- tests/qunit/ext.multimediaViewer.test.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/ext.multimediaViewer/ext.multimediaViewer.js b/resources/ext.multimediaViewer/ext.multimediaViewer.js index d308a095c..3009b353d 100755 --- a/resources/ext.multimediaViewer/ext.multimediaViewer.js +++ b/resources/ext.multimediaViewer/ext.multimediaViewer.js @@ -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 ) { diff --git a/tests/qunit/ext.multimediaViewer.test.js b/tests/qunit/ext.multimediaViewer.test.js index aef977c6f..7e39a579c 100644 --- a/tests/qunit/ext.multimediaViewer.test.js +++ b/tests/qunit/ext.multimediaViewer.test.js @@ -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;