Bug 859756 - [browserconsole] Show nsIConsoleMessages in the Browser Console; r=robcee
This commit is contained in:
@@ -961,6 +961,9 @@ WebConsoleFrame.prototype = {
|
||||
[category, aMessage]);
|
||||
break;
|
||||
}
|
||||
case "LogMessage":
|
||||
this.handleLogMessage(aMessage);
|
||||
break;
|
||||
case "ConsoleAPI":
|
||||
this.outputMessage(CATEGORY_WEBDEV, this.logConsoleAPIMessage,
|
||||
[aMessage]);
|
||||
@@ -1198,6 +1201,21 @@ WebConsoleFrame.prototype = {
|
||||
this.outputMessage(category, this.reportPageError, [category, aPageError]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle log messages received from the server. This method outputs the given
|
||||
* message.
|
||||
*
|
||||
* @param object aPacket
|
||||
* The message packet received from the server.
|
||||
*/
|
||||
handleLogMessage: function WCF_handleLogMessage(aPacket)
|
||||
{
|
||||
this.outputMessage(CATEGORY_JS, () => {
|
||||
return this.createMessageNode(CATEGORY_JS, SEVERITY_LOG, aPacket.message,
|
||||
null, null, null, null, aPacket.timeStamp);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Log network event.
|
||||
*
|
||||
@@ -4530,6 +4548,7 @@ function WebConsoleConnectionProxy(aWebConsole, aTarget)
|
||||
this.target = aTarget;
|
||||
|
||||
this._onPageError = this._onPageError.bind(this);
|
||||
this._onLogMessage = this._onLogMessage.bind(this);
|
||||
this._onConsoleAPICall = this._onConsoleAPICall.bind(this);
|
||||
this._onNetworkEvent = this._onNetworkEvent.bind(this);
|
||||
this._onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
|
||||
@@ -4634,6 +4653,7 @@ WebConsoleConnectionProxy.prototype = {
|
||||
|
||||
let client = this.client = this.target.client;
|
||||
|
||||
client.addListener("logMessage", this._onLogMessage);
|
||||
client.addListener("pageError", this._onPageError);
|
||||
client.addListener("consoleAPICall", this._onConsoleAPICall);
|
||||
client.addListener("networkEvent", this._onNetworkEvent);
|
||||
@@ -4755,6 +4775,23 @@ WebConsoleConnectionProxy.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The "logMessage" message type handler. We redirect any message to the UI
|
||||
* for displaying.
|
||||
*
|
||||
* @private
|
||||
* @param string aType
|
||||
* Message type.
|
||||
* @param object aPacket
|
||||
* The message received from the server.
|
||||
*/
|
||||
_onLogMessage: function WCCP__onLogMessage(aType, aPacket)
|
||||
{
|
||||
if (this.owner && aPacket.from == this._consoleActor) {
|
||||
this.owner.handleLogMessage(aPacket);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The "consoleAPICall" message type handler. We redirect any message to
|
||||
* the UI for displaying.
|
||||
@@ -4899,6 +4936,7 @@ WebConsoleConnectionProxy.prototype = {
|
||||
return this._disconnecter.promise;
|
||||
}
|
||||
|
||||
this.client.removeListener("logMessage", this._onLogMessage);
|
||||
this.client.removeListener("pageError", this._onPageError);
|
||||
this.client.removeListener("consoleAPICall", this._onConsoleAPICall);
|
||||
this.client.removeListener("networkEvent", this._onNetworkEvent);
|
||||
|
||||
Reference in New Issue
Block a user