Bug 1497259 - 1. Fix log module names; r=droeh
authorJim Chen <nchen@mozilla.com>
Wed, 10 Oct 2018 17:36:03 +0000
changeset 499039 50b9d2e6ac5f0d14822601bcf403b8f80ce5e3d4
parent 499038 7672ed76df74f1a3dbedd6da63c1ccdb1c5ef36e
child 499040 20cd9ac747da9b457d594fb385f13ace7bffbff2
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh
bugs1497259
milestone64.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 1497259 - 1. Fix log module names; r=droeh 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,
       });
     }