Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 this._repeatCount = 1; | 43 this._repeatCount = 1; |
| 44 this._closeGroupDecorationCount = 0; | 44 this._closeGroupDecorationCount = 0; |
| 45 this._nestingLevel = nestingLevel; | 45 this._nestingLevel = nestingLevel; |
| 46 | 46 |
| 47 /** @type {?DataGrid.DataGrid} */ | 47 /** @type {?DataGrid.DataGrid} */ |
| 48 this._dataGrid = null; | 48 this._dataGrid = null; |
| 49 this._previewFormatter = new Components.RemoteObjectPreviewFormatter(); | 49 this._previewFormatter = new Components.RemoteObjectPreviewFormatter(); |
| 50 this._searchRegex = null; | 50 this._searchRegex = null; |
| 51 /** @type {?UI.Icon} */ | 51 /** @type {?UI.Icon} */ |
| 52 this._messageLevelIcon = null; | 52 this._messageLevelIcon = null; |
| 53 /** @type {!Element|undefined} */ | |
| 54 this._contextLabelElement; | |
| 53 } | 55 } |
| 54 | 56 |
| 55 /** | 57 /** |
| 56 * @return {?SDK.Target} | 58 * @return {?SDK.Target} |
| 57 */ | 59 */ |
| 58 _target() { | 60 _target() { |
| 59 return this.consoleMessage().target(); | 61 return this.consoleMessage().target(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 /** | 64 /** |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 } | 818 } |
| 817 | 819 |
| 818 /** | 820 /** |
| 819 * @param {boolean} show | 821 * @param {boolean} show |
| 820 */ | 822 */ |
| 821 updateTimestamp(show) { | 823 updateTimestamp(show) { |
| 822 if (!this._contentElement) | 824 if (!this._contentElement) |
| 823 return; | 825 return; |
| 824 | 826 |
| 825 if (show && !this.timestampElement) { | 827 if (show && !this.timestampElement) { |
| 828 var timeStampText = (new Date(this._message.timestamp)).toConsoleTime() + ' '; | |
| 826 this.timestampElement = createElementWithClass('span', 'console-timestamp' ); | 829 this.timestampElement = createElementWithClass('span', 'console-timestamp' ); |
| 827 this.timestampElement.textContent = (new Date(this._message.timestamp)).to ConsoleTime() + ' '; | 830 this.timestampElement.title = timeStampText; |
| 831 this.timestampElement.createChild('span', 'console-timestamp-visible').tex tContent = timeStampText; | |
| 828 this._contentElement.insertBefore(this.timestampElement, this._contentElem ent.firstChild); | 832 this._contentElement.insertBefore(this.timestampElement, this._contentElem ent.firstChild); |
| 829 return; | 833 return; |
| 830 } | 834 } |
| 831 | 835 |
| 832 if (!show && this.timestampElement) { | 836 if (!show && this.timestampElement) { |
| 833 this.timestampElement.remove(); | 837 this.timestampElement.remove(); |
| 834 delete this.timestampElement; | 838 delete this.timestampElement; |
| 835 } | 839 } |
| 836 } | 840 } |
| 837 | 841 |
| 842 updateContextLabel() { | |
| 843 var target = this._target(); | |
| 844 if (!this._contentElement || !target) | |
| 845 return; | |
| 846 if (!this._contextLabelElement) { | |
| 847 this._contextLabelElement = createElementWithClass('span', 'console-contex t-label'); | |
| 848 this._contentElement.insertBefore(this._contextLabelElement, this._content Element.firstChild); | |
| 849 } | |
| 850 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.
| |
| 851 this._contextLabelElement.title = ''; | |
| 852 | |
| 853 // Logs from scripts, extensions, and service workers have a labeled executi on context. Iframes have a more useful | |
| 854 // frame title. Unlabeled cases include worker messages with source != 'work er' or no workerId and uncaught errors. | |
| 855 var messageContext = target.runtimeModel.executionContext(this._message.exec utionContextId); | |
| 856 var currentContext = UI.context.flavor(SDK.ExecutionContext); | |
| 857 if (messageContext && messageContext !== currentContext) { | |
| 858 var labelText = Console.ConsoleContextSelector.titleFor(messageContext, fa lse /* showStatus */); | |
| 859 this._contextLabelElement.textContent = labelText + ' '; | |
| 860 this._contextLabelElement.title = labelText; | |
| 861 } | |
| 862 } | |
| 863 | |
| 838 /** | 864 /** |
| 839 * @return {number} | 865 * @return {number} |
| 840 */ | 866 */ |
| 841 nestingLevel() { | 867 nestingLevel() { |
| 842 return this._nestingLevel; | 868 return this._nestingLevel; |
| 843 } | 869 } |
| 844 | 870 |
| 845 resetCloseGroupDecorationCount() { | 871 resetCloseGroupDecorationCount() { |
| 846 if (!this._closeGroupDecorationCount) | 872 if (!this._closeGroupDecorationCount) |
| 847 return; | 873 return; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 consoleMessage.type === SDK.ConsoleMessa ge.MessageType.Trace || | 914 consoleMessage.type === SDK.ConsoleMessa ge.MessageType.Trace || |
| 889 consoleMessage.level === SDK.ConsoleMess age.MessageLevel.Warning); | 915 consoleMessage.level === SDK.ConsoleMess age.MessageLevel.Warning); |
| 890 if (target && shouldIncludeTrace) | 916 if (target && shouldIncludeTrace) |
| 891 formattedMessage = this._buildMessageWithStackTrace(consoleMessage, target , this._linkifier); | 917 formattedMessage = this._buildMessageWithStackTrace(consoleMessage, target , this._linkifier); |
| 892 else if (this._message.type === SDK.ConsoleMessage.MessageType.Table) | 918 else if (this._message.type === SDK.ConsoleMessage.MessageType.Table) |
| 893 formattedMessage = this._buildTableMessage(this._message); | 919 formattedMessage = this._buildTableMessage(this._message); |
| 894 else | 920 else |
| 895 formattedMessage = this._buildMessage(consoleMessage); | 921 formattedMessage = this._buildMessage(consoleMessage); |
| 896 contentElement.appendChild(formattedMessage); | 922 contentElement.appendChild(formattedMessage); |
| 897 | 923 |
| 924 this.updateContextLabel(); | |
| 898 this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get()) ; | 925 this.updateTimestamp(Common.moduleSetting('consoleTimestampsEnabled').get()) ; |
| 899 return this._contentElement; | 926 return this._contentElement; |
| 900 } | 927 } |
| 901 | 928 |
| 902 /** | 929 /** |
| 903 * @return {!Element} | 930 * @return {!Element} |
| 904 */ | 931 */ |
| 905 toMessageElement() { | 932 toMessageElement() { |
| 906 if (this._element) | 933 if (this._element) |
| 907 return this._element; | 934 return this._element; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1208 toMessageElement() { | 1235 toMessageElement() { |
| 1209 if (!this._element) { | 1236 if (!this._element) { |
| 1210 super.toMessageElement(); | 1237 super.toMessageElement(); |
| 1211 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); | 1238 this._expandGroupIcon = UI.Icon.create('', 'expand-group-icon'); |
| 1212 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); | 1239 this._contentElement.insertBefore(this._expandGroupIcon, this._contentElem ent.firstChild); |
| 1213 this.setCollapsed(this._collapsed); | 1240 this.setCollapsed(this._collapsed); |
| 1214 } | 1241 } |
| 1215 return this._element; | 1242 return this._element; |
| 1216 } | 1243 } |
| 1217 }; | 1244 }; |
| OLD | NEW |