Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: Source/devtools/front_end/ConsoleView.js

Issue 211023002: DevTools: Remove event Console.messageRepeatCountUpdated (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix inspector-protocol/console/console-timestamp.html Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
106 107
107 this.prompt = new WebInspector.TextPromptWithHistory(this._completionsForTex tPrompt.bind(this)); 108 this.prompt = new WebInspector.TextPromptWithHistory(this._completionsForTex tPrompt.bind(this));
108 this.prompt.setSuggestBoxEnabled("generic-suggest"); 109 this.prompt.setSuggestBoxEnabled("generic-suggest");
109 this.prompt.renderAsBlock(); 110 this.prompt.renderAsBlock();
110 this.prompt.attach(this.promptElement); 111 this.prompt.attach(this.promptElement);
111 this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bin d(this), false); 112 this.prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bin d(this), false);
112 this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); 113 this.prompt.setHistoryData(WebInspector.settings.consoleHistory.get());
113 114
114 WebInspector.targetManager.targets().forEach(this._targetAdded, this); 115 WebInspector.targetManager.targets().forEach(this._targetAdded, this);
115 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.TargetAdded, this._onTargetAdded, this); 116 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.TargetAdded, this._onTargetAdded, this);
(...skipping 20 matching lines...) Expand all
136 this._targetAdded(/**@type {!WebInspector.Target} */(event.data)); 137 this._targetAdded(/**@type {!WebInspector.Target} */(event.data));
137 }, 138 },
138 139
139 /** 140 /**
140 * @param {!WebInspector.Target} target 141 * @param {!WebInspector.Target} target
141 */ 142 */
142 _targetAdded: function(target) 143 _targetAdded: function(target)
143 { 144 {
144 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me ssageAdded, this._onConsoleMessageAdded.bind(this, target), this); 145 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me ssageAdded, this._onConsoleMessageAdded.bind(this, target), this);
145 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co nsoleCleared, this._consoleCleared, this); 146 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co nsoleCleared, this._consoleCleared, this);
146 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Re peatCountUpdated, this._repeatCountUpdated, this);
147 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co mmandEvaluated, this._commandEvaluated, this); 147 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co mmandEvaluated, this._commandEvaluated, this);
148 target.consoleModel.messages.forEach(this._consoleMessageAdded.bind(this , target)); 148 target.consoleModel.messages.forEach(this._consoleMessageAdded.bind(this , target));
149 149
150 /** 150 /**
151 * @param {!WebInspector.ExecutionContextList} contextList 151 * @param {!WebInspector.ExecutionContextList} contextList
152 * @this {WebInspector.ConsoleView} 152 * @this {WebInspector.ConsoleView}
153 */ 153 */
154 function loadContextList(contextList) 154 function loadContextList(contextList)
155 { 155 {
156 this._addExecutionContextList(target, contextList); 156 this._addExecutionContextList(target, contextList);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 count = (typeof count === "undefined") ? (this._consoleMessages.length - this._visibleViewMessages.length) : count; 409 count = (typeof count === "undefined") ? (this._consoleMessages.length - this._visibleViewMessages.length) : count;
410 this._filterStatusTextElement.textContent = WebInspector.UIString(count == 1 ? "%d message is hidden by filters." : "%d messages are hidden by filters." , count); 410 this._filterStatusTextElement.textContent = WebInspector.UIString(count == 1 ? "%d message is hidden by filters." : "%d messages are hidden by filters." , count);
411 this._filterStatusMessageElement.style.display = count ? "" : "none"; 411 this._filterStatusMessageElement.style.display = count ? "" : "none";
412 }, 412 },
413 413
414 /** 414 /**
415 * @param {!WebInspector.ConsoleMessage} message 415 * @param {!WebInspector.ConsoleMessage} message
416 */ 416 */
417 _consoleMessageAdded: function(target, message) 417 _consoleMessageAdded: function(target, message)
418 { 418 {
419 this._consoleMessages.push(message);
420 var viewMessage = this._createViewMessage(target, message);
421 if (this._urlToMessageCount[message.url]) 419 if (this._urlToMessageCount[message.url])
422 this._urlToMessageCount[message.url]++; 420 this._urlToMessageCount[message.url]++;
423 else 421 else
424 this._urlToMessageCount[message.url] = 1; 422 this._urlToMessageCount[message.url] = 1;
425 423
424 if (this._previousMessage && !message.isGroupMessage() && message.isEqua l(this._previousMessage)) {
425 this._messageToViewMessage.get(this._previousMessage).incrementRepea tCount();
426 return;
427 }
428
429 this._consoleMessages.push(message);
430 this._previousMessage = message;
431 var viewMessage = this._createViewMessage(target, message);
432
426 if (this._filter.shouldBeVisible(viewMessage)) 433 if (this._filter.shouldBeVisible(viewMessage))
427 this._showConsoleMessage(viewMessage); 434 this._showConsoleMessage(viewMessage);
428 else 435 else
429 this._updateFilterStatus(); 436 this._updateFilterStatus();
430 }, 437 },
431 438
432 /** 439 /**
433 * @param {!WebInspector.Event} event 440 * @param {!WebInspector.Event} event
434 */ 441 */
435 _onConsoleMessageAdded: function(target, event) 442 _onConsoleMessageAdded: function(target, event)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 { 500 {
494 this._scrolledToBottom = true; 501 this._scrolledToBottom = true;
495 this._clearCurrentSearchResultHighlight(); 502 this._clearCurrentSearchResultHighlight();
496 this._updateFilterStatus(0); 503 this._updateFilterStatus(0);
497 504
498 for (var i = 0; i < this._visibleViewMessages.length; ++i) 505 for (var i = 0; i < this._visibleViewMessages.length; ++i)
499 this._visibleViewMessages[i].willHide(); 506 this._visibleViewMessages[i].willHide();
500 507
501 this._visibleViewMessages = []; 508 this._visibleViewMessages = [];
502 this._searchResults = []; 509 this._searchResults = [];
510 this._previousMessage = null;
503 this._messageToViewMessage.clear(); 511 this._messageToViewMessage.clear();
504 this._consoleMessages = []; 512 this._consoleMessages = [];
505 513
506 if (this._searchRegex) 514 if (this._searchRegex)
507 this._searchableView.updateSearchMatchesCount(0); 515 this._searchableView.updateSearchMatchesCount(0);
508 516
509 this.currentGroup = this.topGroup; 517 this.currentGroup = this.topGroup;
510 this.topGroup.messagesElement.removeChildren(); 518 this.topGroup.messagesElement.removeChildren();
511 519
512 this._linkifier.reset(); 520 this._linkifier.reset();
513 }, 521 },
514 522
515 /**
516 * @param {!WebInspector.Event} event
517 */
518 _repeatCountUpdated: function(event)
519 {
520 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data);
521 this._messageToViewMessage.get(message).updateRepeatCount();
522 },
523
524 _handleContextMenuEvent: function(event) 523 _handleContextMenuEvent: function(event)
525 { 524 {
526 if (event.target.enclosingNodeOrSelfWithNodeName("a")) 525 if (event.target.enclosingNodeOrSelfWithNodeName("a"))
527 return; 526 return;
528 527
529 var contextMenu = new WebInspector.ContextMenu(event); 528 var contextMenu = new WebInspector.ContextMenu(event);
530 529
531 function monitoringXHRItemAction() 530 function monitoringXHRItemAction()
532 { 531 {
533 WebInspector.settings.monitoringXHREnabled.set(!WebInspector.setting s.monitoringXHREnabled.get()); 532 WebInspector.settings.monitoringXHREnabled.set(!WebInspector.setting s.monitoringXHREnabled.get());
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 * @param {?WebInspector.ConsoleCommand} originatingCommand 1067 * @param {?WebInspector.ConsoleCommand} originatingCommand
1069 * @param {!WebInspector.Linkifier} linkifier 1068 * @param {!WebInspector.Linkifier} linkifier
1070 * @param {string=} url 1069 * @param {string=} url
1071 * @param {number=} lineNumber 1070 * @param {number=} lineNumber
1072 * @param {number=} columnNumber 1071 * @param {number=} columnNumber
1073 */ 1072 */
1074 WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingComma nd, linkifier, url, lineNumber, columnNumber) 1073 WebInspector.ConsoleCommandResult = function(result, wasThrown, originatingComma nd, linkifier, url, lineNumber, columnNumber)
1075 { 1074 {
1076 this.originatingCommand = originatingCommand; 1075 this.originatingCommand = originatingCommand;
1077 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : Web Inspector.ConsoleMessage.MessageLevel.Log; 1076 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error : Web Inspector.ConsoleMessage.MessageLevel.Log;
1078 var message = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.Me ssageSource.JS, level, "", WebInspector.ConsoleMessage.MessageType.Result, url, lineNumber, columnNumber, undefined, undefined, [result]); 1077
1078 var message = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.Me ssageSource.JS, level, "", WebInspector.ConsoleMessage.MessageType.Result, url, lineNumber, columnNumber, undefined, [result]);
1079 WebInspector.ConsoleViewMessage.call(this, result.target(), message, linkifi er); 1079 WebInspector.ConsoleViewMessage.call(this, result.target(), message, linkifi er);
1080 } 1080 }
1081 1081
1082 WebInspector.ConsoleCommandResult.prototype = { 1082 WebInspector.ConsoleCommandResult.prototype = {
1083 /** 1083 /**
1084 * @override 1084 * @override
1085 * @param {!WebInspector.RemoteObject} array 1085 * @param {!WebInspector.RemoteObject} array
1086 * @return {boolean} 1086 * @return {boolean}
1087 */ 1087 */
1088 useArrayPreviewInFormatter: function(array) 1088 useArrayPreviewInFormatter: function(array)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 var node = this.messagesElement.firstChild; 1174 var node = this.messagesElement.firstChild;
1175 while (node) { 1175 while (node) {
1176 if (node.classList.contains("console-message") && node.message) 1176 if (node.classList.contains("console-message") && node.message)
1177 node.message.wasShown(); 1177 node.message.wasShown();
1178 if (node.classList.contains("console-group") && node.group) 1178 if (node.classList.contains("console-group") && node.group)
1179 node.group.wasShown(); 1179 node.group.wasShown();
1180 node = node.nextSibling; 1180 node = node.nextSibling;
1181 } 1181 }
1182 } 1182 }
1183 } 1183 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ConsoleModel.js ('k') | Source/devtools/front_end/ConsoleViewMessage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698