resourceloader: Use perf.now() for mediaWikiLoadStart in startup.js
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 9 Feb 2017 21:46:37 +0000 (21:46 +0000)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 9 Feb 2017 22:03:14 +0000 (22:03 +0000)
commite7d3bce00f418b1f2bc7732aa946b7c9d7c563d0
treedf741c7a17671a404768a34fa830ec3c81e051d6
parent6aee0da2c13af7486d3ebe0f6607ca4312f6da99
resourceloader: Use perf.now() for mediaWikiLoadStart in startup.js

Currently we're using 'new Date' which is less accurate for high accuracy
performance measures. On top of that, we are actually using performance.now()
in Navigation Timing to measure mediaWikiLoadEnd, and subsequently
relating it to mediaWikiLoadStart to produce mediaWikiLoadComplete.

Mixing Date and performance.now produces inaccurate results since the
two are usually not in sync. See T153819 for further details.

Solve this by moving the polyfil to startup.js instead.

Also add a basic unit test for mw.now().

Bug: T153819
Change-Id: Ib44538155aa9ba432ec4c58b09ead5333a3a942d
.eslintrc.json
resources/src/mediawiki/mediawiki.js
resources/src/startup.js
tests/qunit/suites/resources/mediawiki/mediawiki.test.js