docs: function() {
      // If the browser supports a first paint event, just use what the browser reports
      if ('msFirstPaint' in win.performance.timing)
        firstPaint = win.performance.timing.msFirstPaint - navStart;
      if ('chrome' in win && 'loadTimes' in win.chrome) {
        var chromeTimes = win.chrome.loadTimes();
        if ('firstPaintTime' in chromeTimes && chromeTimes.firstPaintTime > 0) {
          var startTime = chromeTimes.startLoadTime;
          if ('requestTime' in chromeTimes)
            startTime = chromeTimes.requestTime;
          if (chromeTimes.firstPaintTime >= startTime)
            firstPaint = (chromeTimes.firstPaintTime - startTime) * 1000.0;
        }
      }
      // For browsers that don't support first-paint or where we get insane values,
      // use the time of the last non-async script or css from the head.
      if (firstPaint === undefined || firstPaint < 0 || firstPaint > 120000) {
        firstPaint = win.performance.timing.responseStart - navStart;
        var headURLs = {};
        var headElements = doc.getElementsByTagName('head')[0].children;
        for (var i = 0; i < headElements.length; i++) {
          var el = headElements[i];
          if (el.tagName == 'SCRIPT' && el.src && !el.async)
            headURLs[el.src] = true;
          if (el.tagName == 'LINK' && el.rel == 'stylesheet' && el.href)
            headURLs[el.href] = true;
        }
        var requests = win.performance.getEntriesByType("resource");
        var doneCritical = false;
        for (var j = 0; j < requests.length; j++) {
          if (!doneCritical &&
              headURLs[requests[j].name] &&
             (requests[j].initiatorType == 'script' || requests[j].initiatorType == 'link')) {
            var requestEnd = requests[j].responseEnd;
            if (firstPaint === undefined || requestEnd > firstPaint)
              firstPaint = requestEnd;
          } else {
            doneCritical = true;
          }
        }
      }
      firstPaint = Math.max(firstPaint, 0);
    }