Bug 1382645: Part 2 - Throw away schema StructuredCloneHolders in content process after deserialization. r=mixedpuppy
authorKris Maglione <maglione.k@gmail.com>
Thu, 20 Jul 2017 14:01:37 -0700
changeset 419698 f6dc4970d2803673baab24a23f3dea9a08fbd342
parent 419697 6e59c41b3584fb692f0237701034cea162d5df8b
child 419699 f39eaceb3ca0d81717297e52e493eb2fca7df2ea
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1382645
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382645: Part 2 - Throw away schema StructuredCloneHolders in content process after deserialization. r=mixedpuppy MozReview-Commit-ID: BBLF3zWxAyt
toolkit/components/extensions/Schemas.jsm
--- 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;
   },