X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fstartup.js;h=deb280a8f18b8161434c64faa5ea1847b76d4a29;hb=25e3feba981d206d91e9b0ddd28c02cd86e17873;hp=20818d2656ce641ba58a989887dd50d522464123;hpb=e61f2aee418b2a2895c114e380c4738b29f682c7;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/startup.js b/resources/src/startup.js index 20818d2656..deb280a8f1 100644 --- a/resources/src/startup.js +++ b/resources/src/startup.js @@ -6,11 +6,19 @@ /* global mw, $VARS, $CODE */ -// eslint-disable-next-line no-unused-vars -var mediaWikiLoadStart = ( new Date() ).getTime(), - mwPerformance = ( window.performance && performance.mark ) ? performance : { +var mwPerformance = ( window.performance && performance.mark ) ? performance : { mark: function () {} - }; + }, + // Define now() here to ensure valid comparison with mediaWikiLoadEnd (T153819). + mwNow = ( function () { + var perf = window.performance, + navStart = perf && perf.timing && perf.timing.navigationStart; + return navStart && typeof perf.now === 'function' ? + function () { return navStart + perf.now(); } : + function () { return +new Date(); }; + }() ), + // eslint-disable-next-line no-unused-vars + mediaWikiLoadStart = mwNow(); mwPerformance.mark( 'mwLoadStart' );