From: Aaron Schulz Date: Tue, 5 Jun 2018 23:19:58 +0000 (-0700) Subject: resourceloader: remove "mediaWikiLoadStart" and move mwNow() to mediawiki.js X-Git-Tag: 1.34.0-rc.0~5178 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=c0adb8ecd83a45c5706be7d09f925376db19278a;p=lhc%2Fweb%2Fwiklou.git resourceloader: remove "mediaWikiLoadStart" and move mwNow() to mediawiki.js Bug: T160315 Change-Id: I2d4745e9c34526e5e86f25a3d47799004a5908fe --- diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index a2af443ed7..59c7449021 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -8,8 +8,6 @@ * @singleton */ -/* global mwNow */ - ( function ( $ ) { 'use strict'; @@ -551,8 +549,13 @@ * * @return {number} Current time */ - now: mwNow, - // mwNow is defined in startup.js + now: ( 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 Date.now(); }; + }() ), /** * Format a string. Replace $1, $2 ... $N with positional arguments. diff --git a/resources/src/startup.js b/resources/src/startup.js index 41bcbaad3c..7e7548106f 100644 --- a/resources/src/startup.js +++ b/resources/src/startup.js @@ -2,19 +2,9 @@ * This file is where we decide whether to initialise the Grade A run-time. * * - Beware: This file MUST parse without errors on even the most ancient of browsers! - * - Beware: Do not call mwNow before the isCompatible() check. */ -/* global mw, mwNow, isCompatible, $VARS, $CODE */ - -// Define now() here to ensure valid comparison with mediaWikiLoadEnd (T153819). -window.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 Date.now(); }; -}() ); +/* global mw, isCompatible, $VARS, $CODE */ /** * See @@ -147,7 +137,6 @@ window.isCompatible = function ( str ) { }; } - window.mediaWikiLoadStart = mwNow(); if ( window.performance && performance.mark ) { performance.mark( 'mwStartup' ); }