Skip to content

Commit

Permalink
Bug 1743570 - Always validate schemas in RemoteSettingsExperimentLoad…
Browse files Browse the repository at this point in the history
…er r=emcminn

Differential Revision: https://phabricator.services.mozilla.com/D150692
  • Loading branch information
Barret Rennie committed Jul 12, 2022
1 parent f922ff3 commit bfa5aab
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions toolkit/components/nimbus/lib/RemoteSettingsExperimentLoader.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,16 @@ class _RemoteSettingsExperimentLoader {
);
}

if (feature.enabled ?? true) {
const result = validator.validate(value);
if (!result.valid) {
Cu.reportError(
`Experiment ${id} branch ${branchIdx} feature ${featureId} does not validate: ${JSON.stringify(
result.errors,
undefined,
2
)}`
);
return false;
}
} else {
lazy.log.debug(
`Experiment ${id} branch ${branchIdx} feature ${featureId} disabled; skipping validation`
const result = validator.validate(value);
if (!result.valid) {
Cu.reportError(
`Experiment ${id} branch ${branchIdx} feature ${featureId} does not validate: ${JSON.stringify(
result.errors,
undefined,
2
)}`
);
return false;
}
}
}
Expand Down

0 comments on commit bfa5aab

Please sign in to comment.