| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi
nd(this), false); | 134 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi
nd(this), false); |
| 135 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); | 135 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); |
| 136 var historyData = WebInspector.settings.consoleHistory.get(); | 136 var historyData = WebInspector.settings.consoleHistory.get(); |
| 137 this._prompt.setHistoryData(historyData); | 137 this._prompt.setHistoryData(historyData); |
| 138 | 138 |
| 139 this._updateFilterStatus(); | 139 this._updateFilterStatus(); |
| 140 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); | 140 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); |
| 141 | 141 |
| 142 this._registerWithMessageSink(); | 142 this._registerWithMessageSink(); |
| 143 WebInspector.targetManager.observeTargets(this); | 143 WebInspector.targetManager.observeTargets(this); |
| 144 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._consoleCleared, this); |
| 145 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._onConsoleMessageAdded, this); |
| 146 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.CommandEvaluated, this._commandEvaluated, this); |
| 147 /** |
| 148 * @param {!WebInspector.ConsoleMessage} message |
| 149 * @this {WebInspector.ConsoleView} |
| 150 */ |
| 151 function appendMessage(message) |
| 152 { |
| 153 var viewMessage = this._createViewMessage(message); |
| 154 this._consoleMessageAdded(viewMessage); |
| 155 } |
| 156 |
| 157 WebInspector.multitargetConsoleModel.messages().forEach(appendMessage, this)
; |
| 158 |
| 144 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this._executionContextChangedExternally, this); | 159 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this._executionContextChangedExternally, this); |
| 145 } | 160 } |
| 146 | 161 |
| 147 WebInspector.ConsoleView.prototype = { | 162 WebInspector.ConsoleView.prototype = { |
| 148 /** | 163 /** |
| 149 * @return {number} | 164 * @return {number} |
| 150 */ | 165 */ |
| 151 itemCount: function() | 166 itemCount: function() |
| 152 { | 167 { |
| 153 return this._visibleViewMessages.length; | 168 return this._visibleViewMessages.length; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 177 minimumRowHeight: function() | 192 minimumRowHeight: function() |
| 178 { | 193 { |
| 179 return 16; | 194 return 16; |
| 180 }, | 195 }, |
| 181 | 196 |
| 182 /** | 197 /** |
| 183 * @param {!WebInspector.Target} target | 198 * @param {!WebInspector.Target} target |
| 184 */ | 199 */ |
| 185 targetAdded: function(target) | 200 targetAdded: function(target) |
| 186 { | 201 { |
| 187 /** | |
| 188 * @param {!WebInspector.ConsoleMessage} message | |
| 189 * @this {WebInspector.ConsoleView} | |
| 190 */ | |
| 191 function appendMessage(message) | |
| 192 { | |
| 193 var viewMessage = this._createViewMessage(message); | |
| 194 this._consoleMessageAdded(viewMessage); | |
| 195 } | |
| 196 | |
| 197 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Me
ssageAdded, this._onConsoleMessageAdded, this); | |
| 198 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
nsoleCleared, this._consoleCleared, this); | |
| 199 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Co
mmandEvaluated, this._commandEvaluated, this); | |
| 200 target.consoleModel.messages.forEach(appendMessage, this); | |
| 201 this._viewport.invalidate(); | 202 this._viewport.invalidate(); |
| 202 | |
| 203 target.runtimeModel.executionContexts().forEach(this._executionContextCr
eated, this); | 203 target.runtimeModel.executionContexts().forEach(this._executionContextCr
eated, this); |
| 204 target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.Ex
ecutionContextCreated, this._onExecutionContextCreated, this); | 204 target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.Ex
ecutionContextCreated, this._onExecutionContextCreated, this); |
| 205 target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.Ex
ecutionContextDestroyed, this._onExecutionContextDestroyed, this); | 205 target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.Ex
ecutionContextDestroyed, this._onExecutionContextDestroyed, this); |
| 206 }, | 206 }, |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * @param {!WebInspector.Target} target | 209 * @param {!WebInspector.Target} target |
| 210 */ | 210 */ |
| 211 targetRemoved: function(target) | 211 targetRemoved: function(target) |
| 212 { | 212 { |
| 213 this._clearExecutionContextsForTarget(target); | 213 this._clearExecutionContextsForTarget(target); |
| 214 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events
.MessageAdded, this._onConsoleMessageAdded, this); | |
| 215 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events
.ConsoleCleared, this._consoleCleared, this); | |
| 216 target.consoleModel.removeEventListener(WebInspector.ConsoleModel.Events
.CommandEvaluated, this._commandEvaluated, this); | |
| 217 target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events
.ExecutionContextCreated, this._onExecutionContextCreated, this); | 214 target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events
.ExecutionContextCreated, this._onExecutionContextCreated, this); |
| 218 target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events
.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this); | 215 target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events
.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this); |
| 219 }, | 216 }, |
| 220 | 217 |
| 221 _registerWithMessageSink: function() | 218 _registerWithMessageSink: function() |
| 222 { | 219 { |
| 223 WebInspector.console.messages().forEach(this._addSinkMessage, this); | 220 WebInspector.console.messages().forEach(this._addSinkMessage, this); |
| 224 WebInspector.console.addEventListener(WebInspector.Console.Events.Messag
eAdded, messageAdded, this); | 221 WebInspector.console.addEventListener(WebInspector.Console.Events.Messag
eAdded, messageAdded, this); |
| 225 | 222 |
| 226 /** | 223 /** |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspecto
r.UIString("Execute command")); | 730 section.addKey(shortcut.makeDescriptor(shortcut.Keys.Enter), WebInspecto
r.UIString("Execute command")); |
| 734 }, | 731 }, |
| 735 | 732 |
| 736 _clearPromptBackwards: function() | 733 _clearPromptBackwards: function() |
| 737 { | 734 { |
| 738 this._prompt.text = ""; | 735 this._prompt.text = ""; |
| 739 }, | 736 }, |
| 740 | 737 |
| 741 _requestClearMessages: function() | 738 _requestClearMessages: function() |
| 742 { | 739 { |
| 743 WebInspector.consoleModel.requestClearMessages(); | 740 var targets = WebInspector.targetManager.targets(); |
| 741 for (var i = 0; i < targets.length; ++i) |
| 742 targets[i].consoleModel.requestClearMessages(); |
| 744 }, | 743 }, |
| 745 | 744 |
| 746 _promptKeyDown: function(event) | 745 _promptKeyDown: function(event) |
| 747 { | 746 { |
| 748 if (isEnterKey(event)) { | 747 if (isEnterKey(event)) { |
| 749 this._enterKeyPressed(event); | 748 this._enterKeyPressed(event); |
| 750 return; | 749 return; |
| 751 } | 750 } |
| 752 | 751 |
| 753 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); | 752 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 WebInspector.ConsoleView.ShowConsoleActionDelegate = function() | 1212 WebInspector.ConsoleView.ShowConsoleActionDelegate = function() |
| 1214 { | 1213 { |
| 1215 } | 1214 } |
| 1216 | 1215 |
| 1217 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1216 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
| 1218 /** | 1217 /** |
| 1219 * @return {boolean} | 1218 * @return {boolean} |
| 1220 */ | 1219 */ |
| 1221 handleAction: function() | 1220 handleAction: function() |
| 1222 { | 1221 { |
| 1223 WebInspector.consoleModel.show(); | 1222 WebInspector.console.show(); |
| 1224 return true; | 1223 return true; |
| 1225 } | 1224 } |
| 1226 } | 1225 } |
| OLD | NEW |