| Index: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
|
| index 932dcbc00cef7719f1f8fd76a23e6c4d1625b5ca..b125843899c717a267da67d777c1b71cb88ec7cc 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
|
| @@ -16,6 +16,7 @@ WebInspector.ExecutionContextSelector = function(targetManager, context)
|
|
|
| targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextCreated, this._onExecutionContextCreated, this);
|
| targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this);
|
| + targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextOrderChanged, this._onExecutionContextOrderChanged, this);
|
| this._targetManager = targetManager;
|
| this._context = context;
|
| }
|
| @@ -141,12 +142,7 @@ WebInspector.ExecutionContextSelector.prototype = {
|
| */
|
| _onExecutionContextCreated: function(event)
|
| {
|
| - var executionContext = /** @type {!WebInspector.ExecutionContext} */ (event.data);
|
| - if (!this._context.flavor(WebInspector.ExecutionContext) || this._shouldSwitchToContext(executionContext)) {
|
| - this._ignoreContextChanged = true;
|
| - this._context.setFlavor(WebInspector.ExecutionContext, executionContext);
|
| - this._ignoreContextChanged = false;
|
| - }
|
| + this._switchContextIfNecessary(/** @type {!WebInspector.ExecutionContext} */ (event.data));
|
| },
|
|
|
| /**
|
| @@ -159,6 +155,34 @@ WebInspector.ExecutionContextSelector.prototype = {
|
| this._currentExecutionContextGone();
|
| },
|
|
|
| + /**
|
| + * @param {!WebInspector.Event} event
|
| + */
|
| + _onExecutionContextOrderChanged: function(event)
|
| + {
|
| + var runtimeModel = /** @type {!WebInspector.RuntimeModel} */ (event.data);
|
| + var executionContexts = runtimeModel.executionContexts();
|
| + for (var i = 0; i < executionContexts.length; i++) {
|
| + if (this._switchContextIfNecessary(executionContexts[i]))
|
| + break;
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * @param {!WebInspector.ExecutionContext} executionContext
|
| + * @return {boolean}
|
| + */
|
| + _switchContextIfNecessary: function(executionContext)
|
| + {
|
| + if (!this._context.flavor(WebInspector.ExecutionContext) || this._shouldSwitchToContext(executionContext)) {
|
| + this._ignoreContextChanged = true;
|
| + this._context.setFlavor(WebInspector.ExecutionContext, executionContext);
|
| + this._ignoreContextChanged = false;
|
| + return true;
|
| + }
|
| + return false;
|
| + },
|
| +
|
| _currentExecutionContextGone: function()
|
| {
|
| var targets = this._targetManager.targets(WebInspector.Target.Capability.JS);
|
|
|