From 950ef2f7ac4625537e85dda0bf077d1b3f492021 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Wed, 27 Mar 2024 14:45:19 -0700 Subject: [PATCH] core(metric): remove gatherContext mode check --- core/computed/metrics/lantern-metric.js | 4 +--- core/computed/metrics/metric.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/computed/metrics/lantern-metric.js b/core/computed/metrics/lantern-metric.js index 9142c6f66cf3..03ab17ac5872 100644 --- a/core/computed/metrics/lantern-metric.js +++ b/core/computed/metrics/lantern-metric.js @@ -19,9 +19,7 @@ class LanternMetric extends Metric { * @return {Promise} */ static async computeMetricWithGraphs(data, context, extras) { - // TODO: remove this fallback when lighthouse-pub-ads plugin can update. - const gatherContext = data.gatherContext || {gatherMode: 'navigation'}; - if (gatherContext.gatherMode !== 'navigation') { + if (data.gatherContext.gatherMode !== 'navigation') { throw new Error(`Lantern metrics can only be computed on navigations`); } diff --git a/core/computed/metrics/metric.js b/core/computed/metrics/metric.js index 5a483bdda636..4133876f027b 100644 --- a/core/computed/metrics/metric.js +++ b/core/computed/metrics/metric.js @@ -61,9 +61,7 @@ class Metric { * @return {Promise} */ static async compute_(data, context) { - // TODO: remove this fallback when lighthouse-pub-ads plugin can update. - const gatherContext = data.gatherContext || {gatherMode: 'navigation'}; - const {trace, devtoolsLog, settings} = data; + const {trace, devtoolsLog, settings, gatherContext} = data; if (!trace || !devtoolsLog || !settings) { throw new Error('Did not provide necessary metric computation data'); }