Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Unified Diff: Source/devtools/front_end/sdk/ConsoleModel.js

Issue 1090583005: Revert of DevTools: [console] Logged promise rejections do not change state once handled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Encompass Oilpan fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/ui/smallIcon.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/ConsoleModel.js
diff --git a/Source/devtools/front_end/sdk/ConsoleModel.js b/Source/devtools/front_end/sdk/ConsoleModel.js
index 66dec2279101e10e41486cbbebaedaf41671f608..f658ef6a7a89bb76a3c65478049fba2ed88a3156 100644
--- a/Source/devtools/front_end/sdk/ConsoleModel.js
+++ b/Source/devtools/front_end/sdk/ConsoleModel.js
@@ -39,11 +39,8 @@ WebInspector.ConsoleModel = function(target)
/** @type {!Array.<!WebInspector.ConsoleMessage>} */
this._messages = [];
- /** @type {!Map<number, !WebInspector.ConsoleMessage>} */
- this._messageById = new Map();
- this._warnings = 0;
- this._errors = 0;
- this._revokedErrors = 0;
+ this.warnings = 0;
+ this.errors = 0;
this._consoleAgent = target.consoleAgent();
target.registerConsoleDispatcher(new WebInspector.ConsoleDispatcher(this));
this._enableAgent();
@@ -52,7 +49,6 @@ WebInspector.ConsoleModel = function(target)
WebInspector.ConsoleModel.Events = {
ConsoleCleared: "ConsoleCleared",
MessageAdded: "MessageAdded",
- MessageUpdated: "MessageUpdated",
CommandEvaluated: "CommandEvaluated",
}
@@ -76,21 +72,10 @@ WebInspector.ConsoleModel.prototype = {
*/
addMessage: function(msg)
{
- if (msg.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError && msg._relatedMessageId) {
- var relatedMessage = this._messageById.get(msg._relatedMessageId);
- if (!relatedMessage)
- return;
- this._errors--;
- this._revokedErrors++;
- relatedMessage.level = WebInspector.ConsoleMessage.MessageLevel.RevokedError;
- this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageUpdated, relatedMessage);
- return;
- }
-
+ msg.index = this._messages.length;
this._messages.push(msg);
- if (msg._messageId)
- this._messageById.set(msg._messageId, msg);
this._incrementErrorWarningCount(msg);
+
this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded, msg);
},
@@ -101,13 +86,10 @@ WebInspector.ConsoleModel.prototype = {
{
switch (msg.level) {
case WebInspector.ConsoleMessage.MessageLevel.Warning:
- this._warnings++;
+ this.warnings++;
break;
case WebInspector.ConsoleMessage.MessageLevel.Error:
- this._errors++;
- break;
- case WebInspector.ConsoleMessage.MessageLevel.RevokedError:
- this._revokedErrors++;
+ this.errors++;
break;
}
},
@@ -129,37 +111,11 @@ WebInspector.ConsoleModel.prototype = {
_messagesCleared: function()
{
this._messages = [];
- this._messageById.clear();
- this._errors = 0;
- this._revokedErrors = 0;
- this._warnings = 0;
+ this.errors = 0;
+ this.warnings = 0;
this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);
},
- /**
- * @return {number}
- */
- errors: function()
- {
- return this._errors;
- },
-
- /**
- * @return {number}
- */
- revokedErrors: function()
- {
- return this._revokedErrors;
- },
-
- /**
- * @return {number}
- */
- warnings: function()
- {
- return this._warnings;
- },
-
__proto__: WebInspector.SDKModel.prototype
}
@@ -218,10 +174,8 @@ WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext,
* @param {!RuntimeAgent.ExecutionContextId=} executionContextId
* @param {!ConsoleAgent.AsyncStackTrace=} asyncStackTrace
* @param {?string=} scriptId
- * @param {number=} messageId
- * @param {number=} relatedMessageId
*/
-WebInspector.ConsoleMessage = function(target, source, level, messageText, type, url, line, column, requestId, parameters, stackTrace, timestamp, executionContextId, asyncStackTrace, scriptId, messageId, relatedMessageId)
+WebInspector.ConsoleMessage = function(target, source, level, messageText, type, url, line, column, requestId, parameters, stackTrace, timestamp, executionContextId, asyncStackTrace, scriptId)
{
this._target = target;
this.source = source;
@@ -241,8 +195,6 @@ WebInspector.ConsoleMessage = function(target, source, level, messageText, type,
this.executionContextId = executionContextId || 0;
this.asyncStackTrace = asyncStackTrace;
this.scriptId = scriptId || null;
- this._messageId = messageId || 0;
- this._relatedMessageId = relatedMessageId || 0;
this.request = requestId ? target.networkLog.requestForId(requestId) : null;
@@ -321,6 +273,29 @@ WebInspector.ConsoleMessage.prototype = {
},
/**
+ * @return {!WebInspector.ConsoleMessage}
+ */
+ clone: function()
+ {
+ return new WebInspector.ConsoleMessage(
+ this.target(),
+ this.source,
+ this.level,
+ this.messageText,
+ this.type,
+ this.url,
+ this.line,
+ this.column,
+ this.request ? this.request.requestId : undefined,
+ this.parameters,
+ this.stackTrace,
+ this.timestamp,
+ this.executionContextId,
+ this.asyncStackTrace,
+ this.scriptId);
+ },
+
+ /**
* @param {?WebInspector.ConsoleMessage} msg
* @return {boolean}
*/
@@ -329,11 +304,6 @@ WebInspector.ConsoleMessage.prototype = {
if (!msg)
return false;
- if (this._messageId || msg._messageId)
- return false;
- if (this._relatedMessageId || msg._relatedMessageId)
- return false;
-
if (!this._isEqualStackTraces(this.stackTrace, msg.stackTrace))
return false;
@@ -441,8 +411,7 @@ WebInspector.ConsoleMessage.MessageLevel = {
Info: "info",
Warning: "warning",
Error: "error",
- Debug: "debug",
- RevokedError: "revokedError"
+ Debug: "debug"
};
/**
@@ -487,9 +456,7 @@ WebInspector.ConsoleDispatcher.prototype = {
payload.timestamp * 1000, // Convert to ms.
payload.executionContextId,
payload.asyncStackTrace,
- payload.scriptId,
- payload.messageId,
- payload.relatedMessageId);
+ payload.scriptId);
this._console.addMessage(consoleMessage);
},
@@ -520,7 +487,6 @@ WebInspector.MultitargetConsoleModel = function()
{
WebInspector.targetManager.observeTargets(this);
WebInspector.targetManager.addModelListener(WebInspector.ConsoleModel, WebInspector.ConsoleModel.Events.MessageAdded, this._consoleMessageAdded, this);
- WebInspector.targetManager.addModelListener(WebInspector.ConsoleModel, WebInspector.ConsoleModel.Events.MessageUpdated, this._consoleMessageUpdated, this);
WebInspector.targetManager.addModelListener(WebInspector.ConsoleModel, WebInspector.ConsoleModel.Events.CommandEvaluated, this._commandEvaluated, this);
}
@@ -577,14 +543,6 @@ WebInspector.MultitargetConsoleModel.prototype = {
/**
* @param {!WebInspector.Event} event
*/
- _consoleMessageUpdated: function(event)
- {
- this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageUpdated, event.data);
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
_commandEvaluated: function(event)
{
this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, event.data);
« no previous file with comments | « Source/devtools/front_end/main/Main.js ('k') | Source/devtools/front_end/ui/smallIcon.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698