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

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: Comments Created 4 years, 4 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 b125843899c717a267da67d777c1b71cb88ec7cc..5b9387f2e0f8f1845f33f263be2bba18ad450453 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js
@@ -102,7 +102,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;
@@ -118,7 +118,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;
},
@@ -127,11 +127,14 @@ 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());
+ var frame = resourceTreeModel && resourceTreeModel.frameForId(executionContext.frameId);
if (frame && frame.isMainFrame())
return true;
return false;
@@ -190,7 +193,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