Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698