Bug 1631780 - load AddonManager module lazily. r=darktrojan
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Thu, 21 May 2020 13:55:49 +0300
changeset 29630 82280bdfe344e5616c30aea33935cf4f2bcc32e3
parent 29629 c0c2cc7c1b7dcb7549c07a8dbe67e5ab0de2e259
child 29631 ba49bdd5e52c79c9e7d6f94c66ee8d442d25431d
push id17464
push usermkmelin@iki.fi
push dateThu, 21 May 2020 10:58:08 +0000
treeherdercomm-central@ba49bdd5e52c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1631780
Bug 1631780 - load AddonManager module lazily. r=darktrojan For xpcshell-tests we can get the app-startup even without needing a Thunderbird window. Like a <browser> content process. That don't want to load AddonsManager etc. Avoid this red herring.
mail/components/MailGlue.jsm
--- a/mail/components/MailGlue.jsm
+++ b/mail/components/MailGlue.jsm
@@ -6,31 +6,25 @@
 "use strict";
 
 var EXPORTED_SYMBOLS = ["MailGlue"];
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-var { AddonManager } = ChromeUtils.import(
-  "resource://gre/modules/AddonManager.jsm"
-);
 var { LightweightThemeConsumer } = ChromeUtils.import(
   "resource://gre/modules/LightweightThemeConsumer.jsm"
 );
 var { TBDistCustomizer } = ChromeUtils.import(
   "resource:///modules/TBDistCustomizer.jsm"
 );
 var { MailMigrator } = ChromeUtils.import(
   "resource:///modules/MailMigrator.jsm"
 );
-var { ExtensionSupport } = ChromeUtils.import(
-  "resource:///modules/ExtensionSupport.jsm"
-);
 var { AppConstants } = ChromeUtils.import(
   "resource://gre/modules/AppConstants.jsm"
 );
 var { RemoteSecuritySettings } = ChromeUtils.import(
   "resource://gre/modules/psm/RemoteSecuritySettings.jsm"
 );
 
 // lazy module getter
@@ -52,16 +46,21 @@ let ACTORS = {
     parent: {
       moduleURI: "resource:///actors/PromptParent.jsm",
     },
     includeChrome: true,
     allFrames: true,
   },
 };
 
+XPCOMUtils.defineLazyModuleGetters(this, {
+  AddonManager: "resource://gre/modules/AddonManager.jsm",
+  ExtensionSupport: "resource:///modules/ExtensionSupport.jsm",
+});
+
 /**
  * Glue code that should be executed before any windows are opened. Any
  * window-independent helper methods (a la nsBrowserGlue.js) should go in
  * MailUtils.jsm instead.
  */
 
 function MailGlue() {
   XPCOMUtils.defineLazyGetter(this, "_sanitizer", function() {