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

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

Issue 2623143002: DevTools: insert console message decorations in order
Patch Set: address design comments 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..19c20d1bd6c59fa26f2de5c10a93d44cede73832 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,28 @@ 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);
+ }
+ this._contextLabelElement.textContent = '';
allada 2017/01/19 02:38:08 Lets move these to the end of the function and sto
luoe 2017/01/19 23:22:59 Done.
+ this._contextLabelElement.title = '';
+
+ // Logs from scripts, extensions, and service workers have a labeled execution context. Iframes have a more useful
+ // frame title. Unlabeled cases include worker messages with source != 'worker' or no workerId and uncaught errors.
+ var messageContext = target.runtimeModel.executionContext(this._message.executionContextId);
+ var currentContext = UI.context.flavor(SDK.ExecutionContext);
+ if (messageContext && messageContext !== currentContext) {
+ var labelText = Console.ConsoleContextSelector.titleFor(messageContext, false /* showStatus */);
+ this._contextLabelElement.textContent = labelText + ' ';
+ this._contextLabelElement.title = labelText;
+ }
+ }
+
/**
* @return {number}
*/
@@ -895,6 +921,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