Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextModel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextModel.js b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextModel.js |
| index 95a55893fff06e4d96957ca16999fc01025d86f6..02583fd9f51bc7d5b51aa3d6978cd74b62de214f 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextModel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextModel.js |
| @@ -152,6 +152,9 @@ WebInspector.ExecutionContextModel.prototype = { |
| targetAdded: function(target) |
| { |
| target.runtimeModel.executionContexts().forEach(this._executionContextCreated, this); |
| + var domModel = WebInspector.DOMModel.fromTarget(target); |
| + if (domModel) |
| + domModel.addEventListener(WebInspector.DOMModel.Events.NodeInspected, this._nodeInspected, this); |
|
pfeldman
2016/02/04 00:18:53
This code should move to the UI level in order to
samli
2016/02/05 19:43:16
Done
|
| }, |
| /** |
| @@ -165,6 +168,35 @@ WebInspector.ExecutionContextModel.prototype = { |
| if (executionContexts[i].target() === target) |
| this._executionContextDestroyed(executionContexts[i]); |
| } |
| + var domModel = WebInspector.DOMModel.fromTarget(target); |
| + if (domModel) |
| + domModel.removeEventListener(WebInspector.DOMModel.Events.NodeInspected, this._nodeInspected, this); |
| + }, |
| + |
| + /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _nodeInspected: function(event) |
| + { |
| + /** |
| + * @param {?WebInspector.DOMNode} domNode |
| + * @this {!WebInspector.ExecutionContextModel} |
| + */ |
| + function updateExecutionContext(domNode) |
| + { |
| + if (!domNode) |
| + return; |
| + var executionContexts = this._optionByExecutionContext.keysArray(); |
| + for (var context of executionContexts) { |
| + if (context.frameId == domNode.frameId() || (!domNode.frameId() && context.isMainWorldContext)) { |
| + WebInspector.context.setFlavor(WebInspector.ExecutionContext, context); |
| + return; |
| + } |
| + } |
| + } |
| + |
| + var deferredNode = /** @type {!WebInspector.DeferredDOMNode} */(event.data); |
| + deferredNode.resolvePromise().then(updateExecutionContext.bind(this)); |
| }, |
| /** |