diff --git a/lighthouse-core/lib/network-recorder.js b/lighthouse-core/lib/network-recorder.js index 11f68ce0dbdb..70a109dd3437 100644 --- a/lighthouse-core/lib/network-recorder.js +++ b/lighthouse-core/lib/network-recorder.js @@ -30,7 +30,7 @@ class NetworkRecorder extends EventEmitter { * @return {Array} */ getInflightRecords() { - return this._records.filter(record => !NetworkRecorder.isNetworkRecordFinished(record)); + return this._records.filter(record => !record.finished); } getRecords() { @@ -72,7 +72,7 @@ class NetworkRecorder extends EventEmitter { for (let i = 0; i < this._records.length; i++) { const record = this._records[i]; - if (NetworkRecorder.isNetworkRecordFinished(record)) continue; + if (record.finished) continue; if (IGNORED_NETWORK_SCHEMES.includes(record.parsedURL.scheme)) continue; inflightRequests++; } @@ -99,28 +99,6 @@ class NetworkRecorder extends EventEmitter { } } - /** - * QUIC network requests don't always "finish" even when they're done loading data, use recievedHeaders - * @see https://github.com/GoogleChrome/lighthouse/issues/5254 - * @param {LH.Artifacts.NetworkRequest} record - * @return {boolean} - */ - static _isQUICAndFinished(record) { - const isQUIC = record.responseHeaders && record.responseHeaders - .some(header => header.name.toLowerCase() === 'alt-svc' && /quic/.test(header.value)); - const receivedHeaders = record.timing && record.timing.receiveHeadersEnd > 0; - return !!(isQUIC && receivedHeaders && record.endTime); - } - - /** - * @param {LH.Artifacts.NetworkRequest} record - * @return {boolean} - */ - static isNetworkRecordFinished(record) { - return record.finished || - NetworkRecorder._isQUICAndFinished(record); - } - /** * Finds all time periods where the number of inflight requests is less than or equal to the * number of allowed concurrent requests. @@ -141,7 +119,7 @@ class NetworkRecorder extends EventEmitter { // convert the network record timestamp to ms timeBoundaries.push({time: record.startTime * 1000, isStart: true}); - if (NetworkRecorder.isNetworkRecordFinished(record)) { + if (record.finished) { timeBoundaries.push({time: record.endTime * 1000, isStart: false}); } }); diff --git a/lighthouse-core/test/lib/network-recorder-test.js b/lighthouse-core/test/lib/network-recorder-test.js index 68c187ab0f9b..bb318434e659 100644 --- a/lighthouse-core/test/lib/network-recorder-test.js +++ b/lighthouse-core/test/lib/network-recorder-test.js @@ -313,9 +313,7 @@ describe('network recorder', function() { ]; const periods = NetworkRecorder.findNetworkQuietPeriods(records, 0); - assert.deepStrictEqual(periods, [ - {start: 2000, end: Infinity}, - ]); + assert.deepStrictEqual(periods, []); }); }); });