OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 this._updateFilterStatus(); | 128 this._updateFilterStatus(); |
129 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); | 129 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); |
130 } | 130 } |
131 | 131 |
132 WebInspector.ConsoleView.prototype = { | 132 WebInspector.ConsoleView.prototype = { |
133 /** | 133 /** |
134 * @param {!WebInspector.Target} target | 134 * @param {!WebInspector.Target} target |
135 */ | 135 */ |
136 targetAdded: function(target) | 136 targetAdded: function(target) |
137 { | 137 { |
138 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me
ssageAdded, this._onConsoleMessageAdded.bind(this, target), this); | 138 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me
ssageAdded, this._onConsoleMessageAdded, this); |
139 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
nsoleCleared, this._consoleCleared, this); | 139 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
nsoleCleared, this._consoleCleared, this); |
140 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
mmandEvaluated, this._commandEvaluated, this); | 140 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
mmandEvaluated, this._commandEvaluated, this); |
141 target.consoleModel.messages.forEach(this._consoleMessageAdded.bind(this
, target)); | 141 target.consoleModel.messages.forEach(this._consoleMessageAdded, this); |
142 | 142 |
143 /** | 143 /** |
144 * @param {!WebInspector.ExecutionContextList} contextList | 144 * @param {!WebInspector.ExecutionContextList} contextList |
145 * @this {WebInspector.ConsoleView} | 145 * @this {WebInspector.ConsoleView} |
146 */ | 146 */ |
147 function loadContextList(contextList) | 147 function loadContextList(contextList) |
148 { | 148 { |
149 this._addExecutionContextList(target, contextList); | 149 this._addExecutionContextList(target, contextList); |
150 this._contextListChanged(target, contextList); | 150 this._contextListChanged(target, contextList); |
151 } | 151 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 */ | 422 */ |
423 _updateFilterStatus: function(count) { | 423 _updateFilterStatus: function(count) { |
424 count = (typeof count === "undefined") ? (this._consoleMessages.length -
this._visibleViewMessages.length) : count; | 424 count = (typeof count === "undefined") ? (this._consoleMessages.length -
this._visibleViewMessages.length) : count; |
425 this._filterStatusTextElement.textContent = WebInspector.UIString(count
== 1 ? "%d message is hidden by filters." : "%d messages are hidden by filters."
, count); | 425 this._filterStatusTextElement.textContent = WebInspector.UIString(count
== 1 ? "%d message is hidden by filters." : "%d messages are hidden by filters."
, count); |
426 this._filterStatusMessageElement.style.display = count ? "" : "none"; | 426 this._filterStatusMessageElement.style.display = count ? "" : "none"; |
427 }, | 427 }, |
428 | 428 |
429 /** | 429 /** |
430 * @param {!WebInspector.ConsoleMessage} message | 430 * @param {!WebInspector.ConsoleMessage} message |
431 */ | 431 */ |
432 _consoleMessageAdded: function(target, message) | 432 _consoleMessageAdded: function(message) |
433 { | 433 { |
434 if (this._urlToMessageCount[message.url]) | 434 if (this._urlToMessageCount[message.url]) |
435 this._urlToMessageCount[message.url]++; | 435 this._urlToMessageCount[message.url]++; |
436 else | 436 else |
437 this._urlToMessageCount[message.url] = 1; | 437 this._urlToMessageCount[message.url] = 1; |
438 | 438 |
439 var previousMessage = this._consoleMessages.peekLast(); | 439 var previousMessage = this._consoleMessages.peekLast(); |
440 if (previousMessage && !message.isGroupMessage() && message.isEqual(prev
iousMessage)) { | 440 if (previousMessage && !message.isGroupMessage() && message.isEqual(prev
iousMessage)) { |
441 previousMessage.timestamp = message.timestamp; | 441 previousMessage.timestamp = message.timestamp; |
442 this._messageToViewMessage.get(previousMessage).incrementRepeatCount
(); | 442 this._messageToViewMessage.get(previousMessage).incrementRepeatCount
(); |
443 return; | 443 return; |
444 } | 444 } |
445 | 445 |
446 this._consoleMessages.push(message); | 446 this._consoleMessages.push(message); |
447 var viewMessage = this._createViewMessage(target, message); | 447 var viewMessage = this._createViewMessage(message); |
448 | 448 |
449 if (this._filter.shouldBeVisible(viewMessage)) | 449 if (this._filter.shouldBeVisible(viewMessage)) |
450 this._showConsoleMessage(viewMessage); | 450 this._showConsoleMessage(viewMessage); |
451 else | 451 else |
452 this._updateFilterStatus(); | 452 this._updateFilterStatus(); |
453 }, | 453 }, |
454 | 454 |
455 /** | 455 /** |
456 * @param {!WebInspector.Event} event | 456 * @param {!WebInspector.Event} event |
457 */ | 457 */ |
458 _onConsoleMessageAdded: function(target, event) | 458 _onConsoleMessageAdded: function(event) |
459 { | 459 { |
460 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); | 460 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); |
461 this._consoleMessageAdded(target, message); | 461 this._consoleMessageAdded(message); |
462 }, | 462 }, |
463 | 463 |
464 /** | 464 /** |
465 * @param {!WebInspector.ConsoleViewMessage} viewMessage | 465 * @param {!WebInspector.ConsoleViewMessage} viewMessage |
466 */ | 466 */ |
467 _showConsoleMessage: function(viewMessage) | 467 _showConsoleMessage: function(viewMessage) |
468 { | 468 { |
469 var message = viewMessage.consoleMessage(); | 469 var message = viewMessage.consoleMessage(); |
470 | 470 |
471 // this.messagesElement.isScrolledToBottom() is forcing style recalculat
ion. | 471 // this.messagesElement.isScrolledToBottom() is forcing style recalculat
ion. |
(...skipping 20 matching lines...) Expand all Loading... |
492 if (this._searchRegex && viewMessage.matchesRegex(this._searchRegex)) { | 492 if (this._searchRegex && viewMessage.matchesRegex(this._searchRegex)) { |
493 this._searchResults.push(viewMessage); | 493 this._searchResults.push(viewMessage); |
494 this._searchableView.updateSearchMatchesCount(this._searchResults.le
ngth); | 494 this._searchableView.updateSearchMatchesCount(this._searchResults.le
ngth); |
495 } | 495 } |
496 }, | 496 }, |
497 | 497 |
498 /** | 498 /** |
499 * @param {!WebInspector.ConsoleMessage} message | 499 * @param {!WebInspector.ConsoleMessage} message |
500 * @return {!WebInspector.ConsoleViewMessage} | 500 * @return {!WebInspector.ConsoleViewMessage} |
501 */ | 501 */ |
502 _createViewMessage: function(target, message) | 502 _createViewMessage: function(message) |
503 { | 503 { |
504 var viewMessage = this._messageToViewMessage.get(message); | 504 var viewMessage = this._messageToViewMessage.get(message); |
505 if (viewMessage) | 505 if (viewMessage) |
506 return viewMessage; | 506 return viewMessage; |
507 if (message.type === WebInspector.ConsoleMessage.MessageType.Command) | 507 if (message.type === WebInspector.ConsoleMessage.MessageType.Command) |
508 viewMessage = new WebInspector.ConsoleCommand(target, message); | 508 viewMessage = new WebInspector.ConsoleCommand(message); |
509 else | 509 else |
510 viewMessage = new WebInspector.ConsoleViewMessage(target, message, t
his._linkifier); | 510 viewMessage = new WebInspector.ConsoleViewMessage(message, this._lin
kifier); |
511 this._messageToViewMessage.put(message, viewMessage); | 511 this._messageToViewMessage.put(message, viewMessage); |
512 return viewMessage; | 512 return viewMessage; |
513 }, | 513 }, |
514 | 514 |
515 _consoleCleared: function() | 515 _consoleCleared: function() |
516 { | 516 { |
517 this._scrolledToBottom = true; | 517 this._scrolledToBottom = true; |
518 this._clearCurrentSearchResultHighlight(); | 518 this._clearCurrentSearchResultHighlight(); |
519 this._updateFilterStatus(0); | 519 this._updateFilterStatus(0); |
520 | 520 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 993 |
994 __proto__: WebInspector.Object.prototype | 994 __proto__: WebInspector.Object.prototype |
995 }; | 995 }; |
996 | 996 |
997 | 997 |
998 /** | 998 /** |
999 * @constructor | 999 * @constructor |
1000 * @extends {WebInspector.ConsoleViewMessage} | 1000 * @extends {WebInspector.ConsoleViewMessage} |
1001 * @param {!WebInspector.ConsoleMessage} message | 1001 * @param {!WebInspector.ConsoleMessage} message |
1002 */ | 1002 */ |
1003 WebInspector.ConsoleCommand = function(target, message) | 1003 WebInspector.ConsoleCommand = function(message) |
1004 { | 1004 { |
1005 WebInspector.ConsoleViewMessage.call(this, target, message, null); | 1005 WebInspector.ConsoleViewMessage.call(this, message, null); |
1006 } | 1006 } |
1007 | 1007 |
1008 WebInspector.ConsoleCommand.prototype = { | 1008 WebInspector.ConsoleCommand.prototype = { |
1009 wasShown: function() | 1009 wasShown: function() |
1010 { | 1010 { |
1011 }, | 1011 }, |
1012 | 1012 |
1013 willHide: function() | 1013 willHide: function() |
1014 { | 1014 { |
1015 }, | 1015 }, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 { | 1068 { |
1069 this._formattedCommand = document.createElement("span"); | 1069 this._formattedCommand = document.createElement("span"); |
1070 this._formattedCommand.className = "console-message-text source-code"; | 1070 this._formattedCommand.className = "console-message-text source-code"; |
1071 this._formattedCommand.textContent = this.text; | 1071 this._formattedCommand.textContent = this.text; |
1072 }, | 1072 }, |
1073 | 1073 |
1074 __proto__: WebInspector.ConsoleViewMessage.prototype | 1074 __proto__: WebInspector.ConsoleViewMessage.prototype |
1075 } | 1075 } |
1076 | 1076 |
1077 /** | 1077 /** |
| 1078 * @constructor |
1078 * @extends {WebInspector.ConsoleViewMessage} | 1079 * @extends {WebInspector.ConsoleViewMessage} |
1079 * @constructor | |
1080 * @param {!WebInspector.RemoteObject} result | 1080 * @param {!WebInspector.RemoteObject} result |
1081 * @param {boolean} wasThrown | 1081 * @param {boolean} wasThrown |
1082 * @param {?WebInspector.ConsoleCommand} originatingCommand | 1082 * @param {?WebInspector.ConsoleCommand} originatingCommand |
1083 * @param {!WebInspector.Linkifier} linkifier | 1083 * @param {!WebInspector.Linkifier} linkifier |
1084 * @param {string=} url | 1084 * @param {string=} url |
1085 * @param {number=} lineNumber | 1085 * @param {number=} lineNumber |
1086 * @param {number=} columnNumber | 1086 * @param {number=} columnNumber |
1087 */ | 1087 */ |
1088 WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingComma
nd, linkifier, url, lineNumber, columnNumber) | 1088 WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingComma
nd, linkifier, url, lineNumber, columnNumber) |
1089 { | 1089 { |
1090 this.originatingCommand = originatingCommand; | 1090 this.originatingCommand = originatingCommand; |
1091 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : Web
Inspector.ConsoleMessage.MessageLevel.Log; | 1091 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : Web
Inspector.ConsoleMessage.MessageLevel.Log; |
1092 | 1092 var message = new WebInspector.ConsoleMessage(/** @type {!WebInspector.Targe
t} */ (result.target()), WebInspector.ConsoleMessage.MessageSource.JS, level, ""
, WebInspector.ConsoleMessage.MessageType.Result, url, lineNumber, columnNumber,
undefined, [result]); |
1093 var message = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.Me
ssageSource.JS, level, "", WebInspector.ConsoleMessage.MessageType.Result, url,
lineNumber, columnNumber, undefined, [result]); | 1093 WebInspector.ConsoleViewMessage.call(this, message, linkifier); |
1094 WebInspector.ConsoleViewMessage.call(this, /** @type {!WebInspector.Target}
*/ (result.target()), message, linkifier); | |
1095 } | 1094 } |
1096 | 1095 |
1097 WebInspector.ConsoleCommandResult.prototype = { | 1096 WebInspector.ConsoleCommandResult.prototype = { |
1098 /** | 1097 /** |
1099 * @override | 1098 * @override |
1100 * @param {!WebInspector.RemoteObject} array | 1099 * @param {!WebInspector.RemoteObject} array |
1101 * @return {boolean} | 1100 * @return {boolean} |
1102 */ | 1101 */ |
1103 useArrayPreviewInFormatter: function(array) | 1102 useArrayPreviewInFormatter: function(array) |
1104 { | 1103 { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1207 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
1209 /** | 1208 /** |
1210 * @return {boolean} | 1209 * @return {boolean} |
1211 */ | 1210 */ |
1212 handleAction: function() | 1211 handleAction: function() |
1213 { | 1212 { |
1214 WebInspector.console.show(); | 1213 WebInspector.console.show(); |
1215 return true; | 1214 return true; |
1216 } | 1215 } |
1217 } | 1216 } |
OLD | NEW |