Bug 836086 - Lazy load Sync's keys.js; r=rnewman
authorGregory Szorc <gps@mozilla.com>
Tue, 29 Jan 2013 16:46:22 -0800
changeset 120356 193ab8cee72a16c325290618601c7a4ae3be2def
parent 120197 6cca454559c8b9f0c785354f2e69441ae34650f1
child 120357 6a2236d7b359ef486974101024f10aafcf8c29ed
push id24249
push usergszorc@mozilla.com
push dateThu, 31 Jan 2013 00:12:11 +0000
treeherdermozilla-central@20bbf73921f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs836086
milestone21.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 836086 - Lazy load Sync's keys.js; r=rnewman
services/sync/modules/identity.js
--- a/services/sync/modules/identity.js
+++ b/services/sync/modules/identity.js
@@ -3,21 +3,28 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["IdentityManager"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://services-sync/constants.js");
-Cu.import("resource://services-sync/keys.js");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-sync/util.js");
 
+// Lazy import to prevent unnecessary load on startup.
+for (let symbol of ["BulkKeyBundle", "SyncKeyBundle"]) {
+  XPCOMUtils.defineLazyModuleGetter(this, symbol,
+                                    "resource://services-sync/keys.js",
+                                    symbol);
+}
+
 /**
  * Manages identity and authentication for Sync.
  *
  * The following entities are managed:
  *
  *   account - The main Sync/services account. This is typically an email
  *     address.
  *   username - A normalized version of your account. This is what's