Bug 1351008 - Lazily load Manifest jsms in manifestMessages.js. r=baku draft
authorAndrew McCreight <continuation@gmail.com>
Mon, 27 Mar 2017 11:48:18 -0700
changeset 553213 f4fe6d56212d67abb40416495250b48ed33852e5
parent 553212 1faefc1821bb47f9d4ce4961367a3c6c419db6ee
child 553214 942d678ad5a37a1df16829385e3603de1a9d53f5
push id51552
push userbmo:continuation@gmail.com
push dateWed, 29 Mar 2017 15:33:20 +0000
reviewersbaku
bugs1351008
milestone55.0a1
Bug 1351008 - Lazily load Manifest jsms in manifestMessages.js. r=baku This avoids loading 7 jsms until they are actually needed, reducing content process memory usage. MozReview-Commit-ID: 8ukNr7PL80A
dom/ipc/manifestMessages.js
--- a/dom/ipc/manifestMessages.js
+++ b/dom/ipc/manifestMessages.js
@@ -11,21 +11,26 @@
  *
  * BUG: https://bugzilla.mozilla.org/show_bug.cgi?id=1083410
  */
 /*globals Task, ManifestObtainer, ManifestFinder, content, sendAsyncMessage, addMessageListener, Components*/
 "use strict";
 const {
   utils: Cu,
 } = Components;
-Cu.import("resource://gre/modules/ManifestObtainer.jsm");
-Cu.import("resource://gre/modules/ManifestFinder.jsm");
-Cu.import("resource://gre/modules/ManifestIcons.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "ManifestObtainer",
+				  "resource://gre/modules/ManifestObtainer.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ManifestFinder",
+				  "resource://gre/modules/ManifestFinder.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ManifestIcons",
+				  "resource://gre/modules/ManifestIcons.jsm");
+
 const MessageHandler = {
   registerListeners() {
     addMessageListener(
       "DOM:WebManifest:hasManifestLink",
       this.hasManifestLink.bind(this)
     );
     addMessageListener(
       "DOM:ManifestObtainer:Obtain",