MM-62371 Add additional error handling to PerformanceReporter (#29774)

As in the comments I added, this is to fix an error introduced by changes made by either Firefox or
1Password due to accessing a performance metric's details field when we're not allowed to.
Этот коммит содержится в:
Harrison Healey
2025-01-08 10:44:21 -05:00
коммит произвёл GitHub
родитель 4265df8a07
Коммит e7c583f312

Просмотреть файл

@@ -196,7 +196,16 @@ export default class PerformanceReporter {
}
private handleMeasure(entry: PerformanceMeasure) {
if (!entry.detail?.report) {
let report;
try {
report = Boolean(entry.detail?.report);
} catch {
// Measures recorded by browser extensions may be in a separate context which causes accessing
// entry.detail to throw an error
report = false;
}
if (!report) {
return;
}
@@ -209,7 +218,16 @@ export default class PerformanceReporter {
}
private handleMark(entry: PerformanceMeasure) {
if (!entry.detail?.report) {
let report;
try {
report = Boolean(entry.detail?.report);
} catch {
// Measures recorded by browser extensions may be in a separate context which causes accessing
// entry.detail to throw an error
report = false;
}
if (!report) {
return;
}