Chromium Code Reviews| 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 0573f25821a0397dcc42abb781b457ca9949d3bc..f49f2f77656e3d60891099eff42b1f7a365623b9 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js |
| @@ -101,7 +101,7 @@ WebInspector.ExecutionContextSelector.prototype = { |
| newContext = executionContexts[i]; |
| } |
| for (var i = 0; i < executionContexts.length && !newContext; ++i) { |
| - if (this._isMainFrameContext(executionContexts[i])) |
| + if (this._isDefaultContext(executionContexts[i])) |
| newContext = executionContexts[i]; |
| } |
| this._ignoreContextChanged = true; |
| @@ -117,7 +117,7 @@ WebInspector.ExecutionContextSelector.prototype = { |
| { |
| if (this._lastSelectedContextId && this._lastSelectedContextId === this._contextPersistentId(executionContext)) |
| return true; |
| - if (!this._lastSelectedContextId && this._isMainFrameContext(executionContext)) |
| + if (!this._lastSelectedContextId && this._isDefaultContext(executionContext)) |
| return true; |
| return false; |
| }, |
| @@ -126,11 +126,16 @@ WebInspector.ExecutionContextSelector.prototype = { |
| * @param {!WebInspector.ExecutionContext} executionContext |
| * @return {boolean} |
| */ |
| - _isMainFrameContext: function(executionContext) |
| + _isDefaultContext: function(executionContext) |
| { |
| - if (!executionContext.isDefault) |
| + if (!executionContext.isDefault || !executionContext.frameId) |
| return false; |
| - var frame = executionContext.target().resourceTreeModel.frameForId(executionContext.frameId); |
| + if (executionContext.target().parentTarget()) |
| + return false; |
| + var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(executionContext.target()); |
|
pfeldman
2016/07/13 23:55:57
This will not compile once we split sdk into js_sd
eostroukhov-old
2016/07/20 23:46:15
I believe Joel is looking into it. I am not sure w
|
| + if (!resourceTreeModel) |
| + return false; |
| + var frame = resourceTreeModel.frameForId(executionContext.frameId); |
| if (frame && frame.isMainFrame()) |
| return true; |
| return false; |
| @@ -166,7 +171,7 @@ WebInspector.ExecutionContextSelector.prototype = { |
| for (var i = 0; i < targets.length && !newContext; ++i) { |
| var executionContexts = targets[i].runtimeModel.executionContexts(); |
| for (var executionContext of executionContexts) { |
| - if (this._isMainFrameContext(executionContext)) { |
| + if (this._isDefaultContext(executionContext)) { |
| newContext = executionContext; |
| break; |
| } |