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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi
nd(this), false); | 133 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi
nd(this), false); |
134 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); | 134 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); |
135 var historyData = WebInspector.settings.consoleHistory.get(); | 135 var historyData = WebInspector.settings.consoleHistory.get(); |
136 this._prompt.setHistoryData(historyData); | 136 this._prompt.setHistoryData(historyData); |
137 | 137 |
138 this._updateFilterStatus(); | 138 this._updateFilterStatus(); |
139 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); | 139 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso
leTimestampsSettingChanged, this); |
140 | 140 |
141 this._registerWithMessageSink(); | 141 this._registerWithMessageSink(); |
142 WebInspector.targetManager.observeTargets(this); | 142 WebInspector.targetManager.observeTargets(this); |
| 143 WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,
this._executionContextChangedExternally, this); |
143 } | 144 } |
144 | 145 |
145 WebInspector.ConsoleView.prototype = { | 146 WebInspector.ConsoleView.prototype = { |
146 /** | 147 /** |
147 * @return {number} | 148 * @return {number} |
148 */ | 149 */ |
149 itemCount: function() | 150 itemCount: function() |
150 { | 151 { |
151 return this._visibleViewMessages.length; | 152 return this._visibleViewMessages.length; |
152 }, | 153 }, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 for (var i = 0; i < options.length; ++i) { | 312 for (var i = 0; i < options.length; ++i) { |
312 var optionContext = options[i].__executionContext; | 313 var optionContext = options[i].__executionContext; |
313 var isSameGroup = executionContext.target() === optionContext.target
() && executionContext.frameId === optionContext.frameId; | 314 var isSameGroup = executionContext.target() === optionContext.target
() && executionContext.frameId === optionContext.frameId; |
314 sameGroupExists |= isSameGroup; | 315 sameGroupExists |= isSameGroup; |
315 if ((isSameGroup && WebInspector.ExecutionContext.comparator(optionC
ontext, executionContext) > 0) || (sameGroupExists && !isSameGroup)) { | 316 if ((isSameGroup && WebInspector.ExecutionContext.comparator(optionC
ontext, executionContext) > 0) || (sameGroupExists && !isSameGroup)) { |
316 insertBeforeOption = options[i]; | 317 insertBeforeOption = options[i]; |
317 break; | 318 break; |
318 } | 319 } |
319 } | 320 } |
320 this._executionContextSelector.selectElement().insertBefore(newOption, i
nsertBeforeOption); | 321 this._executionContextSelector.selectElement().insertBefore(newOption, i
nsertBeforeOption); |
| 322 if (executionContext === WebInspector.context.flavor(WebInspector.Execut
ionContext)) |
| 323 this._executionContextSelector.select(newOption); |
321 }, | 324 }, |
322 | 325 |
323 /** | 326 /** |
324 * @param {!WebInspector.Event} event | 327 * @param {!WebInspector.Event} event |
325 */ | 328 */ |
326 _onExecutionContextDestroyed: function(event) | 329 _onExecutionContextDestroyed: function(event) |
327 { | 330 { |
328 var executionContext = /** @type {!WebInspector.ExecutionContext} */ (ev
ent.data); | 331 var executionContext = /** @type {!WebInspector.ExecutionContext} */ (ev
ent.data); |
329 var option = this._optionByExecutionContext.remove(executionContext); | 332 var option = this._optionByExecutionContext.remove(executionContext); |
330 option.remove(); | 333 option.remove(); |
331 }, | 334 }, |
332 | 335 |
333 _executionContextChanged: function() | 336 _executionContextChanged: function() |
334 { | 337 { |
335 var newContext = this._currentExecutionContext(); | 338 var newContext = this._currentExecutionContext(); |
336 WebInspector.context.setFlavor(WebInspector.ExecutionContext, newContext
); | 339 WebInspector.context.setFlavor(WebInspector.ExecutionContext, newContext
); |
337 this._prompt.clearAutoComplete(true); | 340 this._prompt.clearAutoComplete(true); |
338 if (!this._showAllMessagesCheckbox.checked()) | 341 if (!this._showAllMessagesCheckbox.checked()) |
339 this._updateMessageList(); | 342 this._updateMessageList(); |
340 }, | 343 }, |
341 | 344 |
342 /** | 345 /** |
| 346 * @param {!WebInspector.Event} event |
| 347 */ |
| 348 _executionContextChangedExternally: function(event) |
| 349 { |
| 350 var executionContext = /** @type {?WebInspector.ExecutionContext} */ (e
vent.data); |
| 351 if (!executionContext) |
| 352 return; |
| 353 |
| 354 var options = this._executionContextSelector.selectElement().options; |
| 355 for (var i = 0; i < options.length; ++i) { |
| 356 if (options[i].__executionContext === executionContext) |
| 357 this._executionContextSelector.select(options[i]); |
| 358 } |
| 359 }, |
| 360 |
| 361 /** |
343 * @return {?WebInspector.ExecutionContext} | 362 * @return {?WebInspector.ExecutionContext} |
344 */ | 363 */ |
345 _currentExecutionContext: function() | 364 _currentExecutionContext: function() |
346 { | 365 { |
347 var option = this._executionContextSelector.selectedOption(); | 366 var option = this._executionContextSelector.selectedOption(); |
348 return option ? option.__executionContext : null; | 367 return option ? option.__executionContext : null; |
349 }, | 368 }, |
350 | 369 |
351 willHide: function() | 370 willHide: function() |
352 { | 371 { |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1205 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
1187 /** | 1206 /** |
1188 * @return {boolean} | 1207 * @return {boolean} |
1189 */ | 1208 */ |
1190 handleAction: function() | 1209 handleAction: function() |
1191 { | 1210 { |
1192 WebInspector.console.show(); | 1211 WebInspector.console.show(); |
1193 return true; | 1212 return true; |
1194 } | 1213 } |
1195 } | 1214 } |
OLD | NEW |