Bug 1757778 - Expose Nimbus schemas as resource:// URIs r=andreio

Differential Revision: https://phabricator.services.mozilla.com/D138929
This commit is contained in:
Barret Rennie 2022-03-25 00:01:19 +00:00
Родитель ad78c6e309
Коммит 051dfe31ad
5 изменённых файлов: 12 добавлений и 16 удалений

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

@ -65,6 +65,9 @@ var gExceptionPaths = [
// Page data schemas are referenced programmatically.
"chrome://browser/content/pagedata/schemas/",
// Nimbus schemas are referenced programmatically.
"resource://nimbus/schemas/",
];
// These are not part of the omni.ja file, so we find them only when running

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

@ -7,3 +7,5 @@ toolkit.jar:
res/nimbus/lib/ (./lib/*.jsm)
res/nimbus/ExperimentAPI.jsm (./ExperimentAPI.jsm)
res/nimbus/FeatureManifest.js (FeatureManifest.js)
res/nimbus/schemas/NimbusEnrollment.schema.json (./schemas/NimbusEnrollment.schema.json)
res/nimbus/schemas/NimbusExperiment.schema.json (./schemas/NimbusExperiment.schema.json)

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

@ -29,10 +29,6 @@ XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"]
SPHINX_TREES["docs"] = "docs"
TESTING_JS_MODULES += [
"schemas/ExperimentFeatureManifest.schema.json",
"schemas/ExperimentFeatureRemote.schema.json",
"schemas/NimbusEnrollment.schema.json",
"schemas/NimbusExperiment.schema.json",
"test/NimbusTestUtils.jsm",
]

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

@ -84,7 +84,7 @@ const ExperimentTestUtils = {
async validateExperiment(experiment) {
const schema = (
await fetchSchema(
"resource://testing-common/NimbusExperiment.schema.json"
"resource://nimbus/schemas/NimbusExperiment.schema.json"
)
).NimbusExperiment;
@ -109,7 +109,7 @@ const ExperimentTestUtils = {
async validateEnrollment(enrollment) {
const schema = (
await fetchSchema(
"resource://testing-common/NimbusEnrollment.schema.json"
"resource://nimbus/schemas/NimbusEnrollment.schema.json"
)
).NimbusExperiment;
@ -131,7 +131,7 @@ const ExperimentTestUtils = {
async validateRollouts(rollout) {
const schema = (
await fetchSchema(
"resource://testing-common/NimbusEnrollment.schema.json"
"resource://nimbus/schemas/NimbusEnrollment.schema.json"
)
).NimbusExperiment;

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

@ -7,15 +7,10 @@ const {
Cu.importGlobalProperties(["fetch"]);
XPCOMUtils.defineLazyGetter(this, "fetchSchema", async () => {
const response = await fetch(
"resource://testing-common/NimbusEnrollment.schema.json"
);
const schema = await response.json();
if (!schema) {
throw new Error("Failed to load ExperimentFeatureRemote schema");
}
return schema.definitions.NimbusExperiment;
XPCOMUtils.defineLazyGetter(this, "fetchSchema", () => {
return fetch("resource://nimbus/schemas/NimbusEnrollment.schema.json", {
credentials: "omit",
}).then(rsp => rsp.json());
});
const NON_MATCHING_ROLLOUT = Object.freeze(