Skip to content

Commit

Permalink
Add safe checks (#4379)
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore authored Dec 30, 2024
1 parent d4550ae commit 3662ef1
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/plugins/browsertime/browsertimeAggregator.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,20 @@ export class BrowsertimeAggregator {
summary.userTimings = {};
const marksData = {},
measuresData = {};
for (const [timingName, stats] of Object.entries(
object.userTimings.marks
)) {
setStatsSummary(marksData, timingName, stats);
if (object.userTimings.marks) {
for (const [timingName, stats] of Object.entries(
object.userTimings.marks
)) {
setStatsSummary(marksData, timingName, stats);
}
}

for (const [timingName, stats] of Object.entries(
object.userTimings.measures
)) {
setStatsSummary(measuresData, timingName, stats);
if (object.userTimings.measures) {
for (const [timingName, stats] of Object.entries(
object.userTimings.measures
)) {
setStatsSummary(measuresData, timingName, stats);
}
}

summary.userTimings.marks = marksData;
Expand All @@ -253,8 +257,10 @@ export class BrowsertimeAggregator {
const categories = {};
summary.cpu = {};

for (const [name, stats] of Object.entries(object.cpu.longTasks)) {
setStatsSummary(longTasks, name, stats);
if (object.cpu.longTasks) {
for (const [name, stats] of Object.entries(object.cpu.longTasks)) {
setStatsSummary(longTasks, name, stats);
}
}

if (object.cpu.categories) {
Expand Down

0 comments on commit 3662ef1

Please sign in to comment.