Bug 1382645: Part 2 - Throw away schema StructuredCloneHolders in content process after deserialization. r?mixedpuppy
MozReview-Commit-ID: BBLF3zWxAyt
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -2631,19 +2631,31 @@ this.Schemas = {
this._needFlush = true;
Object.defineProperty(this, "rootNamespace", {
enumerable: true,
configurable: true,
value: new Namespace("", []),
});
- for (let blob of this.schemaJSON.values()) {
+ for (let [key, schema] of this.schemaJSON.entries()) {
try {
- this.loadSchema(blob.deserialize(global));
+ if (typeof schema.deserialize === "function") {
+ schema = schema.deserialize(global);
+
+ // If we're in the parent process, we need to keep the
+ // StructuredCloneHolder blob around in order to send to future child
+ // processes. If we're in a child, we have no further use for it, so
+ // just store the deserialized schema data in its place.
+ if (!isParentProcess) {
+ this.schemaJSON.set(key, schema);
+ }
+ }
+
+ this.loadSchema(schema);
} catch (e) {
Cu.reportError(e);
}
}
return this.rootNamespace;
},