Bug 1771079 - fix TPS when sync ping validation is disabled. r=LougeniaBailey

Differential Revision: https://phabricator.services.mozilla.com/D147264
This commit is contained in:
Mark Hammond 2022-05-25 21:55:00 +00:00
Родитель 00fec71b01
Коммит 97d81f421f
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -984,15 +984,21 @@ var TPS = {
return root;
},
_pingValidator: null,
// Default ping validator that always says the ping passes. This should be
// overridden unless the `testing.tps.skipPingValidation` pref is true.
pingValidator(ping) {
return {
validate() {
Logger.logInfo("Not validating ping -- disabled by pref");
return { valid: true, errors: [] };
},
};
get pingValidator() {
return this._pingValidator
? this._pingValidator
: {
validate() {
Logger.logInfo(
"Not validating ping -- disabled by pref or failure to load schema"
);
return { valid: true, errors: [] };
},
};
},
// Attempt to load the sync_ping_schema.json and initialize `this.pingValidator`
@ -1018,7 +1024,7 @@ var TPS = {
let schema = JSON.parse(gTextDecoder.decode(bytes));
Logger.logInfo("Successfully loaded schema");
this.pingValidator = new JsonSchema.Validator(schema);
this._pingValidator = new JsonSchema.Validator(schema);
} catch (e) {
this.DumpError(
`Failed to load ping schema relative to "${testFile}".`,