Bug 1452307: Remove some dead code. r=aswan

MozReview-Commit-ID: DpV0WWW8WKF

--HG--
extra : rebase_source : e697d8fd91c40c15df21551514b239de6a9a117f
extra : histedit_source : 45120f4b9208ab3f92b9cbc295b1c6e706412bd1
This commit is contained in:
Kris Maglione 2018-04-08 12:55:20 -07:00
parent e77bbb4f83
commit 32fa162ac2
2 changed files with 18 additions and 34 deletions

View File

@ -3014,6 +3014,10 @@ this.Schemas = {
if (!this.initialized) {
this.init();
}
if (!this._rootSchema) {
this._rootSchema = new SchemaRoot(null, this.schemaJSON);
this._rootSchema.parseSchemas();
}
return this._rootSchema;
},
@ -3036,8 +3040,6 @@ this.Schemas = {
Services.cpmm.addMessageListener("Schema:Add", this);
}
this.flushSchemas();
},
receiveMessage(msg) {
@ -3055,27 +3057,10 @@ this.Schemas = {
for (let [url, schema] of data) {
this.schemaJSON.set(url, schema);
}
this.flushSchemas();
if (this._rootScheam) {
throw new Error("Schema loaded after root schema populated");
}
break;
case "Schema:Delete":
this.schemaJSON.delete(data.url);
this.flushSchemas();
break;
}
},
_needFlush: true,
flushSchemas() {
if (this._needFlush) {
this._needFlush = false;
XPCOMUtils.defineLazyGetter(this, "_rootSchema", () => {
this._needFlush = true;
let rootSchema = new SchemaRoot(null, this.schemaJSON);
rootSchema.parseSchemas();
return rootSchema;
});
}
},
@ -3104,7 +3089,9 @@ this.Schemas = {
this.schemaHook([[url, schema]]);
}
this.flushSchemas();
if (this._rootScheam) {
throw new Error("Schema loaded after root schema populated");
}
},
fetch(url) {
@ -3130,17 +3117,6 @@ this.Schemas = {
}
},
unload(url) {
this.schemaJSON.delete(url);
let data = Services.ppmm.initialProcessData;
data["Extension:Schemas"] = this.schemaJSON;
Services.ppmm.broadcastAsyncMessage("Schema:Delete", {url});
this.flushSchemas();
},
/**
* Checks whether a given object has the necessary permissions to
* expose the given namespace.

View File

@ -512,6 +512,7 @@ let wrapper = {
add_task(async function() {
let url = "data:," + JSON.stringify(json);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1055,6 +1056,7 @@ let deprecatedJson = [
add_task(async function testDeprecation() {
let url = "data:," + JSON.stringify(deprecatedJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1211,6 +1213,7 @@ let choicesJson = [
add_task(async function testChoices() {
let url = "data:," + JSON.stringify(choicesJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1300,6 +1303,7 @@ let permissionsJson = [
add_task(async function testPermissions() {
let url = "data:," + JSON.stringify(permissionsJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1399,6 +1403,7 @@ let nestedNamespaceJson = [
add_task(async function testNestedNamespace() {
let url = "data:," + JSON.stringify(nestedNamespaceJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1488,6 +1493,7 @@ let $importJson = [
add_task(async function test_$import() {
let url = "data:," + JSON.stringify($importJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let root = {};
@ -1626,6 +1632,7 @@ let defaultsJson = [
add_task(async function testDefaults() {
let url = "data:," + JSON.stringify(defaultsJson);
Schemas._rootSchema = null;
await Schemas.load(url);
let testingApiObj = {
@ -1692,6 +1699,7 @@ let returnsJson = [{
add_task(async function testReturns() {
const url = "data:," + JSON.stringify(returnsJson);
Schemas._rootSchema = null;
await Schemas.load(url);
const apiObject = {