Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions injected/src/features/breakage-reporting/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function waitForLCP(timeoutMs = 500) {
* Get the expanded performance metrics
* @returns {Promise<ErrorObject | PerformanceMetricsResponse>}
*/
export async function getExpandedPerformanceMetrics() {
export async function getExpandedPerformanceMetrics(timeoutMs = 500) {
try {
if (document.readyState !== 'complete') {
return returnError('Document not ready');
Expand All @@ -80,7 +80,7 @@ export async function getExpandedPerformanceMetrics() {
// Get largest contentful paint if available
let largestContentfulPaint = null;
if (PerformanceObserver.supportedEntryTypes.includes('largest-contentful-paint')) {
largestContentfulPaint = await waitForLCP();
largestContentfulPaint = await waitForLCP(timeoutMs);
}

// Calculate total resource sizes
Expand Down
3 changes: 2 additions & 1 deletion injected/src/features/performance-metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export default class PerformanceMetrics extends ContentFeature {
}

async triggerExpandedPerformanceMetrics() {
const expandedPerformanceMetrics = await getExpandedPerformanceMetrics();
const permissableDelayMs = this.getFeatureSetting('expandedTimeoutMs') ?? 5000;
const expandedPerformanceMetrics = await getExpandedPerformanceMetrics(permissableDelayMs);
this.messaging.notify('expandedPerformanceMetricsResult', expandedPerformanceMetrics);
}
}