startup.js: log current time as global 'mediaWikiLoadStart'
authorOri Livneh <ori@wikimedia.org>
Tue, 12 Nov 2013 23:07:29 +0000 (15:07 -0800)
committerOri Livneh <ori@wikimedia.org>
Tue, 12 Nov 2013 23:07:29 +0000 (15:07 -0800)
commit231f2b953a2c3dd31c8ef9645f6ab8c08f914853
tree286973d29ec71edd579ad6ad21446aa780b54e4e
parent3195d2ab7ff55e2633ddcfa86188f61f1fd26184
startup.js: log current time as global 'mediaWikiLoadStart'

Capturing the current time as early as possible in the process of loading a
page provides a common reference-point for all user latency measurements. The
limitations of this technique are well-known (and are presented as part of the
rationale for the Navigation Timing API, which was designed to obsolete it --
see <https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#introduction> --
but it remains the only technique that is implemented across all
JavaScript-capable browsers. Relying on the Navigation Timing API alone
excludes some 30% of browsers in use, including all versions of Mobile Safari.

This patch adds a line to startup.js that stores the current time in a
JavaScript global, mediaWikiLoadStart. I am not glib about introducing
additional globals, but I think the circumstances make it desirable to do the
straightforward thing (i.e., add a global) rather than try to set it as a
config var.

Change-Id: I3d5bcf10ecccb7f65bdbad397cf19a5b8fde7fd9
resources/startup.js