Bug 1497259 - 1. Fix log module names; r=droeh, a=ritu
authorJim Chen <nchen@mozilla.com>
Wed, 10 Oct 2018 17:36:03 +0000
changeset 492891 c78886e8b28ee7ca945373cfc015ee011ce323f8
parent 492890 a3d9a2b6a7bed56636a16d7e6106e42db032cbcc
child 492892 6cd7919cc0b8b4e05c495bed36ba70c60fb14bdf
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh, ritu
bugs1497259
milestone63.0
Bug 1497259 - 1. Fix log module names; r=droeh, a=ritu Fix the GV log module names so they are all under the GeckoView group. Differential Revision: https://phabricator.services.mozilla.com/D8050
mobile/android/chrome/geckoview/ErrorPageEventHandler.js
mobile/android/chrome/geckoview/geckoview.js
mobile/android/components/geckoview/GeckoViewExternalAppService.js
mobile/android/components/geckoview/GeckoViewStartup.js
mobile/android/modules/geckoview/GeckoViewConsole.jsm
mobile/android/modules/geckoview/GeckoViewContentModule.jsm
mobile/android/modules/geckoview/GeckoViewModule.jsm
mobile/android/modules/geckoview/GeckoViewRemoteDebugger.jsm
mobile/android/modules/geckoview/GeckoViewUtils.jsm
--- a/mobile/android/chrome/geckoview/ErrorPageEventHandler.js
+++ b/mobile/android/chrome/geckoview/ErrorPageEventHandler.js
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
 /* global debug:false, warn:false */
-GeckoViewUtils.initLogging("GeckoView.ErrorPageEventHandler", this);
+GeckoViewUtils.initLogging("ErrorPageEventHandler", this);
 
 ChromeUtils.defineModuleGetter(this, "SSLExceptions",
                                "resource://gre/modules/SSLExceptions.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   Services: "resource://gre/modules/Services.jsm",
 });
 
