From 93e1c902b5d43022b7a56228881a462c07d73a9d Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Tue, 16 Jun 2015 19:35:52 -0400 Subject: [PATCH] Bug 1173379 - Delay loading console and AndroidLog.jsm on startup; r=mfinkle --- mobile/android/chrome/content/browser.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 87e1b6b395b..b524ab9db9e 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -311,6 +311,15 @@ XPCOMUtils.defineLazyModuleGetter( } ); +XPCOMUtils.defineLazyModuleGetter(this, "Log", + "resource://gre/modules/AndroidLog.jsm", "AndroidLog"); + +// Define the "dump" function as a binding of the Log.d function so it specifies +// the "debug" priority and a log tag. +function dump(msg) { + Log.d("Browser", msg); +} + const kStateActive = 0x00000001; // :active pseudoclass for elements const kXLinkNamespace = "http://www.w3.org/1999/xlink"; @@ -320,12 +329,6 @@ const kDefaultCSSViewportHeight = 480; const kViewportRemeasureThrottle = 500; -let Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog; - -// Define the "dump" function as a binding of the Log.d function so it specifies -// the "debug" priority and a log tag. -let dump = Log.d.bind(null, "Browser"); - function doChangeMaxLineBoxWidth(aWidth) { gReflowPending = null; let webNav = BrowserApp.selectedTab.window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation); @@ -6082,10 +6085,10 @@ let HealthReportStatusListener = { try { AddonManager.addAddonListener(this); } catch (ex) { - console.log("Failed to initialize add-on status listener. FHR cannot report add-on state. " + ex); + dump("Failed to initialize add-on status listener. FHR cannot report add-on state. " + ex); } - console.log("Adding HealthReport:RequestSnapshot observer."); + dump("Adding HealthReport:RequestSnapshot observer."); Services.obs.addObserver(this, "HealthReport:RequestSnapshot", false); Services.prefs.addObserver(this.PREF_ACCEPT_LANG, this, false); Services.prefs.addObserver(this.PREF_BLOCKLIST_ENABLED, this, false);