From 25f920e09d5ab091b9d9e23cc2c57780c8aab0b2 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Mon, 30 Apr 2018 17:08:24 -0700 Subject: [PATCH] report(table): handle null cells (#5075) --- lighthouse-core/audits/byte-efficiency/unminified-css.js | 3 ++- .../audits/byte-efficiency/unminified-javascript.js | 3 ++- lighthouse-core/report/html/renderer/details-renderer.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lighthouse-core/audits/byte-efficiency/unminified-css.js b/lighthouse-core/audits/byte-efficiency/unminified-css.js index d794290fd6..873256205e 100644 --- a/lighthouse-core/audits/byte-efficiency/unminified-css.js +++ b/lighthouse-core/audits/byte-efficiency/unminified-css.js @@ -137,7 +137,8 @@ class UnminifiedCSS extends ByteEfficiencyAudit { // If the ratio is minimal, the file is likely already minified, so ignore it. // If the total number of bytes to be saved is quite small, it's also safe to ignore. if (result.wastedPercent < IGNORE_THRESHOLD_IN_PERCENT || - result.wastedBytes < IGNORE_THRESHOLD_IN_BYTES) continue; + result.wastedBytes < IGNORE_THRESHOLD_IN_BYTES || + !Number.isFinite(result.wastedBytes)) continue; results.push(result); } diff --git a/lighthouse-core/audits/byte-efficiency/unminified-javascript.js b/lighthouse-core/audits/byte-efficiency/unminified-javascript.js index c53c4badce..a630aac4fe 100644 --- a/lighthouse-core/audits/byte-efficiency/unminified-javascript.js +++ b/lighthouse-core/audits/byte-efficiency/unminified-javascript.js @@ -84,7 +84,8 @@ class UnminifiedJavaScript extends ByteEfficiencyAudit { // If the ratio is minimal, the file is likely already minified, so ignore it. // If the total number of bytes to be saved is quite small, it's also safe to ignore. if (result.wastedPercent < IGNORE_THRESHOLD_IN_PERCENT || - result.wastedBytes < IGNORE_THRESHOLD_IN_BYTES) continue; + result.wastedBytes < IGNORE_THRESHOLD_IN_BYTES || + !Number.isFinite(result.wastedBytes)) continue; results.push(result); } catch (err) { debugString = `Unable to process ${networkRecord._url}: ${err.message}`; diff --git a/lighthouse-core/report/html/renderer/details-renderer.js b/lighthouse-core/report/html/renderer/details-renderer.js index 94624d2dac..1eb66ae6c6 100644 --- a/lighthouse-core/report/html/renderer/details-renderer.js +++ b/lighthouse-core/report/html/renderer/details-renderer.js @@ -203,7 +203,7 @@ class DetailsRenderer { for (const heading of details.headings) { const value = /** @type {number|string|!DetailsRenderer.DetailsJSON} */ (row[heading.key]); - if (typeof value === 'undefined') { + if (typeof value === 'undefined' || value === null) { this._dom.createChildOf(rowElem, 'td', 'lh-table-column--empty'); continue; }