in src/linter.js [279:321]
async getAddonMetadata({
_log = log,
ManifestJSONParser = DefaultManifestJSONParser,
} = {}) {
if (this.addonMetadata !== null) {
_log.debug('Metadata already set; returning cached metadata.');
return this.addonMetadata;
}
const files = await this.io.getFiles();
if (Object.prototype.hasOwnProperty.call(files, constants.MANIFEST_JSON)) {
_log.info('Retrieving metadata from manifest.json');
const json = await this.io.getFileAsString(constants.MANIFEST_JSON);
const manifestParser = new ManifestJSONParser(json, this.collector, {
io: this.io,
isAlreadySigned: Object.keys(files).some((filename) =>
constants.ALREADY_SIGNED_REGEX.test(filename)
),
isEnterprise: this.config.enterprise,
selfHosted: this.config.selfHosted,
schemaValidatorOptions: {
privileged: this.config.privileged,
minManifestVersion: this.config.minManifestVersion,
maxManifestVersion: this.config.maxManifestVersion,
enableBackgroundServiceWorker:
this.config.enableBackgroundServiceWorker,
},
});
await manifestParser.validateIcons();
if (manifestParser.isStaticTheme) {
await manifestParser.validateStaticThemeImages();
}
this.addonMetadata = manifestParser.getMetadata();
} else {
_log.warn(
`No ${constants.MANIFEST_JSON} was found in the package metadata`
);
this.collector.addError(messages.TYPE_NO_MANIFEST_JSON);
this.addonMetadata = {};
}
this.addonMetadata.totalScannedFileSize = 0;
return this.addonMetadata;
}