From: Timo Tijhof Date: Tue, 18 Apr 2017 21:13:06 +0000 (-0700) Subject: resourceloader: Move mwNow() to after isCompatible() X-Git-Tag: 1.31.0-rc.0~3473^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%22id_auteur=%24connect_id_auteur%22%29%20.%20%22?a=commitdiff_plain;h=7b2da95a9814beb05112ea2860433499967ab1b9;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 () {