From 2a367074fe412f5d697155ddb961921d088d3874 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 5 Oct 2017 07:52:33 +0200 Subject: [PATCH] Add actual performance API emulation for old browsers --- test/default/index.html.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/default/index.html.tpl b/test/default/index.html.tpl index 4c39de40..4a4e2886 100644 --- a/test/default/index.html.tpl +++ b/test/default/index.html.tpl @@ -31,9 +31,9 @@ body { var performance; if (typeof performance !== 'object') { performance = { - mark: function() { }, - measure: function() { }, - getEntriesByName: function() { return [ -1 ] } + mark: function(s) { this[s] = new Date() }, + measure: function(_t, s1, s2) { this.t = this[s2] - this[s1] }, + getEntriesByName: function() { return [ { duration: this.t } ] } }; } @@ -55,8 +55,8 @@ function runTest(tname) { if (passed) { performance.mark('bench_end') performance.measure('bench', 'bench_start', 'bench_end'); - let duration = Math.round(performance.getEntriesByName('bench')[0].duration); - hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ')')); + var duration = Math.round(performance.getEntriesByName('bench')[0].duration); + hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ' ms)')); hn.className = 'passed'; } else { hn.appendChild(document.createTextNode(' - FAILED'));