Skip to content

Commit

Permalink
core: remove context.url (#13806)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Mar 31, 2022
1 parent 589ee41 commit 2f07300
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 18 deletions.
3 changes: 0 additions & 3 deletions lighthouse-core/fraggle-rock/gather/runner-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* @property {LH.Gatherer.GatherMode} gatherMode
* @property {Map<string, LH.ArbitraryEqualityMap>} computedCache
* @property {LH.Config.Settings} settings
* @property {string} url
*/

/** @typedef {Record<string, Promise<any>>} IntermediateArtifacts */
Expand Down Expand Up @@ -75,7 +74,6 @@ async function collectPhaseArtifacts(options) {
gatherMode,
computedCache,
settings,
url,
} = options;
const priorPhase = phaseToPriorPhase[phase];
const priorPhaseArtifacts = (priorPhase && artifactState[priorPhase]) || {};
Expand All @@ -92,7 +90,6 @@ async function collectPhaseArtifacts(options) {
: /** @type {Dependencies} */ ({});

return gatherer[phase]({
url,
gatherMode,
driver,
baseArtifacts,
Expand Down
1 change: 0 additions & 1 deletion lighthouse-core/fraggle-rock/gather/snapshot-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ async function snapshotGather(options) {
const artifactDefinitions = config.artifacts || [];
const artifactState = getEmptyArtifactState();
await collectPhaseArtifacts({
url,
phase: 'getArtifact',
gatherMode: 'snapshot',
driver,
Expand Down
2 changes: 0 additions & 2 deletions lighthouse-core/fraggle-rock/gather/timespan-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ async function startTimespanGather(options) {
const artifactState = getEmptyArtifactState();
/** @type {Omit<import('./runner-helpers.js').CollectPhaseArtifactOptions, 'phase'>} */
const phaseOptions = {
url: initialUrl,
driver,
artifactDefinitions,
artifactState,
Expand All @@ -54,7 +53,6 @@ async function startTimespanGather(options) {
return {
async endTimespanGather() {
const finalUrl = await driver.url();
phaseOptions.url = finalUrl;

const runnerOptions = {config, computedCache};
const artifacts = await Runner.gather(
Expand Down
3 changes: 2 additions & 1 deletion lighthouse-core/gather/gatherers/seo/robots-txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class RobotsTxt extends FRGatherer {
});
}

const robotsUrl = new URL('/robots.txt', passContext.url).href;
const {finalUrl} = passContext.baseArtifacts.URL;
const robotsUrl = new URL('/robots.txt', finalUrl).href;
await passContext.driver.fetcher.enable();
return passContext.driver.fetcher.fetchResource(robotsUrl)
.catch(err => ({status: null, content: null, errorMessage: err.message}));
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/gather/gatherers/web-app-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class WebAppManifest extends FRGatherer {
*/
getArtifact(context) {
const driver = context.driver;

return WebAppManifest.getWebAppManifest(driver.defaultSession, context.url);
const {finalUrl} = context.baseArtifacts.URL;
return WebAppManifest.getWebAppManifest(driver.defaultSession, finalUrl);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe('collectPhaseArtifacts', () => {
it(`should run the ${phase} phase of gatherers in ${gatherMode} mode`, async () => {
const {artifactDefinitions, gatherers} = createGathererSet();
await helpers.collectPhaseArtifacts({
url: 'https://example.com',
driver,
artifactDefinitions,
artifactState,
Expand All @@ -157,7 +156,6 @@ describe('collectPhaseArtifacts', () => {
it('should gather the artifacts', async () => {
const {artifactDefinitions} = createGathererSet();
await helpers.collectPhaseArtifacts({
url: 'https://example.com',
driver,
artifactDefinitions,
artifactState,
Expand Down Expand Up @@ -190,7 +188,6 @@ describe('collectPhaseArtifacts', () => {
];

await helpers.collectPhaseArtifacts({
url: 'https://example.com',
driver,
artifactDefinitions,
artifactState,
Expand Down Expand Up @@ -224,7 +221,6 @@ describe('collectPhaseArtifacts', () => {

const {artifactDefinitions, gatherers} = createGathererSet();
await helpers.collectPhaseArtifacts({
url: 'https://example.com',
driver,
artifactDefinitions,
artifactState,
Expand Down
3 changes: 0 additions & 3 deletions lighthouse-core/test/gather/gatherers/css-usage-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('.getArtifact', () => {
/** @type {LH.Gatherer.FRTransitionalContext} */
const context = {
driver: driver.asDriver(),
url: 'https://example.com',
gatherMode: 'snapshot',
computedCache: new Map(),
baseArtifacts: createMockBaseArtifacts(),
Expand Down Expand Up @@ -98,7 +97,6 @@ describe('.getArtifact', () => {
/** @type {LH.Gatherer.FRTransitionalContext} */
const context = {
driver: driver.asDriver(),
url: 'https://example.com',
gatherMode: 'timespan',
computedCache: new Map(),
baseArtifacts: createMockBaseArtifacts(),
Expand Down Expand Up @@ -154,7 +152,6 @@ describe('.getArtifact', () => {
/** @type {LH.Gatherer.FRTransitionalContext} */
const context = {
driver: driver.asDriver(),
url: 'https://example.com',
gatherMode: 'snapshot',
computedCache: new Map(),
baseArtifacts: createMockBaseArtifacts(),
Expand Down
2 changes: 0 additions & 2 deletions types/gatherer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ declare module Gatherer {

/** The limited context interface shared between pre and post Fraggle Rock Lighthouse. */
interface FRTransitionalContext<TDependencies extends DependencyKey = DefaultDependenciesKey> {
/** The URL of the page that is currently active. Might be `about:blank` in the before phases */
url: string;
/** The gather mode Lighthouse is currently in. */
gatherMode: GatherMode;
/** The connection to the page being analyzed. */
Expand Down

0 comments on commit 2f07300

Please sign in to comment.