| Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js
|
| index 70494e5acedb5330ce3145addb85873f57e7e752..127d7cee01d324c80b26e766a40696f8690f824c 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js
|
| @@ -25,7 +25,10 @@ Console.ConsoleContextSelector = class {
|
|
|
| this._selectElement.addEventListener('change', this._executionContextChanged.bind(this), false);
|
| UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionContextChangedExternally, this);
|
| + UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this._callFrameSelectedInUI, this);
|
| SDK.targetManager.observeModels(SDK.RuntimeModel, this);
|
| + SDK.targetManager.addModelListener(
|
| + SDK.DebuggerModel, SDK.DebuggerModel.Events.CallFrameSelected, this._callFrameSelectedInModel, this);
|
| }
|
|
|
| /**
|
| @@ -88,6 +91,7 @@ Console.ConsoleContextSelector = class {
|
|
|
| if (executionContext === UI.context.flavor(SDK.ExecutionContext))
|
| this._select(newOption);
|
| + this._updateOptionDisabledState(newOption);
|
|
|
| /**
|
| * @param {!Element} option
|
| @@ -225,4 +229,33 @@ Console.ConsoleContextSelector = class {
|
| return this._selectElement[this._selectElement.selectedIndex];
|
| return null;
|
| }
|
| +
|
| + /**
|
| + * @param {!Common.Event} event
|
| + */
|
| + _callFrameSelectedInModel(event) {
|
| + var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.data);
|
| + var options = this._selectElement.options;
|
| + for (var i = 0; i < options.length; i++) {
|
| + if (options[i].__executionContext.debuggerModel === debuggerModel)
|
| + this._updateOptionDisabledState(options[i]);
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * @param {!Element} option
|
| + */
|
| + _updateOptionDisabledState(option) {
|
| + var executionContext = option.__executionContext;
|
| + var callFrame = executionContext.debuggerModel.selectedCallFrame();
|
| + var callFrameContext = callFrame && callFrame.script.executionContext();
|
| + option.disabled = callFrameContext && executionContext !== callFrameContext;
|
| + }
|
| +
|
| + _callFrameSelectedInUI() {
|
| + var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
|
| + var callFrameContext = callFrame && callFrame.script.executionContext();
|
| + if (callFrameContext)
|
| + UI.context.setFlavor(SDK.ExecutionContext, callFrameContext);
|
| + }
|
| };
|
|
|