From 7b2da95a9814beb05112ea2860433499967ab1b9 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 18 Apr 2017 14:13:06 -0700 Subject: [PATCH] resourceloader: Move mwNow() to after isCompatible() Follows-up f2fb4a21af. This is logically still the same point in time. Only 1 function before it now, isCompatible(), which is fine since it is small and the variable is not used anyway if it returns false. Change-Id: I34bbe8edf6e9625f8d80f829707adafcb1b91980 --- resources/src/startup.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/src/startup.js b/resources/src/startup.js index ad06b34876..e0df772faf 100644 --- a/resources/src/startup.js +++ b/resources/src/startup.js @@ -1,7 +1,8 @@ /** - * Code in this file MUST work on even the most ancient of browsers! + * This file is where we decide whether to initialise the Grade A run-time. * - * This file is where we decide whether to initialise the modern 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, $VARS, $CODE */ @@ -18,9 +19,7 @@ var mwPerformance = ( window.performance && performance.mark ) ? performance : { function () { return Date.now(); }; }() ), // eslint-disable-next-line no-unused-vars - mediaWikiLoadStart = mwNow(); - -mwPerformance.mark( 'mwLoadStart' ); + mediaWikiLoadStart; /** * See @@ -153,6 +152,9 @@ function isCompatible( str ) { }; } + mediaWikiLoadStart = mwNow(); + mwPerformance.mark( 'mwLoadStart' ); + script = document.createElement( 'script' ); script.src = $VARS.baseModulesUri; script.onload = script.onreadystatechange = function () { -- 2.20.1