| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.TargetManager.Observer} | 7 * @implements {WebInspector.TargetManager.Observer} |
| 8 * @param {!Element} selectElement | 8 * @param {!Element} selectElement |
| 9 */ | 9 */ |
| 10 WebInspector.ConsoleContextSelector = function(selectElement) | 10 WebInspector.ConsoleContextSelector = function(selectElement) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return result.trimMiddle(maxLength); | 47 return result.trimMiddle(maxLength); |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * @param {!WebInspector.ExecutionContext} executionContext | 51 * @param {!WebInspector.ExecutionContext} executionContext |
| 52 */ | 52 */ |
| 53 _executionContextCreated: function(executionContext) | 53 _executionContextCreated: function(executionContext) |
| 54 { | 54 { |
| 55 // FIXME(413886): We never want to show execution context for the main t
hread of shadow page in service/shared worker frontend. | 55 // FIXME(413886): We never want to show execution context for the main t
hread of shadow page in service/shared worker frontend. |
| 56 // This check could be removed once we do not send this context to front
end. | 56 // This check could be removed once we do not send this context to front
end. |
| 57 if (executionContext.target().isServiceWorker()) | 57 if (!executionContext.target().hasJSCapability()) |
| 58 return; | 58 return; |
| 59 | 59 |
| 60 var newOption = createElement("option"); | 60 var newOption = createElement("option"); |
| 61 newOption.__executionContext = executionContext; | 61 newOption.__executionContext = executionContext; |
| 62 newOption.text = this._titleFor(executionContext); | 62 newOption.text = this._titleFor(executionContext); |
| 63 this._optionByExecutionContext.set(executionContext, newOption); | 63 this._optionByExecutionContext.set(executionContext, newOption); |
| 64 var options = this._selectElement.options; | 64 var options = this._selectElement.options; |
| 65 var contexts = Array.prototype.map.call(options, mapping); | 65 var contexts = Array.prototype.map.call(options, mapping); |
| 66 var index = contexts.lowerBound(executionContext, executionContext.runti
meModel.executionContextComparator()) | 66 var index = contexts.lowerBound(executionContext, executionContext.runti
meModel.executionContextComparator()) |
| 67 this._selectElement.insertBefore(newOption, options[index]); | 67 this._selectElement.insertBefore(newOption, options[index]); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 /** | 173 /** |
| 174 * @return {?Element} | 174 * @return {?Element} |
| 175 */ | 175 */ |
| 176 _selectedOption: function() | 176 _selectedOption: function() |
| 177 { | 177 { |
| 178 if (this._selectElement.selectedIndex >= 0) | 178 if (this._selectElement.selectedIndex >= 0) |
| 179 return this._selectElement[this._selectElement.selectedIndex]; | 179 return this._selectElement[this._selectElement.selectedIndex]; |
| 180 return null; | 180 return null; |
| 181 } | 181 } |
| 182 } | 182 } |
| OLD | NEW |