--- a/mobile/android/chrome/geckoview/geckoview.js
+++ b/mobile/android/chrome/geckoview/geckoview.js
@@ -224,17 +224,17 @@ class ModuleInfo {
   _loadPhase(aPhase) {
     if (!aPhase) {
       return;
     }
 
     if (aPhase.resource && !this._impl) {
       const scope = {};
       const global = ChromeUtils.import(aPhase.resource, scope);
-      const tag = this._name.replace("GeckoView", "GeckoView.");
+      const tag = this._name.replace("GeckoView", "");
       GeckoViewUtils.initLogging(tag, global);
       this._impl = new scope[this._name](this);
     }
 
     if (aPhase.frameScript && !this._contentModuleLoaded) {
       if (this._impl) {
         this._impl.onLoadContentModule();
       }
@@ -303,17 +303,17 @@ function createBrowser() {
   const browser = window.browser = document.createElement("browser");
   browser.setAttribute("type", "content");
   browser.setAttribute("primary", "true");
   browser.setAttribute("flex", "1");
   return browser;
 }
 
 function startup() {
-  GeckoViewUtils.initLogging("GeckoView.XUL", window);
+  GeckoViewUtils.initLogging("XUL", window);
 
   const browser = createBrowser();
   ModuleManager.init(browser, [{
     name: "GeckoViewAccessibility",
     onInit: {
       resource: "resource://gre/modules/GeckoViewAccessibility.jsm",
     },
   }, {
--- a/mobile/android/components/geckoview/GeckoViewExternalAppService.js
+++ b/mobile/android/components/geckoview/GeckoViewExternalAppService.js
@@ -3,17 +3,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
 /* global debug:false, warn:false */
-GeckoViewUtils.initLogging("GeckoView.ExternalAppService", this);
+GeckoViewUtils.initLogging("ExternalAppService", this);
 
 ChromeUtils.defineModuleGetter(this, "EventDispatcher",
   "resource://gre/modules/Messaging.jsm");
 
 function ExternalAppService() {
   this.wrappedJSObject = this;
 }
 
--- a/mobile/android/components/geckoview/GeckoViewStartup.js
+++ b/mobile/android/components/geckoview/GeckoViewStartup.js
@@ -1,25 +1,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   ActorManagerParent: "resource://gre/modules/ActorManagerParent.jsm",
   EventDispatcher: "resource://gre/modules/Messaging.jsm",
   FileSource: "resource://gre/modules/L10nRegistry.jsm",
   GeckoViewTelemetryController: "resource://gre/modules/GeckoViewTelemetryController.jsm",
-  GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
   L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
   Services: "resource://gre/modules/Services.jsm",
 });
 
-const {debug, warn} = GeckoViewUtils.initLogging("GeckoViewStartup", this);
+/* global debug:false, warn:false */
+GeckoViewUtils.initLogging("Startup", this);
 
 function GeckoViewStartup() {
 }
 
 GeckoViewStartup.prototype = {
   classID: Components.ID("{8e993c34-fdd6-432c-967e-f995d888777f}"),
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
--- a/mobile/android/modules/geckoview/GeckoViewConsole.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewConsole.jsm
@@ -7,17 +7,17 @@ var EXPORTED_SYMBOLS = ["GeckoViewConsol
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   Services: "resource://gre/modules/Services.jsm"
 });
 
-GeckoViewUtils.initLogging("GeckoViewConsole", this);
+GeckoViewUtils.initLogging("Console", this);
 
 const LOG_EVENT_TOPIC = "console-api-log-event";
 
 var GeckoViewConsole = {
   _isEnabled: false,
 
   get enabled() {
     return this._isEnabled;
--- a/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
@@ -3,22 +3,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["GeckoViewContentModule"];
 
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
-GeckoViewUtils.initLogging("GeckoView.Module.[C]", this);
+GeckoViewUtils.initLogging("Module[C]", this);
 
 class GeckoViewContentModule {
   static initLogging(aModuleName) {
     this._moduleName = aModuleName;
-    const tag = aModuleName.replace("GeckoView", "GeckoView.") + ".[C]";
+    const tag = aModuleName.replace("GeckoView", "") + "[C]";
     return GeckoViewUtils.initLogging(tag, {});
   }
 
   static create(aGlobal, aModuleName) {
     return new this(aModuleName || this._moduleName, aGlobal);
   }
 
   constructor(aModuleName, aGlobal) {
--- a/mobile/android/modules/geckoview/GeckoViewModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewModule.jsm
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["GeckoViewModule"];
 
 ChromeUtils.import("resource://gre/modules/GeckoViewUtils.jsm");
 
-GeckoViewUtils.initLogging("GeckoView.Module", this);
+GeckoViewUtils.initLogging("Module", this);
 
 class GeckoViewModule {
   constructor(aModuleInfo) {
     this._info = aModuleInfo;
 
     this._isContentLoaded = false;
     this._eventProxy = new EventProxy(this, this.eventDispatcher);
 
--- a/mobile/android/modules/geckoview/GeckoViewRemoteDebugger.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewRemoteDebugger.jsm
@@ -18,17 +18,17 @@ XPCOMUtils.defineLazyGetter(this, "requi
   return require;
 });
 
 XPCOMUtils.defineLazyGetter(this, "DebuggerServer", () => {
   const { DebuggerServer } = require("devtools/server/main");
   return DebuggerServer;
 });
 
-GeckoViewUtils.initLogging("GeckoView.RemoteDebugger", this);
+GeckoViewUtils.initLogging("RemoteDebugger", this);
 
 var GeckoViewRemoteDebugger = {
   observe(aSubject, aTopic, aData) {
     if (aTopic !== "nsPref:changed") {
       return;
     }
 
     if (Services.prefs.getBoolPref(aData, false)) {
--- a/mobile/android/modules/geckoview/GeckoViewUtils.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewUtils.jsm
@@ -370,25 +370,27 @@ var GeckoViewUtils = {
    *   let bar = 42;
    *   do_something(bar); // No log.
    *   do_something(debug.foo = bar); // Output "foo = 42" to the log.
    *
    * @param aTag Name of the Log.jsm logger to forward logs to.
    * @param aScope Scope to add the logging functions to.
    */
   initLogging: function(aTag, aScope) {
+    const tag = "GeckoView." + aTag.replace(/^GeckoView\.?/, "");
+
     // Only provide two levels for simplicity.
     // For "info", use "debug" instead.
     // For "error", throw an actual JS error instead.
     for (const level of ["DEBUG", "WARN"]) {
       const log = (strings, ...exprs) =>
           this._log(log.logger, level, strings, exprs);
 
       XPCOMUtils.defineLazyGetter(log, "logger", _ => {
-        const logger = Log.repository.getLogger(aTag);
+        const logger = Log.repository.getLogger(tag);
         logger.parent = this.rootLogger;
         return logger;
       });
 
       aScope[level.toLowerCase()] = new Proxy(log, {
         set: (obj, prop, value) => obj([prop + " = ", ""], value) || true,
       });
     }