Bug 1173379 - Delay loading console and AndroidLog.jsm on startup; r=mfinkle
authorJim Chen <nchen@mozilla.com>
Tue, 16 Jun 2015 19:35:52 -0400
changeset 249209 cf6ee89903ae262c630cd771aa560c8a3dd98c3b
parent 249208 9905e191083afd1996186fbffff3e8cb4a9249d6
child 249210 5adf4fc6a628c0ad01baa86a67bb65ff1382b283
push id61174
push usernchen@mozilla.com
push dateTue, 16 Jun 2015 23:36:11 +0000
treeherdermozilla-inbound@5adf4fc6a628 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
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 - Delay loading console and AndroidLog.jsm on startup; r=mfinkle
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -306,31 +306,34 @@ XPCOMUtils.defineLazyModuleGetter(
       // With this, we trigger the import of Webapps.jsm and forward the message
       // to the real registry.
       return DOMApplicationRegistry.receiveMessage.apply(
           DOMApplicationRegistry, arguments);
     }
   }
 );
 
+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";
 
 const kDefaultCSSViewportWidth = 980;
 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);
   let docShell = webNav.QueryInterface(Ci.nsIDocShell);
   let docViewer = docShell.contentViewer;
 
   let range = null;
   if (BrowserApp.selectedTab._mReflozPoint) {
@@ -6077,20 +6080,20 @@ let HealthReportStatusListener = {
   PREF_TELEMETRY_ENABLED: AppConstants.MOZ_TELEMETRY_REPORTING ?
     "toolkit.telemetry.enabled" :
     null,
 
   init: function () {
     try {
       AddonManager.addAddonListener(this);
     } catch (ex) {
-      console.log("Failed to initialize add-on status listener. FHR cannot report add-on state. " + ex);
-    }
-
-    console.log("Adding HealthReport:RequestSnapshot observer.");
+      dump("Failed to initialize add-on status listener. FHR cannot report add-on state. " + ex);
+    }
+
+    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);
     if (this.PREF_TELEMETRY_ENABLED) {
       Services.prefs.addObserver(this.PREF_TELEMETRY_ENABLED, this, false);
     }
   },