| 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 // String.format does treat formattedResult like a Builder, result is an
object. | 864 // String.format does treat formattedResult like a Builder, result is an
object. |
| 865 return String.format(format, parameters, formatters, formattedResult, ap
pend); | 865 return String.format(format, parameters, formatters, formattedResult, ap
pend); |
| 866 }, | 866 }, |
| 867 | 867 |
| 868 /** | 868 /** |
| 869 * @return {boolean} | 869 * @return {boolean} |
| 870 */ | 870 */ |
| 871 matchesFilterRegex: function(regexObject) | 871 matchesFilterRegex: function(regexObject) |
| 872 { | 872 { |
| 873 regexObject.lastIndex = 0; | 873 regexObject.lastIndex = 0; |
| 874 var text = this.searchableElement().deepTextContent(); | 874 var text = this.contentElement().deepTextContent(); |
| 875 if (this._anchorElement) | |
| 876 text += " " + this._anchorElement.textContent; | |
| 877 return regexObject.test(text); | 875 return regexObject.test(text); |
| 878 }, | 876 }, |
| 879 | 877 |
| 880 /** | 878 /** |
| 881 * @param {boolean} show | 879 * @param {boolean} show |
| 882 */ | 880 */ |
| 883 updateTimestamp: function(show) | 881 updateTimestamp: function(show) |
| 884 { | 882 { |
| 885 if (!this._formattedMessage) | 883 if (!this._element) |
| 886 return; | 884 return; |
| 887 | 885 |
| 888 if (show && !this.timestampElement) { | 886 if (show && !this.timestampElement) { |
| 889 this.timestampElement = createElementWithClass("span", "console-time
stamp"); | 887 this.timestampElement = createElementWithClass("span", "console-time
stamp"); |
| 890 this.timestampElement.textContent = (new Date(this._message.timestam
p)).toConsoleTime() + " "; | 888 this.timestampElement.textContent = (new Date(this._message.timestam
p)).toConsoleTime() + " "; |
| 891 var afterRepeatCountChild = this._repeatCountElement && this._repeat
CountElement.nextSibling; | 889 var afterRepeatCountChild = this._repeatCountElement && this._repeat
CountElement.nextSibling; |
| 892 this._formattedMessage.insertBefore(this.timestampElement, this._for
mattedMessage.firstChild); | 890 this._element.insertBefore(this.timestampElement, this._element.firs
tChild); |
| 893 return; | 891 return; |
| 894 } | 892 } |
| 895 | 893 |
| 896 if (!show && this.timestampElement) { | 894 if (!show && this.timestampElement) { |
| 897 this.timestampElement.remove(); | 895 this.timestampElement.remove(); |
| 898 delete this.timestampElement; | 896 delete this.timestampElement; |
| 899 } | 897 } |
| 900 }, | 898 }, |
| 901 | 899 |
| 902 /** | 900 /** |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 levelString = "Error"; | 1149 levelString = "Error"; |
| 1152 break; | 1150 break; |
| 1153 case WebInspector.ConsoleMessage.MessageLevel.RevokedError: | 1151 case WebInspector.ConsoleMessage.MessageLevel.RevokedError: |
| 1154 levelString = "RevokedError"; | 1152 levelString = "RevokedError"; |
| 1155 break; | 1153 break; |
| 1156 case WebInspector.ConsoleMessage.MessageLevel.Info: | 1154 case WebInspector.ConsoleMessage.MessageLevel.Info: |
| 1157 levelString = "Info"; | 1155 levelString = "Info"; |
| 1158 break; | 1156 break; |
| 1159 } | 1157 } |
| 1160 | 1158 |
| 1161 return sourceString + " " + typeString + " " + levelString + ": " + this
.formattedMessage().textContent + "\n" + this._message.url + " line " + this._me
ssage.line; | 1159 return sourceString + " " + typeString + " " + levelString + ": " + this
.contentElement().textContent + "\n" + this._message.url + " line " + this._mess
age.line; |
| 1162 }, | 1160 }, |
| 1163 | 1161 |
| 1164 get text() | 1162 get text() |
| 1165 { | 1163 { |
| 1166 return this._message.messageText; | 1164 return this._message.messageText; |
| 1167 }, | 1165 }, |
| 1168 | 1166 |
| 1169 /** | 1167 /** |
| 1170 * @param {?RegExp} regex | 1168 * @param {?RegExp} regex |
| 1171 */ | 1169 */ |
| 1172 setSearchRegex: function(regex) | 1170 setSearchRegex: function(regex) |
| 1173 { | 1171 { |
| 1174 if (this._searchHiglightNodeChanges && this._searchHiglightNodeChanges.l
ength) | 1172 if (this._searchHiglightNodeChanges && this._searchHiglightNodeChanges.l
ength) |
| 1175 WebInspector.revertDomChanges(this._searchHiglightNodeChanges); | 1173 WebInspector.revertDomChanges(this._searchHiglightNodeChanges); |
| 1176 this._searchRegex = regex; | 1174 this._searchRegex = regex; |
| 1177 this._searchHighlightNodes = []; | 1175 this._searchHighlightNodes = []; |
| 1178 this._searchHiglightNodeChanges = []; | 1176 this._searchHiglightNodeChanges = []; |
| 1179 if (!this._searchRegex) | 1177 if (!this._searchRegex) |
| 1180 return; | 1178 return; |
| 1181 | 1179 |
| 1182 var text = this.searchableElement().deepTextContent(); | 1180 var text = this.contentElement().deepTextContent(); |
| 1183 var match; | 1181 var match; |
| 1184 this._searchRegex.lastIndex = 0; | 1182 this._searchRegex.lastIndex = 0; |
| 1185 var sourceRanges = []; | 1183 var sourceRanges = []; |
| 1186 while ((match = this._searchRegex.exec(text)) && match[0]) | 1184 while ((match = this._searchRegex.exec(text)) && match[0]) |
| 1187 sourceRanges.push(new WebInspector.SourceRange(match.index, match[0]
.length)); | 1185 sourceRanges.push(new WebInspector.SourceRange(match.index, match[0]
.length)); |
| 1188 | 1186 |
| 1189 if (sourceRanges.length && this.searchableElement()) | 1187 if (sourceRanges.length && this.contentElement()) |
| 1190 this._searchHighlightNodes = WebInspector.highlightSearchResults(thi
s.searchableElement(), sourceRanges, this._searchHiglightNodeChanges); | 1188 this._searchHighlightNodes = WebInspector.highlightSearchResults(thi
s.contentElement(), sourceRanges, this._searchHiglightNodeChanges); |
| 1191 }, | 1189 }, |
| 1192 | 1190 |
| 1193 /** | 1191 /** |
| 1194 * @return {?RegExp} | 1192 * @return {?RegExp} |
| 1195 */ | 1193 */ |
| 1196 searchRegex: function() | 1194 searchRegex: function() |
| 1197 { | 1195 { |
| 1198 return this._searchRegex; | 1196 return this._searchRegex; |
| 1199 }, | 1197 }, |
| 1200 | 1198 |
| 1201 /** | 1199 /** |
| 1202 * @return {number} | 1200 * @return {number} |
| 1203 */ | 1201 */ |
| 1204 searchCount: function() | 1202 searchCount: function() |
| 1205 { | 1203 { |
| 1206 return this._searchHighlightNodes.length; | 1204 return this._searchHighlightNodes.length; |
| 1207 }, | 1205 }, |
| 1208 | 1206 |
| 1209 /** | 1207 /** |
| 1210 * @return {!Element} | 1208 * @return {!Element} |
| 1211 */ | 1209 */ |
| 1212 searchHighlightNode: function(index) | 1210 searchHighlightNode: function(index) |
| 1213 { | 1211 { |
| 1214 return this._searchHighlightNodes[index]; | 1212 return this._searchHighlightNodes[index]; |
| 1215 }, | 1213 }, |
| 1216 | 1214 |
| 1217 /** | 1215 /** |
| 1218 * @return {!Element} | |
| 1219 */ | |
| 1220 searchableElement: function() | |
| 1221 { | |
| 1222 this.formattedMessage(); | |
| 1223 return this._messageElement; | |
| 1224 }, | |
| 1225 | |
| 1226 /** | |
| 1227 * @param {string} string | 1216 * @param {string} string |
| 1228 * @return {?Element} | 1217 * @return {?Element} |
| 1229 */ | 1218 */ |
| 1230 _tryFormatAsError: function(string) | 1219 _tryFormatAsError: function(string) |
| 1231 { | 1220 { |
| 1232 /** | 1221 /** |
| 1233 * @param {string} prefix | 1222 * @param {string} prefix |
| 1234 */ | 1223 */ |
| 1235 function startsWith(prefix) | 1224 function startsWith(prefix) |
| 1236 { | 1225 { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 { | 1334 { |
| 1346 if (!this._wrapperElement) { | 1335 if (!this._wrapperElement) { |
| 1347 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); | 1336 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this
); |
| 1348 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1337 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
| 1349 } | 1338 } |
| 1350 return this._wrapperElement; | 1339 return this._wrapperElement; |
| 1351 }, | 1340 }, |
| 1352 | 1341 |
| 1353 __proto__: WebInspector.ConsoleViewMessage.prototype | 1342 __proto__: WebInspector.ConsoleViewMessage.prototype |
| 1354 } | 1343 } |
| OLD | NEW |