Bug 1034836 - Lazily load some modules in Startup.jsm. r=myk

This commit is contained in:
Marco Castelluccio 2014-07-12 02:15:35 +02:00
parent 6870ca0f3f
commit c3d2a07772

View File

@ -12,17 +12,24 @@ this.EXPORTED_SYMBOLS = ["startup"];
const Ci = Components.interfaces;
const Cu = Components.utils;
/* We load here modules that are needed to perform the application startup.
* We lazily load modules that aren't needed on every startup.
* We load modules that aren't used here but that need to perform some
* initialization steps later in the startup function. */
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppsUtils.jsm");
Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
Cu.import('resource://gre/modules/Payment.jsm');
Cu.import('resource://gre/modules/AlarmService.jsm');
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://webapprt/modules/WebappRT.jsm");
Cu.import("resource://webapprt/modules/WebRTCHandler.jsm");
// Lazily load these modules because we don't need them at every
// startup, but only during first run or runtime update.
XPCOMUtils.defineLazyModuleGetter(this, "PermissionsInstaller",
"resource://gre/modules/PermissionsInstaller.jsm");
const PROFILE_DIR = OS.Constants.Path.profileDir;
@ -135,6 +142,12 @@ this.startup = function(window) {
// Wait for XUL window loading
yield deferredWindowLoad.promise;
// Load these modules here because they aren't needed right at startup,
// but they need to be loaded to perform some initialization steps.
Cu.import("resource://gre/modules/Payment.jsm");
Cu.import("resource://gre/modules/AlarmService.jsm");
Cu.import("resource://webapprt/modules/WebRTCHandler.jsm");
// Get the <browser> element in the webapp.xul window.
let appBrowser = window.document.getElementById("content");