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(manifest): remove Manifest artifact #7078

Merged
merged 3 commits into from
Jan 29, 2019
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
3 changes: 0 additions & 3 deletions lighthouse-cli/test/cli/__snapshots__/index-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,6 @@ Object {
Object {
"path": "viewport-dimensions",
},
Object {
"path": "manifest",
},
Object {
"path": "runtime-exceptions",
},
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/installable-manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class InstallableManifest extends MultiCheckAudit {
description: 'Browsers can proactively prompt users to add your app to their homescreen, ' +
'which can lead to higher engagement. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/install-prompt).',
requiredArtifacts: ['URL', 'Manifest'],
requiredArtifacts: ['URL', 'WebAppManifest'],
};
}

Expand Down Expand Up @@ -79,7 +79,7 @@ class InstallableManifest extends MultiCheckAudit {
* @return {Promise<{failures: Array<string>, manifestValues: LH.Artifacts.ManifestValues}>}
*/
static async audit_(artifacts, context) {
const manifestValues = await ManifestValues.request(artifacts.Manifest, context);
const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context);
const manifestFailures = InstallableManifest.assessManifest(manifestValues);

return {
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/offline-start-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class OfflineStartUrl extends Audit {
title: 'start_url responds with a 200 when offline',
failureTitle: 'start_url does not respond with a 200 when offline',
description: 'A service worker enables your web app to be reliable in unpredictable network conditions. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/http-200-when-offline).',
requiredArtifacts: ['Manifest', 'StartUrl'],
requiredArtifacts: ['WebAppManifest', 'StartUrl'],
};
}

Expand All @@ -29,7 +29,7 @@ class OfflineStartUrl extends Audit {
// StartUrl gatherer will give explanations for failures, but need to take manifest parsing
// warnings from the manifest itself (e.g. invalid `start_url`, so fell back to document URL).
const warnings = [];
const manifest = artifacts.Manifest;
const manifest = artifacts.WebAppManifest;
if (manifest && manifest.value && manifest.value.start_url.warning) {
const manifestWarning = manifest.value.start_url.warning;
warnings.push('We couldn\'t read the start_url from the manifest. As a result, the ' +
Expand Down
7 changes: 4 additions & 3 deletions lighthouse-core/audits/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ServiceWorker extends Audit {
description: 'The service worker is the technology that enables your app to use many ' +
'Progressive Web App features, such as offline, add to homescreen, and push ' +
'notifications. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/registered-service-worker).',
requiredArtifacts: ['URL', 'ServiceWorker', 'Manifest'],
requiredArtifacts: ['URL', 'ServiceWorker', 'WebAppManifest'],
};
}

Expand Down Expand Up @@ -64,7 +64,7 @@ class ServiceWorker extends Audit {
/**
* Returns a failure message if there is no start_url or if the start_url isn't
* contolled by the scopeUrl.
* @param {LH.Artifacts['Manifest']} manifest
* @param {LH.Artifacts['WebAppManifest']} manifest
* @param {string} scopeUrl
* @return {string|undefined}
*/
Expand Down Expand Up @@ -107,7 +107,8 @@ class ServiceWorker extends Audit {
};
}

const startUrlFailure = ServiceWorker.checkStartUrl(artifacts.Manifest, controllingScopeUrl);
const startUrlFailure = ServiceWorker.checkStartUrl(artifacts.WebAppManifest,
controllingScopeUrl);
if (startUrlFailure) {
return {
rawValue: false,
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/splash-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SplashScreen extends MultiCheckAudit {
description: 'A themed splash screen ensures a high-quality experience when ' +
'users launch your app from their homescreens. [Learn ' +
'more](https://developers.google.com/web/tools/lighthouse/audits/custom-splash-screen).',
requiredArtifacts: ['Manifest'],
requiredArtifacts: ['WebAppManifest'],
};
}

Expand Down Expand Up @@ -72,7 +72,7 @@ class SplashScreen extends MultiCheckAudit {
/** @type {Array<string>} */
const failures = [];

const manifestValues = await ManifestValues.request(artifacts.Manifest, context);
const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context);
SplashScreen.assessManifest(manifestValues, failures);

return {
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/themed-omnibox.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ThemedOmnibox extends MultiCheckAudit {
failureTitle: 'Does not set an address-bar theme color',
description: 'The browser address bar can be themed to match your site. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/address-bar).',
requiredArtifacts: ['Manifest', 'MetaElements'],
requiredArtifacts: ['WebAppManifest', 'MetaElements'],
};
}

Expand Down Expand Up @@ -80,7 +80,7 @@ class ThemedOmnibox extends MultiCheckAudit {
const failures = [];

const themeColorMeta = artifacts.MetaElements.find(meta => meta.name === 'theme-color');
const manifestValues = await ManifestValues.request(artifacts.Manifest, context);
const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context);
ThemedOmnibox.assessManifest(manifestValues, failures);
ThemedOmnibox.assessMetaThemecolor(themeColorMeta, failures);

Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/computed/manifest-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ManifestValues {

/**
* Returns results of all manifest checks
* @param {LH.Artifacts['Manifest']} manifest
* @param {LH.Artifacts['WebAppManifest']} manifest
* @return {Promise<LH.Artifacts.ManifestValues>}
*/
static async compute_(manifest) {
Expand Down
1 change: 0 additions & 1 deletion lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const defaultConfig = {
'scripts',
'css-usage',
'viewport-dimensions',
'manifest',
'runtime-exceptions',
'chrome-console-messages',
'accessibility',
Expand Down
23 changes: 0 additions & 23 deletions lighthouse-core/gather/gatherers/manifest.js

This file was deleted.

16 changes: 8 additions & 8 deletions lighthouse-core/test/audits/installable-manifest-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function generateMockArtifacts(src = manifestSrc) {
const exampleManifest = manifestParser(src, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);

const clonedArtifacts = JSON.parse(JSON.stringify({
Manifest: exampleManifest,
WebAppManifest: exampleManifest,
URL: {finalUrl: 'https://example.com'},
}));
return clonedArtifacts;
Expand All @@ -34,7 +34,7 @@ describe('PWA: webapp install banner audit', () => {
describe('basics', () => {
it('fails if page had no manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = null;
artifacts.WebAppManifest = null;
const context = generateMockAuditContext();

return InstallableManifestAudit.audit(artifacts, context).then(result => {
Expand All @@ -45,7 +45,7 @@ describe('PWA: webapp install banner audit', () => {

it('fails with a non-parsable manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
artifacts.WebAppManifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
const context = generateMockAuditContext();
return InstallableManifestAudit.audit(artifacts, context).then(result => {
assert.strictEqual(result.rawValue, false);
Expand All @@ -55,7 +55,7 @@ describe('PWA: webapp install banner audit', () => {

it('fails when an empty manifest is present', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
artifacts.WebAppManifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
const context = generateMockAuditContext();
return InstallableManifestAudit.audit(artifacts, context).then(result => {
assert.strictEqual(result.rawValue, false);
Expand All @@ -76,7 +76,7 @@ describe('PWA: webapp install banner audit', () => {
describe('one-off-failures', () => {
it('fails when a manifest contains no start_url', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.start_url.value = undefined;
artifacts.WebAppManifest.value.start_url.value = undefined;
const context = generateMockAuditContext();

return InstallableManifestAudit.audit(artifacts, context).then(result => {
Expand All @@ -92,7 +92,7 @@ describe('PWA: webapp install banner audit', () => {

it('fails when a manifest contains no short_name', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.short_name.value = undefined;
artifacts.WebAppManifest.value.short_name.value = undefined;
const context = generateMockAuditContext();

return InstallableManifestAudit.audit(artifacts, context).then(result => {
Expand All @@ -108,7 +108,7 @@ describe('PWA: webapp install banner audit', () => {

it('fails when a manifest contains no name', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.name.value = undefined;
artifacts.WebAppManifest.value.name.value = undefined;
const context = generateMockAuditContext();

return InstallableManifestAudit.audit(artifacts, context).then(result => {
Expand All @@ -124,7 +124,7 @@ describe('PWA: webapp install banner audit', () => {

it('fails if page had no icons in the manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.icons.value = [];
artifacts.WebAppManifest.value.icons.value = [];
const context = generateMockAuditContext();

return InstallableManifestAudit.audit(artifacts, context).then(result => {
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/test/audits/offline-start-url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Offline start_url audit', () => {
};

const artifacts = {
Manifest: getManifest(manifest),
WebAppManifest: getManifest(manifest),
StartUrl: {statusCode: 200},
};
const context = generateMockAuditContext();
Expand Down
12 changes: 6 additions & 6 deletions lighthouse-core/test/audits/service-worker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ function createSWArtifact(swOpts) {
* Create a set of artifacts for the ServiceWorker audit.
* @param {Array<{scriptURL: string, status: string, scopeURL?: string}>} swOpts
* @param {string} finalUrl
* @param {{}}} manifestJson Manifest object or null if no manifest desired.
* @param {{}}} manifestJson WebAppManifest object or null if no manifest desired.
*/
function createArtifacts(swOpts, finalUrl, manifestJson) {
const manifestUrl = getBaseDirectory(finalUrl) + 'manifest.json';
let Manifest;
let WebAppManifest;
if (manifestJson === null) {
Manifest = null;
WebAppManifest = null;
} else if (typeof manifestJson === 'object') {
Manifest = manifestParser(JSON.stringify(manifestJson), manifestUrl, finalUrl);
WebAppManifest = manifestParser(JSON.stringify(manifestJson), manifestUrl, finalUrl);
} else {
throw new Error('unsupported test manifest format');
}

return {
ServiceWorker: createSWArtifact(swOpts),
URL: {finalUrl},
Manifest,
WebAppManifest,
};
}

Expand Down Expand Up @@ -290,7 +290,7 @@ describe('Offline: service worker audit', () => {
}];

const artifacts = createArtifacts(swOpts, finalUrl, {});
artifacts.Manifest = manifestParser('{,;}', finalUrl, finalUrl);
artifacts.WebAppManifest = manifestParser('{,;}', finalUrl, finalUrl);

const output = ServiceWorker.audit(artifacts);
expect(output).toMatchObject({
Expand Down
16 changes: 8 additions & 8 deletions lighthouse-core/test/audits/splash-screen-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function generateMockArtifacts(src = manifestSrc) {
const exampleManifest = manifestParser(src, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);

return {
Manifest: exampleManifest,
WebAppManifest: exampleManifest,
};
}
function generateMockAuditContext() {
Expand All @@ -35,7 +35,7 @@ describe('PWA: splash screen audit', () => {
describe('basics', () => {
it('fails if page had no manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = null;
artifacts.WebAppManifest = null;
const context = generateMockAuditContext();

return SplashScreenAudit.audit(artifacts, context).then(result => {
Expand All @@ -46,7 +46,7 @@ describe('PWA: splash screen audit', () => {

it('fails with a non-parsable manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
artifacts.WebAppManifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
const context = generateMockAuditContext();
return SplashScreenAudit.audit(artifacts, context).then(result => {
assert.strictEqual(result.rawValue, false);
Expand All @@ -56,7 +56,7 @@ describe('PWA: splash screen audit', () => {

it('fails when an empty manifest is present', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
artifacts.WebAppManifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
const context = generateMockAuditContext();
return SplashScreenAudit.audit(artifacts, context).then(result => {
assert.strictEqual(result.rawValue, false);
Expand All @@ -77,7 +77,7 @@ describe('PWA: splash screen audit', () => {
describe('one-off-failures', () => {
it('fails when a manifest contains no name', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.name.value = undefined;
artifacts.WebAppManifest.value.name.value = undefined;
const context = generateMockAuditContext();

return SplashScreenAudit.audit(artifacts, context).then(result => {
Expand All @@ -88,7 +88,7 @@ describe('PWA: splash screen audit', () => {

it('fails when a manifest contains no background color', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.background_color.value = undefined;
artifacts.WebAppManifest.value.background_color.value = undefined;
const context = generateMockAuditContext();

return SplashScreenAudit.audit(artifacts, context).then(result => {
Expand All @@ -111,7 +111,7 @@ describe('PWA: splash screen audit', () => {

it('fails when a manifest contains no theme color', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.theme_color.value = undefined;
artifacts.WebAppManifest.value.theme_color.value = undefined;
const context = generateMockAuditContext();

return SplashScreenAudit.audit(artifacts, context).then(result => {
Expand All @@ -122,7 +122,7 @@ describe('PWA: splash screen audit', () => {

it('fails if page had no icons in the manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest.value.icons.value = [];
artifacts.WebAppManifest.value.icons.value = [];
const context = generateMockAuditContext();

return SplashScreenAudit.audit(artifacts, context).then(result => {
Expand Down
12 changes: 6 additions & 6 deletions lighthouse-core/test/audits/themed-omnibox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const exampleManifest = noUrlManifestParser(manifestSrc);

function generateMockArtifacts() {
return {
Manifest: exampleManifest,
WebAppManifest: exampleManifest,
MetaElements: [{name: 'theme-color', content: '#bada55'}],
};
}
Expand All @@ -30,7 +30,7 @@ function generateMockAuditContext() {
* Simple manifest parsing helper when the manifest URLs aren't material to the
* test. Uses example.com URLs for testing.
* @param {string} manifestSrc
* @return {!ManifestNode<(!Manifest|undefined)>}
* @return {!ManifestNode<(!WebAppManifest|undefined)>}
*/
function noUrlManifestParser(manifestSrc) {
return manifestParser(manifestSrc, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL);
Expand All @@ -40,7 +40,7 @@ function noUrlManifestParser(manifestSrc) {
describe('PWA: themed omnibox audit', () => {
it('fails if page had no manifest', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = null;
artifacts.WebAppManifest = null;
const context = generateMockAuditContext();

return ThemedOmniboxAudit.audit(artifacts, context).then(result => {
Expand All @@ -53,7 +53,7 @@ describe('PWA: themed omnibox audit', () => {
/* eslint-disable camelcase */
it('fails when a minimal manifest contains no theme_color', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = noUrlManifestParser(JSON.stringify({
artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({
start_url: '/',
}));
const context = generateMockAuditContext();
Expand All @@ -66,7 +66,7 @@ describe('PWA: themed omnibox audit', () => {

it('succeeds when a minimal manifest contains a theme_color', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = noUrlManifestParser(JSON.stringify({
artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({
theme_color: '#bada55',
}));
const context = generateMockAuditContext();
Expand Down Expand Up @@ -129,7 +129,7 @@ describe('PWA: themed omnibox audit', () => {

it('fails if HTML theme color is good, but manifest themecolor is bad', () => {
const artifacts = generateMockArtifacts();
artifacts.Manifest = noUrlManifestParser(JSON.stringify({
artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({
start_url: '/',
}));
const context = generateMockAuditContext();
Expand Down
Loading