Skip to content

Commit

Permalink
avoiding ProcessedNavigation in experimental lantern mode too
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 6, 2024
1 parent 9cf533e commit 1f58ced
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
3 changes: 1 addition & 2 deletions core/audits/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class Redirects extends Audit {

const processedTrace = await ProcessedTrace.request(trace, context);
const networkRecords = await NetworkRecords.request(devtoolsLog, context);
const documentRequests = Redirects.getDocumentRequestChain(networkRecords, processedTrace);

const metricComputationData = {trace, devtoolsLog, gatherContext, settings, URL: artifacts.URL};
const metricResult = await LanternInteractive.request(metricComputationData, context);
Expand All @@ -102,8 +103,6 @@ class Redirects extends Audit {
}
}

const documentRequests = Redirects.getDocumentRequestChain(networkRecords, processedTrace);

let totalWastedMs = 0;
const tableRows = [];

Expand Down
10 changes: 4 additions & 6 deletions core/computed/metrics/lantern-metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {LighthouseError} from '../../lib/lh-error.js';
import {LoadSimulator} from '../load-simulator.js';
import {ProcessedNavigation} from '../processed-navigation.js';
import {PageDependencyGraph} from '../page-dependency-graph.js';
// import {TraceEngineResult} from '../trace-engine-result.js';
// import {createProcessedNavigation} from '../../lib/lantern/lantern.js';
import {TraceEngineResult} from '../trace-engine-result.js';
import {createProcessedNavigation} from '../../lib/lantern/lantern.js';

/**
* @param {LH.Artifacts.MetricComputationDataInput} data
Expand Down Expand Up @@ -38,10 +38,8 @@ async function getComputationDataParamsFromTrace(data, context) {
}

const graph = await PageDependencyGraph.request({...data, fromTrace: true}, context);
const processedNavigation = await ProcessedNavigation.request(data.trace, context);
// TODO(15841): investigate failures
// const processedNavigation = createProcessedNavigation(
// await TraceEngineResult.request(data, context));
const traceEngineResult = await TraceEngineResult.request(data, context);
const processedNavigation = createProcessedNavigation(traceEngineResult);
const simulator = data.simulator || (await LoadSimulator.request(data, context));

return {simulator, graph, processedNavigation};
Expand Down
5 changes: 5 additions & 0 deletions core/test/audits/metrics/first-meaningful-paint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ describe('Performance: first-meaningful-paint audit', () => {
});

it('computes FMP correctly for simulated', async () => {
if (process.env.INTERNAL_LANTERN_USE_TRACE !== undefined) {
// Audit is pending deletion.
return;
}

const artifacts = {
GatherContext: {gatherMode: 'navigation'},
traces: {[Audit.DEFAULT_PASS]: trace},
Expand Down
4 changes: 4 additions & 0 deletions core/test/audits/redirects-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ describe('Performance: Redirects audit', () => {
});
const navStart = trace.traceEvents.find(e => e.name === 'navigationStart');
navStart.args.data.navigationId = '1';
const fcp = trace.traceEvents.find(e => e.name === 'firstContentfulPaint');
fcp.args.data.navigationId = '1';
const lcp = trace.traceEvents.find(e => e.name === 'largestContentfulPaint::Candidate');
lcp.args.data.navigationId = '1';

return {
GatherContext: {gatherMode: 'navigation'},
Expand Down
5 changes: 5 additions & 0 deletions core/test/computed/metrics/first-meaningful-paint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const preactTrace = readJson('../../fixtures/traces/preactjs.com_ts_of_undefined
const noFMPtrace = readJson('../../fixtures/traces/no_fmp_event.json', import.meta);

describe('Metrics: FMP', () => {
if (process.env.INTERNAL_LANTERN_USE_TRACE !== undefined) {
// Audit is pending deletion.
return;
}

const gatherContext = {gatherMode: 'navigation'};
let settings;
let trace;
Expand Down

0 comments on commit 1f58ced

Please sign in to comment.