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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return; | 470 return; |
471 } | 471 } |
472 | 472 |
473 if (this._tryToCollapseMessages(viewMessage, this._visibleViewMessages.peekL
ast())) | 473 if (this._tryToCollapseMessages(viewMessage, this._visibleViewMessages.peekL
ast())) |
474 return; | 474 return; |
475 | 475 |
476 var lastMessage = this._visibleViewMessages.peekLast(); | 476 var lastMessage = this._visibleViewMessages.peekLast(); |
477 if (viewMessage.consoleMessage().type === ConsoleModel.ConsoleMessage.Messag
eType.EndGroup) { | 477 if (viewMessage.consoleMessage().type === ConsoleModel.ConsoleMessage.Messag
eType.EndGroup) { |
478 if (lastMessage && !this._currentGroup.messagesHidden()) | 478 if (lastMessage && !this._currentGroup.messagesHidden()) |
479 lastMessage.incrementCloseGroupDecorationCount(); | 479 lastMessage.incrementCloseGroupDecorationCount(); |
480 this._currentGroup = this._currentGroup.parentGroup(); | 480 this._currentGroup = this._currentGroup.parentGroup() || this._currentGrou
p; |
481 return; | 481 return; |
482 } | 482 } |
483 if (!this._currentGroup.messagesHidden()) { | 483 if (!this._currentGroup.messagesHidden()) { |
484 var originatingMessage = viewMessage.consoleMessage().originatingMessage()
; | 484 var originatingMessage = viewMessage.consoleMessage().originatingMessage()
; |
485 if (lastMessage && originatingMessage && lastMessage.consoleMessage() ===
originatingMessage) | 485 if (lastMessage && originatingMessage && lastMessage.consoleMessage() ===
originatingMessage) |
486 lastMessage.toMessageElement().classList.add('console-adjacent-user-comm
and-result'); | 486 lastMessage.toMessageElement().classList.add('console-adjacent-user-comm
and-result'); |
487 | 487 |
488 this._visibleViewMessages.push(viewMessage); | 488 this._visibleViewMessages.push(viewMessage); |
489 this._searchMessage(this._visibleViewMessages.length - 1); | 489 this._searchMessage(this._visibleViewMessages.length - 1); |
490 } | 490 } |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 this._promptTextChangedForTest(); | 971 this._promptTextChangedForTest(); |
972 } | 972 } |
973 | 973 |
974 _promptTextChangedForTest() { | 974 _promptTextChangedForTest() { |
975 // This method is sniffed in tests. | 975 // This method is sniffed in tests. |
976 } | 976 } |
977 }; | 977 }; |
978 | 978 |
979 Console.ConsoleView.persistedHistorySize = 300; | 979 Console.ConsoleView.persistedHistorySize = 300; |
980 | 980 |
981 /** | |
982 * @unrestricted | |
983 */ | |
984 Console.ConsoleViewFilter = class { | 981 Console.ConsoleViewFilter = class { |
985 /** | 982 /** |
986 * @param {function()} filterChangedCallback | 983 * @param {function()} filterChangedCallback |
987 */ | 984 */ |
988 constructor(filterChangedCallback) { | 985 constructor(filterChangedCallback) { |
989 this._filterChanged = filterChangedCallback; | 986 this._filterChanged = filterChangedCallback; |
990 | 987 |
991 this._messageURLFiltersSetting = Common.settings.createSetting('messageURLFi
lters', {}); | 988 this._messageURLFiltersSetting = Common.settings.createSetting('messageURLFi
lters', {}); |
992 this._messageLevelFiltersSetting = Console.ConsoleViewFilter.levelFilterSett
ing(); | 989 this._messageLevelFiltersSetting = Console.ConsoleViewFilter.levelFilterSett
ing(); |
993 | 990 |
994 this._hideNetworkMessagesSetting = Common.moduleSetting('hideNetworkMessages
'); | 991 this._hideNetworkMessagesSetting = Common.moduleSetting('hideNetworkMessages
'); |
995 this._filterByExecutionContextSetting = Common.moduleSetting('selectedContex
tFilterEnabled'); | 992 this._filterByExecutionContextSetting = Common.moduleSetting('selectedContex
tFilterEnabled'); |
996 this._filterByConsoleAPISetting = Common.moduleSetting('consoleAPIFilterEnab
led'); | 993 this._filterByConsoleAPISetting = Common.moduleSetting('consoleAPIFilterEnab
led'); |
997 | 994 |
998 this._messageURLFiltersSetting.addChangeListener(this._filterChanged); | 995 this._messageURLFiltersSetting.addChangeListener(this._filterChanged); |
999 this._messageLevelFiltersSetting.addChangeListener(this._filterChanged); | 996 this._messageLevelFiltersSetting.addChangeListener(this._filterChanged); |
1000 this._hideNetworkMessagesSetting.addChangeListener(this._filterChanged); | 997 this._hideNetworkMessagesSetting.addChangeListener(this._filterChanged); |
1001 this._filterByExecutionContextSetting.addChangeListener(this._filterChanged)
; | 998 this._filterByExecutionContextSetting.addChangeListener(this._filterChanged)
; |
1002 this._filterByConsoleAPISetting.addChangeListener(this._filterChanged); | 999 this._filterByConsoleAPISetting.addChangeListener(this._filterChanged); |
1003 | 1000 |
1004 this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter'), 0.2, 1,
true); | 1001 this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter'), 0.2, 1,
true); |
1005 this._textFilterUI.addEventListener(UI.ToolbarInput.Event.TextChanged, this.
_textFilterChanged, this); | 1002 this._textFilterUI.addEventListener(UI.ToolbarInput.Event.TextChanged, this.
_textFilterChanged, this); |
| 1003 this._filterText = this._textFilterUI.value(); |
| 1004 /** @type {?RegExp} */ |
| 1005 this._filterRegex = null; |
1006 | 1006 |
1007 this._levelLabels = {}; | 1007 this._levelLabels = {}; |
1008 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Verbose] = Common
.UIString('Verbose'); | 1008 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Verbose] = Common
.UIString('Verbose'); |
1009 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Info] = Common.UI
String('Info'); | 1009 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Info] = Common.UI
String('Info'); |
1010 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Warning] = Common
.UIString('Warnings'); | 1010 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Warning] = Common
.UIString('Warnings'); |
1011 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Error] = Common.U
IString('Errors'); | 1011 this._levelLabels[ConsoleModel.ConsoleMessage.MessageLevel.Error] = Common.U
IString('Errors'); |
1012 | 1012 |
1013 this._levelMenuButton = new UI.ToolbarText(''); | 1013 this._levelMenuButton = new UI.ToolbarText(''); |
1014 this._levelMenuButtonArrow = new UI.ToolbarItem(UI.Icon.create('smallicon-tr
iangle-down')); | 1014 this._levelMenuButtonArrow = new UI.ToolbarItem(UI.Icon.create('smallicon-tr
iangle-down')); |
1015 this._levelMenuButton.element.addEventListener('click', this._showLevelConte
xtMenu.bind(this)); | 1015 this._levelMenuButton.element.addEventListener('click', this._showLevelConte
xtMenu.bind(this)); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 } | 1240 } |
1241 }; | 1241 }; |
1242 | 1242 |
1243 /** | 1243 /** |
1244 * The maximum length before strings are considered too long for syntax highligh
ting. | 1244 * The maximum length before strings are considered too long for syntax highligh
ting. |
1245 * @const | 1245 * @const |
1246 * @type {number} | 1246 * @type {number} |
1247 */ | 1247 */ |
1248 Console.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000; | 1248 Console.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000; |
1249 | 1249 |
1250 /** | |
1251 * @unrestricted | |
1252 */ | |
1253 Console.ConsoleCommandResult = class extends Console.ConsoleViewMessage { | 1250 Console.ConsoleCommandResult = class extends Console.ConsoleViewMessage { |
1254 /** | 1251 /** |
1255 * @param {!ConsoleModel.ConsoleMessage} message | 1252 * @param {!ConsoleModel.ConsoleMessage} message |
1256 * @param {!Components.Linkifier} linkifier | 1253 * @param {!Components.Linkifier} linkifier |
1257 * @param {!ProductRegistry.BadgePool} badgePool | 1254 * @param {!ProductRegistry.BadgePool} badgePool |
1258 * @param {number} nestingLevel | 1255 * @param {number} nestingLevel |
1259 */ | 1256 */ |
1260 constructor(message, linkifier, badgePool, nestingLevel) { | 1257 constructor(message, linkifier, badgePool, nestingLevel) { |
1261 super(message, linkifier, badgePool, nestingLevel); | 1258 super(message, linkifier, badgePool, nestingLevel); |
1262 } | 1259 } |
1263 | 1260 |
1264 /** | 1261 /** |
1265 * @override | 1262 * @override |
1266 * @return {!Element} | 1263 * @return {!Element} |
1267 */ | 1264 */ |
1268 contentElement() { | 1265 contentElement() { |
1269 var element = super.contentElement(); | 1266 var element = super.contentElement(); |
1270 if (!element.classList.contains('console-user-command-result')) { | 1267 if (!element.classList.contains('console-user-command-result')) { |
1271 element.classList.add('console-user-command-result'); | 1268 element.classList.add('console-user-command-result'); |
1272 if (this.consoleMessage().level === ConsoleModel.ConsoleMessage.MessageLev
el.Info) { | 1269 if (this.consoleMessage().level === ConsoleModel.ConsoleMessage.MessageLev
el.Info) { |
1273 var icon = UI.Icon.create('smallicon-command-result', 'command-result-ic
on'); | 1270 var icon = UI.Icon.create('smallicon-command-result', 'command-result-ic
on'); |
1274 element.insertBefore(icon, element.firstChild); | 1271 element.insertBefore(icon, element.firstChild); |
1275 } | 1272 } |
1276 } | 1273 } |
1277 return element; | 1274 return element; |
1278 } | 1275 } |
1279 }; | 1276 }; |
1280 | 1277 |
1281 /** | |
1282 * @unrestricted | |
1283 */ | |
1284 Console.ConsoleGroup = class { | 1278 Console.ConsoleGroup = class { |
1285 /** | 1279 /** |
1286 * @param {?Console.ConsoleGroup} parentGroup | 1280 * @param {?Console.ConsoleGroup} parentGroup |
1287 * @param {?Console.ConsoleViewMessage} groupMessage | 1281 * @param {?Console.ConsoleViewMessage} groupMessage |
1288 */ | 1282 */ |
1289 constructor(parentGroup, groupMessage) { | 1283 constructor(parentGroup, groupMessage) { |
1290 this._parentGroup = parentGroup; | 1284 this._parentGroup = parentGroup; |
1291 this._nestingLevel = parentGroup ? parentGroup.nestingLevel() + 1 : 0; | 1285 this._nestingLevel = parentGroup ? parentGroup.nestingLevel() + 1 : 0; |
1292 this._messagesHidden = | 1286 this._messagesHidden = |
1293 groupMessage && groupMessage.collapsed() || this._parentGroup && this._p
arentGroup.messagesHidden(); | 1287 groupMessage && groupMessage.collapsed() || this._parentGroup && this._p
arentGroup.messagesHidden(); |
(...skipping 17 matching lines...) Expand all Loading... |
1311 * @return {number} | 1305 * @return {number} |
1312 */ | 1306 */ |
1313 nestingLevel() { | 1307 nestingLevel() { |
1314 return this._nestingLevel; | 1308 return this._nestingLevel; |
1315 } | 1309 } |
1316 | 1310 |
1317 /** | 1311 /** |
1318 * @return {?Console.ConsoleGroup} | 1312 * @return {?Console.ConsoleGroup} |
1319 */ | 1313 */ |
1320 parentGroup() { | 1314 parentGroup() { |
1321 return this._parentGroup || this; | 1315 return this._parentGroup; |
1322 } | 1316 } |
1323 }; | 1317 }; |
1324 | 1318 |
1325 | |
1326 /** | 1319 /** |
1327 * @implements {UI.ActionDelegate} | 1320 * @implements {UI.ActionDelegate} |
1328 * @unrestricted | |
1329 */ | 1321 */ |
1330 Console.ConsoleView.ActionDelegate = class { | 1322 Console.ConsoleView.ActionDelegate = class { |
1331 /** | 1323 /** |
1332 * @override | 1324 * @override |
1333 * @param {!UI.Context} context | 1325 * @param {!UI.Context} context |
1334 * @param {string} actionId | 1326 * @param {string} actionId |
1335 * @return {boolean} | 1327 * @return {boolean} |
1336 */ | 1328 */ |
1337 handleAction(context, actionId) { | 1329 handleAction(context, actionId) { |
1338 switch (actionId) { | 1330 switch (actionId) { |
1339 case 'console.show': | 1331 case 'console.show': |
1340 InspectorFrontendHost.bringToFront(); | 1332 InspectorFrontendHost.bringToFront(); |
1341 Common.console.show(); | 1333 Common.console.show(); |
1342 return true; | 1334 return true; |
1343 case 'console.clear': | 1335 case 'console.clear': |
1344 Console.ConsoleView.clearConsole(); | 1336 Console.ConsoleView.clearConsole(); |
1345 return true; | 1337 return true; |
1346 case 'console.clear.history': | 1338 case 'console.clear.history': |
1347 Console.ConsoleView.instance()._clearHistory(); | 1339 Console.ConsoleView.instance()._clearHistory(); |
1348 return true; | 1340 return true; |
1349 } | 1341 } |
1350 return false; | 1342 return false; |
1351 } | 1343 } |
1352 }; | 1344 }; |
1353 | 1345 |
1354 /** | 1346 /** |
1355 * @typedef {{messageIndex: number, matchIndex: number}} | 1347 * @typedef {{messageIndex: number, matchIndex: number}} |
1356 */ | 1348 */ |
1357 Console.ConsoleView.RegexMatchRange; | 1349 Console.ConsoleView.RegexMatchRange; |
OLD | NEW |