Bug 1173379 - Lazy-init console in browser-content.js; r=Mossop
authorJim Chen <nchen@mozilla.com>
Tue, 16 Jun 2015 19:35:52 -0400
changeset 280041 5adf4fc6a628c0ad01baa86a67bb65ff1382b283
parent 280040 cf6ee89903ae262c630cd771aa560c8a3dd98c3b
child 280042 f5ef44a112b5a66f986271b4424a025c6c5f4bde
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1173379
milestone41.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 1173379 - Lazy-init console in browser-content.js; r=Mossop
toolkit/content/browser-content.js
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -349,19 +349,21 @@ let PopupBlocking = {
 
   updateBlockedPopups: function(freshPopup) {
     sendAsyncMessage("PopupBlocking:UpdateBlockedPopups",
                      {blockedPopups: this.popupData, freshPopup: freshPopup});
   },
 };
 PopupBlocking.init();
 
-// Set up console.* for frame scripts.
-let Console = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {});
-this.console = new Console.ConsoleAPI();
+XPCOMUtils.defineLazyGetter(this, "console", () => {
+  // Set up console.* for frame scripts.
+  let Console = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {});
+  return new Console.ConsoleAPI();
+});
 
 let Printing = {
   // Bug 1088061: nsPrintEngine's DoCommonPrint currently expects the
   // progress listener passed to it to QI to an nsIPrintingPromptService
   // in order to know that a printing progress dialog has been shown. That's
   // really all the interface is used for, hence the fact that I don't actually
   // implement the interface here. Bug 1088061 has been filed to remove
   // this hackery.