Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: remove pre-v10 compat for page graph construction #15948

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions core/computed/page-dependency-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {PageDependencyGraph as LanternPageDependencyGraph} from '../lib/lantern/
import {NetworkRequest} from '../lib/network-request.js';
import {ProcessedTrace} from './processed-trace.js';
import {NetworkRecords} from './network-records.js';
import {DocumentUrls} from './document-urls.js';

/** @typedef {import('../lib/lantern/base-node.js').Node<LH.Artifacts.NetworkRequest>} Node */

Expand All @@ -20,16 +19,12 @@ class PageDependencyGraph {
* @return {Promise<Node>}
*/
static async compute_(data, context) {
const {trace, devtoolsLog} = data;
const {trace, devtoolsLog, URL} = data;
const [processedTrace, networkRecords] = await Promise.all([
ProcessedTrace.request(trace, context),
NetworkRecords.request(devtoolsLog, context),
]);

// COMPAT: Backport for pre-10.0 clients that don't pass the URL artifact here (e.g. pubads).
// Calculates the URL artifact from the processed trace and DT log.
const URL = data.URL || await DocumentUrls.request(data, context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like the only usage of DocumentUrls, we can probably just remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its used in core/scripts/lantern/run-once.js


const mainThreadEvents = processedTrace.mainThreadEvents;
const lanternRequests = networkRecords.map(NetworkRequest.asLanternNetworkRequest);
return LanternPageDependencyGraph.createGraph(mainThreadEvents, lanternRequests, URL);
Expand Down
14 changes: 0 additions & 14 deletions core/test/computed/page-dependency-graph-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,5 @@ describe('PageDependencyGraph computed artifact', () => {
assert.ok(nodeWithNestedDependents, 'did not link initiators');
});
});

it('should compute the dependency graph with URL backport', () => {
const context = {computedCache: new Map()};
return PageDependencyGraph.request({
trace: sampleTrace,
devtoolsLog: sampleDevtoolsLog,
}, context).then(output => {
assert.ok(output instanceof BaseNode, 'did not return a graph');

const dependents = output.getDependents();
const nodeWithNestedDependents = dependents.find(node => node.getDependents().length);
assert.ok(nodeWithNestedDependents, 'did not link initiators');
});
});
});
});
Loading