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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 this.messagesElement.addEventListener("contextmenu", this._handleContextMenu
Event.bind(this), false); | 96 this.messagesElement.addEventListener("contextmenu", this._handleContextMenu
Event.bind(this), false); |
97 | 97 |
98 WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitorin
gXHREnabledSettingChanged.bind(this)); | 98 WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitorin
gXHREnabledSettingChanged.bind(this)); |
99 | 99 |
100 this._linkifier = new WebInspector.Linkifier(); | 100 this._linkifier = new WebInspector.Linkifier(); |
101 | 101 |
102 /** @type {!Map.<!WebInspector.ConsoleMessage, !WebInspector.ConsoleViewMess
age>} */ | 102 /** @type {!Map.<!WebInspector.ConsoleMessage, !WebInspector.ConsoleViewMess
age>} */ |
103 this._messageToViewMessage = new Map(); | 103 this._messageToViewMessage = new Map(); |
104 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ | 104 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ |
105 this._consoleMessages = []; | 105 this._consoleMessages = []; |
106 this._previousMessage = null; | |
107 | 106 |
108 this.prompt = new WebInspector.TextPromptWithHistory(this._completionsForTex
tPrompt.bind(this)); | 107 this.prompt = new WebInspector.TextPromptWithHistory(this._completionsForTex
tPrompt.bind(this)); |
109 this.prompt.setSuggestBoxEnabled("generic-suggest"); | 108 this.prompt.setSuggestBoxEnabled("generic-suggest"); |
110 this.prompt.renderAsBlock(); | 109 this.prompt.renderAsBlock(); |
111 this.prompt.attach(this.promptElement); | 110 this.prompt.attach(this.promptElement); |
112 this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bin
d(this), false); | 111 this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bin
d(this), false); |
113 this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); | 112 this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); |
114 | 113 |
115 WebInspector.targetManager.targets().forEach(this._targetAdded, this); | 114 WebInspector.targetManager.targets().forEach(this._targetAdded, this); |
116 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.TargetAdded, this._onTargetAdded, this); | 115 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.TargetAdded, this._onTargetAdded, this); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 /** | 413 /** |
415 * @param {!WebInspector.ConsoleMessage} message | 414 * @param {!WebInspector.ConsoleMessage} message |
416 */ | 415 */ |
417 _consoleMessageAdded: function(target, message) | 416 _consoleMessageAdded: function(target, message) |
418 { | 417 { |
419 if (this._urlToMessageCount[message.url]) | 418 if (this._urlToMessageCount[message.url]) |
420 this._urlToMessageCount[message.url]++; | 419 this._urlToMessageCount[message.url]++; |
421 else | 420 else |
422 this._urlToMessageCount[message.url] = 1; | 421 this._urlToMessageCount[message.url] = 1; |
423 | 422 |
424 if (this._previousMessage && !message.isGroupMessage() && message.isEqua
l(this._previousMessage)) { | 423 var previousMessage = this._consoleMessages.peekLast(); |
425 this._messageToViewMessage.get(this._previousMessage).incrementRepea
tCount(); | 424 if (previousMessage && !message.isGroupMessage() && message.isEqual(prev
iousMessage)) { |
| 425 previousMessage.timestamp = message.timestamp; |
| 426 this._messageToViewMessage.get(previousMessage).incrementRepeatCount
(); |
426 return; | 427 return; |
427 } | 428 } |
428 | 429 |
429 this._consoleMessages.push(message); | 430 this._consoleMessages.push(message); |
430 this._previousMessage = message; | |
431 var viewMessage = this._createViewMessage(target, message); | 431 var viewMessage = this._createViewMessage(target, message); |
432 | 432 |
433 if (this._filter.shouldBeVisible(viewMessage)) | 433 if (this._filter.shouldBeVisible(viewMessage)) |
434 this._showConsoleMessage(viewMessage); | 434 this._showConsoleMessage(viewMessage); |
435 else | 435 else |
436 this._updateFilterStatus(); | 436 this._updateFilterStatus(); |
437 }, | 437 }, |
438 | 438 |
439 /** | 439 /** |
440 * @param {!WebInspector.Event} event | 440 * @param {!WebInspector.Event} event |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 { | 500 { |
501 this._scrolledToBottom = true; | 501 this._scrolledToBottom = true; |
502 this._clearCurrentSearchResultHighlight(); | 502 this._clearCurrentSearchResultHighlight(); |
503 this._updateFilterStatus(0); | 503 this._updateFilterStatus(0); |
504 | 504 |
505 for (var i = 0; i < this._visibleViewMessages.length; ++i) | 505 for (var i = 0; i < this._visibleViewMessages.length; ++i) |
506 this._visibleViewMessages[i].willHide(); | 506 this._visibleViewMessages[i].willHide(); |
507 | 507 |
508 this._visibleViewMessages = []; | 508 this._visibleViewMessages = []; |
509 this._searchResults = []; | 509 this._searchResults = []; |
510 this._previousMessage = null; | |
511 this._messageToViewMessage.clear(); | 510 this._messageToViewMessage.clear(); |
512 this._consoleMessages = []; | 511 this._consoleMessages = []; |
513 | 512 |
514 if (this._searchRegex) | 513 if (this._searchRegex) |
515 this._searchableView.updateSearchMatchesCount(0); | 514 this._searchableView.updateSearchMatchesCount(0); |
516 | 515 |
517 this.currentGroup = this.topGroup; | 516 this.currentGroup = this.topGroup; |
518 this.topGroup.messagesElement.removeChildren(); | 517 this.topGroup.messagesElement.removeChildren(); |
519 | 518 |
520 this._linkifier.reset(); | 519 this._linkifier.reset(); |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 var node = this.messagesElement.firstChild; | 1173 var node = this.messagesElement.firstChild; |
1175 while (node) { | 1174 while (node) { |
1176 if (node.classList.contains("console-message") && node.message) | 1175 if (node.classList.contains("console-message") && node.message) |
1177 node.message.wasShown(); | 1176 node.message.wasShown(); |
1178 if (node.classList.contains("console-group") && node.group) | 1177 if (node.classList.contains("console-group") && node.group) |
1179 node.group.wasShown(); | 1178 node.group.wasShown(); |
1180 node = node.nextSibling; | 1179 node = node.nextSibling; |
1181 } | 1180 } |
1182 } | 1181 } |
1183 } | 1182 } |
OLD | NEW |