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._dataGrids = []; | 43 this._dataGrids = []; |
44 /** @type {!Map.<!WebInspector.DataGrid, ?Element>} */ | 44 /** @type {!Map.<!WebInspector.DataGrid, ?Element>} */ |
45 this._dataGridParents = new Map(); | 45 this._dataGridParents = new Map(); |
46 | 46 |
47 this._customFormatters = { | 47 this._customFormatters = { |
48 "object": this._formatParameterAsObject, | 48 "object": this._formatParameterAsObject, |
49 "array": this._formatParameterAsArray, | 49 "array": this._formatParameterAsArray, |
50 "node": this._formatParameterAsNode, | 50 "node": this._formatParameterAsNode, |
51 "string": this._formatParameterAsString | 51 "string": this._formatParameterAsString |
52 }; | 52 }; |
53 | |
54 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._cons oleTimestampsSettingChanged.bind(this)); | |
apavlov
2014/03/21 09:30:46
WebInspector.settings.consoleTimestampsEnabled.add
| |
53 } | 55 } |
54 | 56 |
57 | |
apavlov
2014/03/21 09:30:46
extra line added
| |
55 WebInspector.ConsoleViewMessage.prototype = { | 58 WebInspector.ConsoleViewMessage.prototype = { |
56 wasShown: function() | 59 wasShown: function() |
57 { | 60 { |
58 for (var i = 0; this._dataGrids && i < this._dataGrids.length; ++i) { | 61 for (var i = 0; this._dataGrids && i < this._dataGrids.length; ++i) { |
59 var dataGrid = this._dataGrids[i]; | 62 var dataGrid = this._dataGrids[i]; |
60 var parentElement = this._dataGridParents.get(dataGrid) || null; | 63 var parentElement = this._dataGridParents.get(dataGrid) || null; |
61 dataGrid.show(parentElement); | 64 dataGrid.show(parentElement); |
62 dataGrid.updateWidths(); | 65 dataGrid.updateWidths(); |
63 } | 66 } |
64 }, | 67 }, |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
836 | 839 |
837 /** | 840 /** |
838 * @return {boolean} | 841 * @return {boolean} |
839 */ | 842 */ |
840 matchesRegex: function(regexObject) | 843 matchesRegex: function(regexObject) |
841 { | 844 { |
842 regexObject.lastIndex = 0; | 845 regexObject.lastIndex = 0; |
843 return regexObject.test(this._formattedMessageText()) || (!!this._anchor Element && regexObject.test(this._anchorElement.textContent)); | 846 return regexObject.test(this._formattedMessageText()) || (!!this._anchor Element && regexObject.test(this._anchorElement.textContent)); |
844 }, | 847 }, |
845 | 848 |
849 _updateTimestamp: function(show) | |
850 { | |
851 if (!this._element) | |
852 return; | |
853 | |
854 if (!this.timestampElement) { | |
apavlov
2014/03/21 09:30:46
don't we want the timestampElements to be lazily c
| |
855 this.timestampElement = this._element.createChild("span", "console-t imestamp"); | |
856 this._element.insertBefore(this.timestampElement, this._element.firs tChild); | |
857 } | |
858 | |
859 if (show) { | |
860 this.timestampElement.textContent = (new Date(this._message.timestam p)).toConsoleTime(); | |
861 this.timestampElement.classList.remove("hidden"); | |
862 } else { | |
863 this.timestampElement.textContent = ""; | |
apavlov
2014/03/21 09:30:46
...and removed when no longer needed?
That can sa
| |
864 this.timestampElement.classList.add("hidden"); | |
865 } | |
866 }, | |
867 | |
868 _consoleTimestampsSettingChanged: function(event) | |
869 { | |
870 var enabled = /** @type {boolean} */ (event.data); | |
871 this._updateTimestamp(enabled); | |
872 }, | |
873 | |
846 /** | 874 /** |
847 * @return {!Element} | 875 * @return {!Element} |
848 */ | 876 */ |
849 toMessageElement: function() | 877 toMessageElement: function() |
850 { | 878 { |
851 if (this._element) | 879 if (this._element) |
852 return this._element; | 880 return this._element; |
853 | 881 |
854 var element = document.createElement("div"); | 882 var element = document.createElement("div"); |
855 element.message = this; | 883 element.message = this; |
(...skipping 19 matching lines...) Expand all Loading... | |
875 break; | 903 break; |
876 } | 904 } |
877 | 905 |
878 if (this._message.type === WebInspector.ConsoleMessage.MessageType.Start Group || this._message.type === WebInspector.ConsoleMessage.MessageType.StartGro upCollapsed) | 906 if (this._message.type === WebInspector.ConsoleMessage.MessageType.Start Group || this._message.type === WebInspector.ConsoleMessage.MessageType.StartGro upCollapsed) |
879 element.classList.add("console-group-title"); | 907 element.classList.add("console-group-title"); |
880 | 908 |
881 element.appendChild(this.formattedMessage()); | 909 element.appendChild(this.formattedMessage()); |
882 | 910 |
883 if (this._message.repeatCount > 1) | 911 if (this._message.repeatCount > 1) |
884 this.updateRepeatCount(); | 912 this.updateRepeatCount(); |
913 this._updateTimestamp(WebInspector.settings.consoleTimestampsEnabled.get ()); | |
885 | 914 |
886 return element; | 915 return element; |
887 }, | 916 }, |
888 | 917 |
889 _populateStackTraceTreeElement: function(parentTreeElement) | 918 _populateStackTraceTreeElement: function(parentTreeElement) |
890 { | 919 { |
891 for (var i = 0; i < this._message.stackTrace.length; i++) { | 920 for (var i = 0; i < this._message.stackTrace.length; i++) { |
892 var frame = this._message.stackTrace[i]; | 921 var frame = this._message.stackTrace[i]; |
893 | 922 |
894 var content = document.createElementWithClass("div", "stacktrace-ent ry"); | 923 var content = document.createElementWithClass("div", "stacktrace-ent ry"); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 } | 1046 } |
1018 | 1047 |
1019 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; | 1048 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; |
1020 }, | 1049 }, |
1021 | 1050 |
1022 get text() | 1051 get text() |
1023 { | 1052 { |
1024 return this._message.messageText; | 1053 return this._message.messageText; |
1025 } | 1054 } |
1026 } | 1055 } |
OLD | NEW |