Index: Source/devtools/front_end/components/ExecutionContextSelector.js |
diff --git a/Source/devtools/front_end/components/ExecutionContextSelector.js b/Source/devtools/front_end/components/ExecutionContextSelector.js |
index 1a85cca8dc059a506f8955b483bc0fceeb41a33f..2a3a5b2ef558df4384609da7eeca61841f1f4a2c 100644 |
--- a/Source/devtools/front_end/components/ExecutionContextSelector.js |
+++ b/Source/devtools/front_end/components/ExecutionContextSelector.js |
@@ -11,6 +11,9 @@ WebInspector.ExecutionContextSelector = function() |
WebInspector.targetManager.observeTargets(this); |
WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext, this._executionContextChanged, this); |
WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targetChanged, this); |
+ |
+ WebInspector.targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextCreated, this._onExecutionContextCreated, this); |
+ WebInspector.targetManager.addModelListener(WebInspector.RuntimeModel, WebInspector.RuntimeModel.Events.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this); |
} |
WebInspector.ExecutionContextSelector.prototype = { |
@@ -22,9 +25,6 @@ WebInspector.ExecutionContextSelector.prototype = { |
{ |
if (!WebInspector.context.flavor(WebInspector.Target)) |
WebInspector.context.setFlavor(WebInspector.Target, target); |
- |
- target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.ExecutionContextCreated, this._onExecutionContextCreated, this); |
- target.runtimeModel.addEventListener(WebInspector.RuntimeModel.Events.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this); |
}, |
/** |
@@ -32,8 +32,6 @@ WebInspector.ExecutionContextSelector.prototype = { |
*/ |
targetRemoved: function(target) |
{ |
- target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events.ExecutionContextCreated, this._onExecutionContextCreated, this); |
- target.runtimeModel.removeEventListener(WebInspector.RuntimeModel.Events.ExecutionContextDestroyed, this._onExecutionContextDestroyed, this); |
var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
if (currentExecutionContext && currentExecutionContext.target() === target) |
this._currentExecutionContextGone(); |