mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1283465 - New console frontend: Display cached messages. r=linclark
MozReview-Commit-ID: ArhGOuUY8ea
This commit is contained in:
parent
32f9a9263f
commit
ef47656f06
@ -21,6 +21,22 @@ const WebConsoleUtils = require("devtools/shared/webconsole/utils").Utils;
|
||||
const STRINGS_URI = "chrome://devtools/locale/webconsole.properties";
|
||||
const l10n = new WebConsoleUtils.L10n(STRINGS_URI);
|
||||
|
||||
function convertCachedPacket(packet) {
|
||||
// The devtools server provides cached message packets in a different shape
|
||||
// from those of consoleApiCalls, so we prepare them for preparation here.
|
||||
let convertPacket = {};
|
||||
if (packet._type === "ConsoleAPI") {
|
||||
convertPacket.message = packet;
|
||||
convertPacket.type = "consoleAPICall";
|
||||
} else if (packet._type === "PageError") {
|
||||
convertPacket.pageError = packet;
|
||||
convertPacket.type = "pageError";
|
||||
} else {
|
||||
throw new Error("Unexpected packet type");
|
||||
}
|
||||
return convertPacket;
|
||||
}
|
||||
|
||||
function prepareMessage(packet) {
|
||||
// @TODO turn this into an Immutable Record.
|
||||
let allowRepeating;
|
||||
@ -31,6 +47,10 @@ function prepareMessage(packet) {
|
||||
let repeatId;
|
||||
let severity;
|
||||
|
||||
if (packet._type) {
|
||||
packet = convertCachedPacket(packet);
|
||||
}
|
||||
|
||||
switch (packet.type) {
|
||||
case "consoleAPICall":
|
||||
data = Object.assign({}, packet.message);
|
||||
|
@ -3228,10 +3228,15 @@ WebConsoleConnectionProxy.prototype = {
|
||||
response.messages.concat(...this.webConsoleClient.getNetworkEvents());
|
||||
messages.sort((a, b) => a.timeStamp - b.timeStamp);
|
||||
|
||||
this.webConsoleFrame.displayCachedMessages(messages);
|
||||
|
||||
if (!this._hasNativeConsoleAPI) {
|
||||
this.webConsoleFrame.logWarningAboutReplacedAPI();
|
||||
if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
|
||||
for (let packet of messages) {
|
||||
this.webConsoleFrame.newConsoleOutput.dispatchMessageAdd(packet);
|
||||
}
|
||||
} else {
|
||||
this.webConsoleFrame.displayCachedMessages(messages);
|
||||
if (!this._hasNativeConsoleAPI) {
|
||||
this.webConsoleFrame.logWarningAboutReplacedAPI();
|
||||
}
|
||||
}
|
||||
|
||||
this.connected = true;
|
||||
|
Loading…
Reference in New Issue
Block a user