lighthouse 9.6.4 → 9.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -110,6 +110,14 @@ class NetworkRequests extends Audit {
110
110
 
111
111
  const tableDetails = Audit.makeTableDetails(headings, results);
112
112
 
113
+ // Include starting timestamp to allow syncing requests with navStart/metric timestamps.
114
+ const networkStartTimeTs = Number.isFinite(earliestStartTime) ?
115
+ earliestStartTime * 1_000_000 : undefined;
116
+ tableDetails.debugData = {
117
+ type: 'debugdata',
118
+ networkStartTimeTs,
119
+ };
120
+
113
121
  return {
114
122
  score: 1,
115
123
  details: tableDetails,
@@ -17,7 +17,8 @@ class MainThreadTasks {
17
17
  */
18
18
  static async compute_(trace, context) {
19
19
  const {mainThreadEvents, frames, timestamps} = await ProcessedTrace.request(trace, context);
20
- return MainThreadTasks_.getMainThreadTasks(mainThreadEvents, frames, timestamps.traceEnd);
20
+ return MainThreadTasks_.getMainThreadTasks(mainThreadEvents, frames, timestamps.traceEnd,
21
+ timestamps.timeOrigin);
21
22
  }
22
23
  }
23
24
 
@@ -561,9 +561,10 @@ class MainThreadTasks {
561
561
  * @param {LH.TraceEvent[]} mainThreadEvents
562
562
  * @param {Array<{id: string, url: string}>} frames
563
563
  * @param {number} traceEndTs
564
+ * @param {number} [traceStartTs] Optional time-0 ts for tasks. Tasks before this point will have negative start/end times. Defaults to the first task found.
564
565
  * @return {TaskNode[]}
565
566
  */
566
- static getMainThreadTasks(mainThreadEvents, frames, traceEndTs) {
567
+ static getMainThreadTasks(mainThreadEvents, frames, traceEndTs, traceStartTs) {
567
568
  const timers = new Map();
568
569
  const xhrs = new Map();
569
570
  const frameURLsById = new Map();
@@ -587,8 +588,8 @@ class MainThreadTasks {
587
588
  priorTaskData.lastTaskURLs = task.attributableURLs;
588
589
  }
589
590
 
590
- // Rebase all the times to be relative to start of trace in ms
591
- const firstTs = (tasks[0] || {startTime: 0}).startTime;
591
+ // Rebase all the times to be relative to start of trace and covert to ms.
592
+ const firstTs = traceStartTs ?? tasks[0].startTime;
592
593
  for (const task of tasks) {
593
594
  task.startTime = (task.startTime - firstTs) / 1000;
594
595
  task.endTime = (task.endTime - firstTs) / 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "9.6.4",
3
+ "version": "9.6.5",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {