diff --git a/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js b/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js index 0d4738055aee..79322f4d057e 100644 --- a/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js +++ b/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js @@ -152,11 +152,12 @@ class CacheHeaders extends Audit { NetworkRequest.TYPES.Stylesheet, ]); - const resourceUrl = record.url; + // It's not a request loaded over the network, caching makes no sense + if (URL.NON_NETWORK_PROTOCOLS.includes(record.protocol)) return false; + return ( CACHEABLE_STATUS_CODES.has(record.statusCode) && - STATIC_RESOURCE_TYPES.has(record.resourceType || 'Other') && - !resourceUrl.includes('data:') + STATIC_RESOURCE_TYPES.has(record.resourceType || 'Other') ); } diff --git a/lighthouse-core/audits/font-display.js b/lighthouse-core/audits/font-display.js index f6460c28eed2..32a219b4ab38 100644 --- a/lighthouse-core/audits/font-display.js +++ b/lighthouse-core/audits/font-display.js @@ -116,6 +116,7 @@ class FontDisplay extends Audit { .filter(record => !passingFontURLs.has(record.url)) // ...and that aren't data URLs, the blocking concern doesn't really apply .filter(record => !/^data:/.test(record.url)) + .filter(record => !/^blob:/.test(record.url)) .map(record => { // In reality the end time should be calculated with paint time included // all browsers wait 3000ms to block text so we make sure 3000 is our max wasted time diff --git a/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js b/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js index d536ffefb930..876b279450a4 100644 --- a/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js +++ b/lighthouse-core/gather/gatherers/dobetterweb/tags-blocking-first-paint.js @@ -56,6 +56,7 @@ function collectTagsThatBlockFirstPaint() { !scriptTag.hasAttribute('async') && !scriptTag.hasAttribute('defer') && !/^data:/.test(scriptTag.src) && + !/^blob:/.test(scriptTag.src) && scriptTag.getAttribute('type') !== 'module' ); } else if (tag.tagName === 'LINK') { diff --git a/lighthouse-core/test/audits/byte-efficiency/uses-long-cache-ttl-test.js b/lighthouse-core/test/audits/byte-efficiency/uses-long-cache-ttl-test.js index aba0f68d014c..4a37871833d1 100644 --- a/lighthouse-core/test/audits/byte-efficiency/uses-long-cache-ttl-test.js +++ b/lighthouse-core/test/audits/byte-efficiency/uses-long-cache-ttl-test.js @@ -24,6 +24,7 @@ function networkRecord(options = {}) { statusCode: options.statusCode || 200, resourceType: options.resourceType || NetworkRequest.TYPES.Script, transferSize: options.transferSize || 10000, + protocol: options.protocol || 'http/1.1', responseHeaders: headers, }; } @@ -207,7 +208,8 @@ describe('Cache headers audit', () => { const networkRecords = [ networkRecord({statusCode: 500}), networkRecord({url: 'https://example.com/dynamic.js?userId=crazy', transferSize: 10}), - networkRecord({url: 'data:image/jpeg;base64,what'}), + networkRecord({url: 'data:image/jpeg;base64,what', protocol: 'data'}), + networkRecord({url: 'blob:http://example.com/ca6df701-9c67-49fd-a787', protocol: 'blob'}), networkRecord({resourceType: NetworkRequest.TYPES.XHR}), ]; diff --git a/lighthouse-core/test/results/sample_v2.json b/lighthouse-core/test/results/sample_v2.json index 0d28987cbb71..215e7f865bf0 100644 --- a/lighthouse-core/test/results/sample_v2.json +++ b/lighthouse-core/test/results/sample_v2.json @@ -1910,7 +1910,7 @@ "score": 0.58, "scoreDisplayMode": "numeric", "numericValue": 103455, - "displayValue": "11 resources found", + "displayValue": "10 resources found", "details": { "type": "table", "headings": [ @@ -2003,13 +2003,6 @@ "cacheHitProbability": 0, "totalBytes": 144, "wastedBytes": 144 - }, - { - "url": "blob:http://localhost:10200/ae0eac03-ab9b-4a6a-b299-f5212153e277", - "cacheLifetimeMs": 0, - "cacheHitProbability": 0, - "totalBytes": 0, - "wastedBytes": 0 } ], "summary": { @@ -5092,7 +5085,7 @@ "lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js | displayValue": [ { "values": { - "itemCount": 11 + "itemCount": 10 }, "path": "audits[uses-long-cache-ttl].displayValue" } diff --git a/proto/sample_v2_round_trip.json b/proto/sample_v2_round_trip.json index 84813c3df6a2..384202256685 100644 --- a/proto/sample_v2_round_trip.json +++ b/proto/sample_v2_round_trip.json @@ -2659,13 +2659,6 @@ "totalBytes": 144.0, "url": "http://localhost:10200/dobetterweb/empty_module.js?delay=500", "wastedBytes": 144.0 - }, - { - "cacheHitProbability": 0.0, - "cacheLifetimeMs": 0.0, - "totalBytes": 0.0, - "url": "blob:http://localhost:10200/ae0eac03-ab9b-4a6a-b299-f5212153e277", - "wastedBytes": 0.0 } ], "summary": { @@ -2673,7 +2666,7 @@ }, "type": "table" }, - "displayValue": "11 resources found", + "displayValue": "10 resources found", "id": "uses-long-cache-ttl", "numericValue": 103455.0, "score": 0.58,