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

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 2623143002: DevTools: insert console message decorations in order
Patch Set: ac Created 3 years, 11 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
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
index 368bce0f601c397bd11c32bc910e31eaa0b388a2..41fd04e912a54c8f2f79578841e793fed41f38d5 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -50,6 +50,8 @@ Console.ConsoleViewMessage = class {
this._searchRegex = null;
/** @type {?UI.Icon} */
this._messageLevelIcon = null;
+ /** @type {!Element|undefined} */
+ this._contextLabelElement;
}
/**
@@ -823,8 +825,10 @@ Console.ConsoleViewMessage = class {
return;
if (show && !this.timestampElement) {
+ var timeStampText = (new Date(this._message.timestamp)).toConsoleTime() + ' ';
this.timestampElement = createElementWithClass('span', 'console-timestamp');
- this.timestampElement.textContent = (new Date(this._message.timestamp)).toConsoleTime() + ' ';
+ this.timestampElement.title = timeStampText;
+ this.timestampElement.createChild('span', 'console-timestamp-visible').textContent = timeStampText;
this._contentElement.insertBefore(this.timestampElement, this._contentElement.firstChild);
return;
}
@@ -835,6 +839,24 @@ Console.ConsoleViewMessage = class {
}
}
+ updateContextLabel() {
+ var target = this._target();
+ if (!this._contentElement || !target)
+ return;
+ if (!this._contextLabelElement) {
+ this._contextLabelElement = createElementWithClass('span', 'console-context-label');
+ this._contentElement.insertBefore(this._contextLabelElement, this._contentElement.firstChild);
+ }
+
+ // Messages without titles include worker messages with source != 'worker', no workerId, or uncaught errors.
+ var labelText = '';
+ var messageContext = target.runtimeModel.executionContext(this._message.executionContextId);
+ if (messageContext && messageContext !== UI.context.flavor(SDK.ExecutionContext))
+ labelText = Console.ConsoleContextSelector.titleForContext(messageContext, false /* formatForSelector */);
+ this._contextLabelElement.textContent = labelText ? labelText + ' ' : labelText;
+ this._contextLabelElement.title = labelText;
+ }
+
/**
* @return {number}
*/
@@ -895,6 +917,7 @@ Console.ConsoleViewMessage = class {
formattedMessage = this._buildMessage(consoleMessage);
contentElement.appendChild(formattedMessage);
+ this.updateContextLabel();
this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get());
return this._contentElement;
}

Powered by Google App Engine
This is Rietveld 408576698