From c0adb8ecd83a45c5706be7d09f925376db19278a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 5 Jun 2018 16:19:58 -0700 Subject: [PATCH] resourceloader: remove "mediaWikiLoadStart" and move mwNow() to mediawiki.js Bug: T160315 Change-Id: I2d4745e9c34526e5e86f25a3d47799004a5908fe --- resources/src/mediawiki/mediawiki.js | 11 +++++++---- resources/src/startup.js | 13 +------------ 2 files changed, 8 insertions(+), 16 deletions(-) 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' ); } -- 2.20.1