Skip to content

Commit 16b1b0f

Browse files
committed
Simplify
1 parent 26ec46d commit 16b1b0f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

dist/performance.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
const response_bodies = $WPT_BODIES;
44
const script_response_bodies = $WPT_BODIES.filter(body => body.type === 'Script');
55

6-
function fetchWithTimeout(url) {
7-
var controller = new AbortController();
8-
setTimeout(() => {controller.abort()}, 5000);
9-
return fetch(url, {signal: controller.signal});
10-
}
11-
126
function getRawHtmlDocument() {
137
let rawHtml;
148
if (response_bodies.length > 0) {
@@ -362,7 +356,7 @@ async function getSpeculationRules() {
362356
return {htmlRules: htmlRules, httpHeaderRules: httpRules};
363357
}
364358

365-
return Promise.all([getLcpElement(), getSpeculationRules()]).then(([lcp_elem_stats, speculationRules]) => {
359+
return Promise.all([getLcpElement()]).then(([lcp_elem_stats]) => {
366360
const lcpUrl = lcp_elem_stats.url;
367361
const rawDoc = getRawHtmlDocument();
368362
// Start out with true, only if LCP element is an external resource will we eval & potentially set to false.
@@ -394,7 +388,7 @@ return Promise.all([getLcpElement(), getSpeculationRules()]).then(([lcp_elem_sta
394388
lcp_preload: lcpPreload,
395389
web_vitals_js: getWebVitalsJS(),
396390
gaming_metrics: gamingMetrics,
397-
speculation_rules: speculationRules,
391+
speculation_rules: getSpeculationRules(),
398392
};
399393
}).catch(error => {
400394
return {errorName: error.name, errorMessage: error.message};

0 commit comments

Comments
 (0)