Permalink
Browse files

Add msFirstPaint time to nt_first_paint

We now also collect first paint time on IE9 and above.  However, note
the inconsistency between IE and Chrome.  IE reports first paint time in
milliseconds since the epoch.  This is consistent with all the other
navtiming timers.  Chrome reports it in seconds.microseconds, which is
inconsistent.

Receivers will have to determine if this was in seconds or in
milliseconds and convert accordingly.  Since data range is very
different, this should not be a problem.
  • Loading branch information...
1 parent 3443afc commit ab63b2584e9e949a62c22f35e706a3cb06d8d6df @bluesmoon committed Dec 11, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −1 doc/api/navtiming.html
  2. +8 −0 plugins/navtiming.js
View
@@ -96,7 +96,7 @@ <h2 id="beacon">Beacon Parameters</h2>
<tr><td><code>nt_unload_end</code></td><td><code>window.performance.timing.unloadEventEnd</code></td></tr>
<tr><td><code>nt_ssl_st</code></td><td><strong>[optional]</strong> <code>window.performance.secureConnectionStart</code></td></tr>
<tr><td><code>nt_spdy</code></td><td><strong>[optional]</strong> 1 if page was loaded over SPDY, 0 otherwise</td></tr>
-<tr><td><code>nt_first_paint</code></td><td><strong>[optional]</strong> The time in <code>seconds.microseconds</code> when the first paint happened. Note, you will need to multiply this number by 1000 to compare it to the others.</td></tr>
+<tr><td><code>nt_first_paint</code></td><td><strong>[optional]</strong> The time when the first paint happened. On Internet Explorer, this is milliseconds since the epoch, while on Chrome this is seconds.microseconds since the epoch. If you detect a decimal point in this number, multiply it by 1000 to compare it to the other timers.</td></tr>
</table>
<p class="perma-link">
View
@@ -53,10 +53,18 @@ var impl = {
// secureConnectionStart is OPTIONAL in the spec
data.nt_ssl_st = pt.secureConnectionStart;
}
+ if (pt.msFirstPaint) {
+ // msFirstPaint is IE9+ http://msdn.microsoft.com/en-us/library/ff974719
+ data.nt_first_paint = pt.msFirstPaint;
+ }
BOOMR.addVar(data);
}
+ // XXX Inconsistency warning. msFirstPaint above is in milliseconds while
+ // firstPaintTime below is in seconds.microseconds. The server needs to deal with this.
+
+ // This is Chrome only, so will not overwrite nt_first_paint above
if(w.chrome && w.chrome.loadTimes) {
pt = w.chrome.loadTimes();
if(pt) {

0 comments on commit ab63b25

Please sign in to comment.