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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
944 } | 944 } |
945 a.appendChild(toAppend); | 945 a.appendChild(toAppend); |
946 } | 946 } |
947 return a; | 947 return a; |
948 } | 948 } |
949 | 949 |
950 // String.format does treat formattedResult like a Builder, result is an object. | 950 // String.format does treat formattedResult like a Builder, result is an object. |
951 return String.format(format, parameters, formatters, formattedResult, ap pend); | 951 return String.format(format, parameters, formatters, formattedResult, ap pend); |
952 }, | 952 }, |
953 | 953 |
954 clearHighlight: function() | 954 clearHighlights: function() |
955 { | 955 { |
956 if (!this._formattedMessage) | 956 if (!this._formattedMessage) |
957 return; | 957 return; |
958 | 958 |
959 WebInspector.removeSearchResultsHighlight(this._formattedMessage); | 959 WebInspector.removeSearchResultsHighlight(this._formattedMessage, WebIns pector.highlightedSearchResultClassName); |
960 }, | |
961 | |
962 highlightSearchResults: function(regexObject) | |
963 { | |
964 if (!this._formattedMessage) | |
965 return; | |
966 | |
967 this._highlightSearchResultsInElement(regexObject, this._messageElement) ; | |
968 if (this._anchorElement) | |
969 this._highlightSearchResultsInElement(regexObject, this._anchorEleme nt); | |
970 }, | 960 }, |
971 | 961 |
972 _highlightSearchResultsInElement: function(regexObject, element) | 962 _highlightSearchResultsInElement: function(regexObject, element) |
973 { | 963 { |
974 regexObject.lastIndex = 0; | 964 regexObject.lastIndex = 0; |
975 var text = element.textContent; | 965 var text = element.textContent; |
976 var match = regexObject.exec(text); | 966 var match = regexObject.exec(text); |
977 var matchRanges = []; | 967 var matchRanges = []; |
978 while (match) { | 968 while (match) { |
979 matchRanges.push(new WebInspector.SourceRange(match.index, match[0]. length)); | 969 matchRanges.push(new WebInspector.SourceRange(match.index, match[0]. length)); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1276 | 1266 |
1277 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; | 1267 return sourceString + " " + typeString + " " + levelString + ": " + this .formattedMessage().textContent + "\n" + this._message.url + " line " + this._me ssage.line; |
1278 }, | 1268 }, |
1279 | 1269 |
1280 get text() | 1270 get text() |
1281 { | 1271 { |
1282 return this._message.messageText; | 1272 return this._message.messageText; |
1283 }, | 1273 }, |
1284 | 1274 |
1285 /** | 1275 /** |
1276 * @return {string} | |
1277 */ | |
1278 getText: function () | |
lushnikov
2014/12/04 16:07:34
We have getter text() and method getText, which is
aknudsen
2014/12/05 22:30:02
Done.
| |
1279 { | |
1280 if (!this._messageElement) | |
1281 return ""; | |
1282 return this._messageElement.textContent; | |
1283 }, | |
1284 | |
1285 /** | |
1286 * @param {!Array.<!Object>} ranges | |
1287 * @return {!Array.<!Element>} | |
1288 */ | |
1289 highlightMatches: function(ranges) | |
1290 { | |
1291 var highlightNodes = []; | |
1292 if (this._formattedMessage) | |
1293 highlightNodes = WebInspector.highlightSearchResults(this._messageEl ement, ranges); | |
1294 return highlightNodes; | |
1295 }, | |
1296 | |
1297 /** | |
1286 * @param {string} string | 1298 * @param {string} string |
1287 * @return {?Element} | 1299 * @return {?Element} |
1288 */ | 1300 */ |
1289 _tryFormatAsError: function(string) | 1301 _tryFormatAsError: function(string) |
1290 { | 1302 { |
1291 var errorPrefixes = ["EvalError", "ReferenceError", "SyntaxError", "Type Error", "RangeError", "Error", "URIError"]; | 1303 var errorPrefixes = ["EvalError", "ReferenceError", "SyntaxError", "Type Error", "RangeError", "Error", "URIError"]; |
1292 var target = this._target(); | 1304 var target = this._target(); |
1293 if (!target || !errorPrefixes.some(String.prototype.startsWith.bind(new String(string)))) | 1305 if (!target || !errorPrefixes.some(String.prototype.startsWith.bind(new String(string)))) |
1294 return null; | 1306 return null; |
1295 | 1307 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1393 { | 1405 { |
1394 if (!this._wrapperElement) { | 1406 if (!this._wrapperElement) { |
1395 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); | 1407 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); |
1396 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1408 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
1397 } | 1409 } |
1398 return this._wrapperElement; | 1410 return this._wrapperElement; |
1399 }, | 1411 }, |
1400 | 1412 |
1401 __proto__: WebInspector.ConsoleViewMessage.prototype | 1413 __proto__: WebInspector.ConsoleViewMessage.prototype |
1402 } | 1414 } |
OLD | NEW |