diff --git a/cli/test/fixtures/dobetterweb/dbw_tester.html b/cli/test/fixtures/dobetterweb/dbw_tester.html index 304d8230034a..6b47d525a2e3 100644 --- a/cli/test/fixtures/dobetterweb/dbw_tester.html +++ b/cli/test/fixtures/dobetterweb/dbw_tester.html @@ -45,6 +45,9 @@ + + + diff --git a/cli/test/smokehouse/test-definitions/dobetterweb.js b/cli/test/smokehouse/test-definitions/dobetterweb.js index 50adc5e18a0e..1f50e9e7151e 100644 --- a/cli/test/smokehouse/test-definitions/dobetterweb.js +++ b/cli/test/smokehouse/test-definitions/dobetterweb.js @@ -121,6 +121,15 @@ const expectations = { crossOrigin: null, source: 'head', }, + { + rel: 'stylesheet', + href: 'http://localhost:10200/dobetterweb/dbw_tester.html', + hrefRaw: '', + hreflang: '', + as: '', + crossOrigin: null, + source: 'head', + }, { rel: 'stylesheet', href: 'http://localhost:10200/dobetterweb/dbw_tester.css?scriptActivated&delay=200', diff --git a/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js b/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js index fb2ddf1d5bce..ab8d2fc9df31 100644 --- a/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +++ b/core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js @@ -62,6 +62,11 @@ async function collectTagsThatBlockFirstPaint() { /** @type {Array} */ const linkTags = [...document.querySelectorAll('link')] .filter(linkTag => { + // Ignore malformed links with no href (e.g. ``) + // The resolved `linkTag.href` will be the main document, but the main document + // should never be render blocking. + if (!linkTag.getAttribute('href')) return false; + // Filter stylesheet/HTML imports that block rendering. // https://www.igvita.com/2012/06/14/debunking-responsive-css-performance-myths/ // https://www.w3.org/TR/html-imports/#dfn-import-async-attribute