Enable Wifi debug log draft
authorEdgar Chen <echen@mozilla.com>
Mon, 09 Feb 2015 12:02:45 +0800
changeset 325622 10f682faba2092134658c3663182dee85ecefd87
parent 325621 a59bed206d74f3c16ca5c3f3f15fbc15ee673d1e
child 325623 f6dadf7f85e06969b8174e2c8dc1ab59df9aefd1
child 325631 1c97ff9a65062dfe8380f7b4b2db8fdf0f579c60
push id10012
push userechen@mozilla.com
push dateTue, 26 Jan 2016 02:39:11 +0000
milestone46.0a1
Enable Wifi debug log
dom/wifi/DOMWifiManager.js
dom/wifi/DOMWifiP2pManager.js
dom/wifi/StateMachine.jsm
dom/wifi/WifiCommand.jsm
dom/wifi/WifiNetUtil.jsm
dom/wifi/WifiP2pWorkerObserver.jsm
dom/wifi/WifiWorker.js
--- a/dom/wifi/DOMWifiManager.js
+++ b/dom/wifi/DOMWifiManager.js
@@ -180,16 +180,18 @@ DOMWifiManager.prototype = {
   _convertWifiCapabilities: function(aCapabilities) {
     let capabilities = aCapabilities ?
                          new MozWifiCapabilities(aCapabilities) : null;
     return capabilities;
   },
 
   _sendMessageForRequest: function(name, data, request) {
     let id = this.getRequestId(request);
+    debug("_sendMessageForRequest: name:" + name + ", data:" + JSON.stringify(data) +
+          ", rid:" + id + ", mid:" + this._id);
     this._mm.sendAsyncMessage(name, { data: data, rid: id, mid: this._id });
   },
 
   receiveMessage: function(aMessage) {
     let msg = aMessage.json;
     if (msg.mid && msg.mid != this._id)
       return;
 
--- a/dom/wifi/DOMWifiP2pManager.js
+++ b/dom/wifi/DOMWifiP2pManager.js
@@ -7,17 +7,17 @@
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
 
-const DEBUG = false;
+const DEBUG = true;
 
 // interface MozWifiP2pGroupOwner implementation.
 
 function MozWifiP2pGroupOwner(aGo) {
   this.groupName = aGo.groupName;
   this.macAddress = aGo.macAddress;
   this.ipAddress = aGo.ipAddress;
   this.passphrase = aGo.passphrase;
--- a/dom/wifi/StateMachine.jsm
+++ b/dom/wifi/StateMachine.jsm
@@ -7,17 +7,17 @@
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 this.EXPORTED_SYMBOLS = ["StateMachine"];
 
-const DEBUG = false;
+const DEBUG = true;
 
 this.StateMachine = function(aDebugTag) {
   function debug(aMsg) {
     dump('-------------- StateMachine:' + aDebugTag + ': ' + aMsg);
   }
 
   var sm = {};
 
--- a/dom/wifi/WifiCommand.jsm
+++ b/dom/wifi/WifiCommand.jsm
@@ -9,17 +9,17 @@
 this.EXPORTED_SYMBOLS = ["WifiCommand"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/systemlibs.js");
 
 const SUPP_PROP = "init.svc.wpa_supplicant";
 const WPA_SUPPLICANT = "wpa_supplicant";
-const DEBUG = false;
+const DEBUG = true;
 
 this.WifiCommand = function(aControlMessage, aInterface, aSdkVersion) {
   function debug(msg) {
     if (DEBUG) {
       dump('-------------- WifiCommand: ' + msg);
     }
   }
 
--- a/dom/wifi/WifiNetUtil.jsm
+++ b/dom/wifi/WifiNetUtil.jsm
@@ -14,17 +14,17 @@ Cu.import("resource://gre/modules/system
 XPCOMUtils.defineLazyServiceGetter(this, "gNetworkService",
                                    "@mozilla.org/network/service;1",
                                    "nsINetworkService");
 
 this.EXPORTED_SYMBOLS = ["WifiNetUtil"];
 
 const DHCP_PROP = "init.svc.dhcpcd";
 const DHCP      = "dhcpcd";
-const DEBUG     = false;
+const DEBUG     = true;
 
 this.WifiNetUtil = function(controlMessage) {
   function debug(msg) {
     if (DEBUG) {
       dump('-------------- NetUtil: ' + msg);
     }
   }
 
--- a/dom/wifi/WifiP2pWorkerObserver.jsm
+++ b/dom/wifi/WifiP2pWorkerObserver.jsm
@@ -8,17 +8,17 @@
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 const CONNECTION_STATUS_DISCONNECTED  = "disconnected";
 const CONNECTION_STATUS_CONNECTING    = "connecting";
 const CONNECTION_STATUS_CONNECTED     = "connected";
 const CONNECTION_STATUS_DISCONNECTING = "disconnecting";
 
-const DEBUG = false;
+const DEBUG = true;
 
 this.EXPORTED_SYMBOLS = ["WifiP2pWorkerObserver"];
 
 // WifiP2pWorkerObserver resides in WifiWorker to handle DOM message
 // by either 1) returning internally maintained information or
 //           2) delegating to aDomMsgResponder. It is also responsible
 // for observing events from WifiP2pManager and dispatch to DOM.
 //
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -2793,16 +2793,18 @@ WifiWorker.prototype = {
       // Note: We should never have a dead message manager here because we
       // observe our child message managers shutting down, below.
       manager.sendAsyncMessage("WifiManager:" + message, data);
     });
   },
 
   _sendMessage: function(message, success, data, msg) {
     try {
+      debug("sendAsyncMessage: message:" + message + (success ? ":OK" : ":NO") +
+            ", data:" + JSON.stringify(data) + ", msg:" + JSON.stringify(msg));
       msg.manager.sendAsyncMessage(message + (success ? ":OK" : ":NO"),
                                    { data: data, rid: msg.rid, mid: msg.mid });
     } catch (e) {
       debug("sendAsyncMessage error : " + e);
     }
     this._splicePendingRequest(msg);
   },