Bug 1297202 - Support cross-namespace submodule references in schemas r=aswan

MozReview-Commit-ID: 5JfOI3i3xbW

--HG--
extra : rebase_source : 48aad5003198fe9ec101b5b96c0b5fccd26c08d9
This commit is contained in:
Rob Wu 2016-08-22 15:11:47 -07:00
Родитель 7e511c5952
Коммит 4b607a2721
2 изменённых файлов: 15 добавлений и 0 удалений

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

@ -1203,6 +1203,11 @@ class SubModuleProperty extends Entry {
let ns = Schemas.namespaces.get(this.namespaceName);
let type = ns.get(this.reference);
if (!type && this.reference.includes(".")) {
let [namespaceName, ref] = this.reference.split(".");
ns = Schemas.namespaces.get(namespaceName);
type = ns.get(ref);
}
if (!type || !(type instanceof SubModuleType)) {
throw new Error(`Internal error: ${this.namespaceName}.${this.reference} is not a sub-module`);
}

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

@ -341,6 +341,12 @@ let json = [
},
],
},
{
namespace: "foreign",
properties: {
foreignRef: {$ref: "testing.submodule"},
},
},
{
namespace: "inject",
properties: {
@ -781,6 +787,10 @@ add_task(function* () {
Assert.throws(() => root.testing.prop4.sub_foo(),
/root.testing.prop4 is undefined/,
"should throw for unsupported submodule");
root.foreign.foreignRef.sub_foo();
verify("call", "foreign.foreignRef", "sub_foo", []);
tallied = null;
});
let deprecatedJson = [